How do you talk ascii to a device on a serial port?? form CODESYS
Generally speaking, Weintek’s Codesys cannot communicate using the HMI’s serial ports directly. There are several reasons for this limitation, but a relatively straightforward explanation is that allowing Codesys access to the HMI’s serial port would limit both the HMI and Codesys’s ability to communicate via certain protocols.The method we prefer to use is to route communication from Codesys through the HMI to the desired device. The procedure is described in detail within this post: Link
However, sending RAW “ASCII” characters must be done with the HMI’s “Free Protocol” driver. So, the method described within that post will not work for your application. Here is the procedure that I would advise:
- Add the “Free Protocol” driver to facilitate communication.
Note: Here is a link to a tutorial in which we demonstrate how to “Outport” a request and “Inport” a response: Link.
- When a response is received, use a “SetData” command to move this data into the Codesys variable that you’ve imported within your project: