// 4 x COM Ports test for MT-ARM Boards // This program opens 4 ports at the same time (optionally with different baudrates) // NEW additional baudrates settings for MT-ARM-Stamp Boards are: // 384 = 38400 // 576 = 57600 // 1152 = 115200 // Since the maximum signed integer for the 16-bit MT System is 32767, therefore, these changes are necessary. main() { int i; writes("4xCOM Test", 500); sys(100, 0); // Enable USB COM ports sys(0, 0); // select COM port 0 setcomm(9600); // set baudrate for COM port 0, 9600,8N1 sys(0, 1); // select COM port 1 setcomm(9600); // set baudrate for COM port 1, 9600,8N1 // no need to set the baudrates for USB-COM ports, the ARM MCU will detect it automatically! loop { writei('u', i++, 0); // Just a counter to show it is running sys(0, 0); // select COM port 0 writes("$This line will appear on UART-0", 500); writec(232, 13, 0); // o/p NewLine writec(232, 10, 0); // o/p LineFeed sys(0, 1); // select COM port 1 writes("$This line will appear on UART-1", 500); writec(232, 13, 0); // o/p NewLine writec(232, 10, 0); // o/p LineFeed sys(0, 2); // select USB-COM port 0 writes("$This line will appear on USB-COM-0", 500); writec(232, 13, 0); // o/p NewLine writec(232, 10, 0); // o/p LineFeed sys(0, 3); // select USB-COM port 1 writes("$This line will appear on USB-COM-1", 500); writec(232, 13, 0); // o/p NewLine writec(232, 10, 0); // o/p LineFeed } }