ARDUINO MEGA Functions Serial Link
(→configureSerialPort) |
|||
| Line 116: | Line 116: | ||
|- | |- | ||
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_void|void]]) This function will manually configure the serial port for a specific mode (system, user, Xbee, VEX LCD, etc). You can also set this same functionality using the "Motors and Sensor Setup" window. | | style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_void|void]]) This function will manually configure the serial port for a specific mode (system, user, Xbee, VEX LCD, etc). You can also set this same functionality using the "Motors and Sensor Setup" window. | ||
| + | |||
| + | typedef enum TSerialPortMode | ||
| + | { | ||
| + | uartSystemCommPort = 1, // Standard ROBOTC IDE System Messaging Port | ||
| + | uartUserControl = 2, // Fully user controlled. | ||
| + | uartVEXLCD = 3, // VEX 2x15 LCD. Manages LCD updates in background. | ||
| + | uartXBeeZigBee = 4, // UART used for XBee ZigBee networking | ||
| + | uartXBeeWiFi = 5, // UART used for XBee WiFi networking | ||
| + | uartCMUCAM = 6, // Legacy CMU Cam (Rev.1) support | ||
| + | uartSerialGPS = 7, // Connected to a serial GPS | ||
| + | } TSerialPortMode; | ||
Revision as of 10:03, 10 May 2012
The Arduino MEGA has 4 user serial ports - 1 reversed for the system and 3 user controllable serial ports. These serial ports can be configured in code or via the Motors and Sensor Setup window. The serial ports are buffered - a 70 byte receive buffer and a 40 byte transmit buffer.
|
| |||||||
getChar
| short getChar(const TUARTs nPort) | |||||||
| (short) Function will retrieve the next character from the buffer that was sent to port 'nPort'.
|
sendChar
| void sendChar(const TUARTs nPort, short nChar) | ||||||||||
| (void) Function will send the next character to port 'nPort'.
|
setBaudRate
| void setBaudRate(const TUARTs nPort, TBaudRate nBaudRate) | ||||||||||
| (void) Function will set the Baud Rate for port 'nPort'.
Acceptable Baud Rates: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 200000, 230400 and 250000.
|
configureSerialPort
| void configureSerialPort(const TUARTs nPort, TSerialPortMode nMode) | ||||||||||
| (void) This function will manually configure the serial port for a specific mode (system, user, Xbee, VEX LCD, etc). You can also set this same functionality using the "Motors and Sensor Setup" window.
typedef enum TSerialPortMode { uartSystemCommPort = 1, // Standard ROBOTC IDE System Messaging Port uartUserControl = 2, // Fully user controlled. uartVEXLCD = 3, // VEX 2x15 LCD. Manages LCD updates in background. uartXBeeZigBee = 4, // UART used for XBee ZigBee networking uartXBeeWiFi = 5, // UART used for XBee WiFi networking uartCMUCAM = 6, // Legacy CMU Cam (Rev.1) support uartSerialGPS = 7, // Connected to a serial GPS } TSerialPortMode;
|
bXmitComplete
| boolbXmitComplete(const TUARTs nPort) | |||||||
| (bool) Function will return if the transmit (Xmit) buffer is empty.
|
