Issue
What must be done to write a program in an InfinityController to send raw text to another device via the controllers comm port.
Environment
- NCI
- NCII
- BCX
- ACX5720, ACX5740
Cause
Must interface with another controller device one to write a program in an InfinityController to send raw text to another device via the controllers comm port.
Resolution
A Plain English program must be created to send the text string formatted as required by the device which will be receiving the text. On a NetController 2 Comm 1 or Comm 3 must be used.
Initially the program must initialize the comm port parameters to match what the external device requires in terms of data speed and bit length, etc. The following is an example of the parameters that should be considered.
Set COMM1 Baud = Baud2400
Set COMM1 DefaultMode = AutoSet
Set COMM1 DataLength = DataBits7
Set COMM1 Parity = Even
Set COMM1 FlowControl = XonXoff
Once the commport has been set, the Program must open the comm port in raw mode using a command similar to the command below.
Open(COMM1)
Once the comm port is open, data may be sent to the comm port using a print statement
Print DataString.Str to Comm1
If the Comm port must be closed following transmission logic will have to be added to test for whether the comm port was opened successfully and for closing the comm port once the transmission is complete.
(Note: If the CommPort is enabled for an XDriver, you may get an error, "Invalid mode for the comm port", when trying to set the CommPort defaultmode to AutoSet. If this occurs use a Commport or Controller that is not XDriver enabled.)