Two serial ports are available on the CGMMSTICK and CGCOLORMAX for asynchronous serial communications.
MMIDE can again be used to demonstrate serial communication.
This example uses the CGCOLORMAX1, since it has on-board RS232 circuitry.
The CGCOLORMAX2 has optional RS232 circuitry. The same functionality is possible with the RS232 line driver chip added, but the connector/pin names and numbers will be different.
CGCOLORMAX1 hardware used for serial example.
OK bear with me here. There are a lot of pin numbers that need to be kept straight.
From the Maximite manual:
COM1: uses pin 15 for receive data (data in) and pin 16 for transmit data (data out). If flow control is specified pin 17 will be used for RTS (receive flow control – it is an output) and pin 18 will be CTS (transmit flow control – it is an input).
COM2: uses pin 19 for receive data (data in) and pin 20 for transmit data (data out) in the monochrome Maximite and D0 for receive data and pin D1 for transmit data on the Colour Maximite.
We will use COM1 on the CGCOLORMAX1 for this example.
The MMBasic firmware transmits data out of the Maximite on what the software refers to as I/O Pin 16. I/O Pin 16 is located on the CGCOLORMAX1 on J9 (and J9a). If you count pins from the square pin (1) on J9 and zig zag back and forth on that connector then I/O Pin 16 is located on that connector’s 14th pin. On the hardware picture above I connected to J9.14 with a blue wire.
This TX signal needs to go to the RS232 circuit connector on the CGCOLORMAX1. This would be J10, along the edge of the printed circuit board. The blue wire needs to connect to pin 7 on J10. The circuit converts this TX signal to RS232 voltage levels and the TX signal then appears on J12, pin 6. This is connected to a PC serial port RS232 input via the 2nd blue wire.
The PC receives this signal from the CGCOLORMAX1 and transmits a reply to the receive circuit via a white wire connected to J12 pin 5. The RS232 circuit on the CGCOLORMAX1 converts the voltage level to something safe for the CGCOLORMAX1 and that received signal appears on J10, pin 6.
A white wire connects the J10 pin 6 signal to J9 (or J9a) Pin 12. That pin is associated with software I/O Pin 15 to receive the date.
Whew! Did you follow all of that?
Keep in mind that RS232 circuit pin numbers will be different for the CGCOLORMAX2.
A serial port application on the PC is set to the right baud (in this case 1200) to match that of the MMIDE applet.
The RS232 circuit of the CGCOLORMAX1. The driver chip is populated on the CGCOLORMAX1.
The RS232 circuit of the CGCOLORMAX2. The driver chip is not populated on the CGCOLORMAX2. The chip is through-hole and can be added by soldering it in place.
The CGCOLORMAX1 and CGCOLORMAX2 both contain circuitry that supports RS232 communication. On the CGCOLORMAX1, the RS232 driver is included on the board. The CGCOLORMAX2 contains all of the associated circuitry, except for the RS232 driver chip. That chip can be purchased separately.
Using the serial applet for port 1.
The MMIDE applet communicates with the PC through the hardware described above.
The “Open 1” button sends the command:
OPEN “COM1:1200, 256” AS #1
to the CGCOLORMAX1 to open the serial port. The text string that you type in the send text area is sent to the serial port when the “Send” button is pushed.
PRINT #1, “This is a test”
“This is a test” is then sent out the serial port of the CGCOLORMAX1 to the PC.
A string typed in the serial port application on the PC is received by the CGCOLORMAX1 into the serial buffer. Pressing the “Get” button sends a command from MMIDE to the CGCOLORMAX1 to get stuff out of it’s buffer and then MMIDE displays it.
CGCOLORMAX1 connected to an RS485 device.
MMBasic (version 4.2+) supports the driver enable needed to correctly operate an RS485 driver chip. “DE” is the option available for the OPEN command that uses a selected port line for control of an RS485 chip.
The RS485 circuit of the CGCOLORMAX1. The driver chip is populated on the CGCOLORMAX1.
The RS485 circuit of the CGCOLORMAX2. The driver chip is not populated on the CGCOLORMAX2. The chip is through-hole and can be added by soldering it in place.
The CGCOLORMAX1 and CGCOLORMAX2 both contain circuitry that supports RS485 communication. On the CGCOLORMAX1, the RS485 driver is included on the board. The CGCOLORMAX2 contains all of the associated circuitry, except for the RS485 driver chip. That chip can be purchased separately.