This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
cubloc:opencom:index [2016/04/03 01:20] COMFILE Technology |
cubloc:opencom:index [2016/04/14 11:07] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== OpenCom ====== | ||
+ | ''OpenCom channel, baudRate, protocol, recvSize, sendSize'' | ||
+ | | //channel// |RS232 Channel (1 to 3) | | ||
+ | | //baudRate// |BaudRate | | ||
+ | | //protocol // |Protocol | | ||
+ | | //recvSize // | Receive buffer size (Max. 1024, Do not use a variable) | | ||
+ | | //sendSize // | Send buffer size (Max. 1024, Do not use a variable) | | ||
+ | |||
+ | This command must be used to enable RS-232 communication. | ||
+ | |||
+ | The Cubloc has 2 or 4 channels for RS-232C communication, depending on | ||
+ | the model. Channel 0 is typically used for monitoring and downloading, but | ||
+ | it can also be used for RS-232 communication if monitoring is not needed. | ||
+ | Downloading will still work regardless. | ||
+ | |||
+ | You may use any value between 2400 to 230400, but we are recommed one of | ||
+ | the following values. | ||
+ | |||
+ | 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 76800, 115200, 230400 | ||
+ | |||
+ | For the protocol parameter, please refer to the table below: | ||
+ | |||
+ | ^Bit7 ^Bit6 ^Bit5 ^Bit4 ^Bit3 ^Bit2 ^Bit1 ^Bit0^ | ||
+ | | | | |Parity| |Stop Bit |Bit |# of Bits| | ||
+ | | | | |0 |0 = NONE |0=1 Stop Bit| 0 |0 = 5 bit| | ||
+ | | | | |0 |1 = Reserve| 1=2 Stop Bits |0 |1 = 6 bit| | ||
+ | | | | |1 |0 = Even| |1 |0 = 7 bit| | ||
+ | | | | |1 |1 = Odd| |1 |1 = 8 bit| | ||
+ | |||
+ | |||
+ | <code xbasic> | ||
+ | OpenCom 1, 19200, 3, 30, 20 'Set to 8-N-1 | ||
+ | </code> | ||
+ | |||
+ | The send and receive buffer size can be set with the OpenCom command. | ||
+ | Each buffer can be as large as 1024 bytes, but be aware that the send and | ||
+ | receive buffers consume data memory. So the larger the buffers, the fewer | ||
+ | number of variables can be used in the program. Receive buffer sizes from | ||
+ | 30 to 100 and send buffer sizes from 30 to 50 will suffice for most | ||
+ | programs. | ||
+ | |||
+ | For the CB220 module, pins 1 and 2 can be used for channel 0. Ports 10 | ||
+ | and 11 can be used for channel 1. | ||
+ | |||
+ | {{ :cubloc:opencom:cb220rs232c.png?nolink |}} | ||
+ | |||
+ | For the CB280 module, there are dedicated RS-232 ports. For channel 1, | ||
+ | there are 2 types of outputs: +/-12V and TTL (+5/0V). | ||
+ | |||
+ | Please make sure to use only one of them at a time. | ||
+ | |||
+ | {{ :cubloc:opencom:cb280rs232c.png?nolink |}} | ||
+ | |||
+ | ===== CB400/CB405/CB405RT RS232 How-to ===== | ||
+ | |||
+ | The following is a table of the 5V TTL signal pins for the CB400/CB405/CB405RT: | ||
+ | |||
+ | ^Channel ^I/O Port ^5V TTL^ | ||
+ | |1 |P42 |RX| | ||
+ | |:::|P43 |TX| | ||
+ | |2 |P8 |RX| | ||
+ | |:::|P9 |TX| | ||
+ | |3 |P56|RX| | ||
+ | |:::|P57| TX| | ||
+ | |||
+ | The CB400/CB405 has an internal MAX232 that can be used to convert any | ||
+ | of the 5V TTL signals to +/- 12V level signals. The following is an example | ||
+ | for connecting channel 3: | ||
+ | |||
+ | This allows any +/- 12V RS232 device to connect to TXE and RXE. | ||
+ | |||
+ | {{ :cubloc:opencom:cb400rs232c.png?nolink |}} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | [[cubloc:index#system_library:|Go CUBLOC home]] |