Two serial ports are
available on the CGMMSTICK1 and CGCOLORMAX1 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.
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
CGCOLORMAX1for 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?
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 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.
Purchase a CGMMSTICK1 Download of Maximite Integrated Development Environment: MMIDE
No comments:
Post a Comment