How does the serial port text input routine work?
Why is my Marking Head not marking the first few characters of the serial data I send?
Will my serial port input data get lost if it is received by the WinMark Pro PC before the next part is ready?
The following are results of testing done to verify the serial port data handling within WinMark Pro:
- 1. If a mark file contains automation using the serial port, WinMark Pro initializes the serial port at the beginning of each mark session. Note that the act of initialization clears whatever contents might remain from serial communications prior to the session start (pressing the F1 key, or the moment Launcher opens the mark file). This is the only time the port is initialized in all WinMark Pro versions from build 3033 on. (Previous builds opened and closed the serial port at each data access, which caused no serious problems, but delayed the marking process.)
- 2. Note: Users are cautioned to avoid transmitting serial data until the serial port is ready so that data is not lost. This issue is further compounded if the drawing’s Mark Count property is set to one, which means that every mark is a separate mark session, causing WinMark Pro to initialize the serial port on every mark.
- 3. Handshaking methods (Xon/Xoff vs. Hardware vs. None) are all handled at the Operating System/BIOS level. The user can dictate any handshaking they desire, but this is all handled below the level at which WinMark Pro operates.
- 4. Serial data is made up of standard ASCII data (one byte = one character), so the character content is limited to the ASCII character set. Special characters used in the protocol are the Carriage Return (CR, x0Dh, ^M, 13 decimal) to delimit one string of characters from another, and Line Feed (LF, x0Ah, ^J, 10 decimal) to force the new line within a text string value. If serial transmission of special characters (Unicode, etc.) is desired, it can be done via ActiveX.
- 5. The buffering of the data is done at the OS level, so that data can be transmitted to the WinMark Pro PC independently of the rate at which it is read by WinMark Pro. This was verified using the following test:
-
a. Set up a mark file with a single Read From Serial Port text object, with the Mark Count set to 100.
- b. Generate a text file containing 100 entries of 20 characters each, with each line terminated with a CR. Note that it was found during this testing that pressing the ‘Enter’ key following each string while creating the source text file would embed a CR then an LF character (not the other way around!), and that this would have adverse affects on the string behavior within WinMark Pro. Note that this affect is NOT seen when entering data in a live terminal session using ProComm or other terminal emulation programs. (No doubt these programs send only the CR when ‘Enter’ is pressed.) It is imperative that, if planning on spooling string data into and out of a text file before transmitting it to WinMark Pro via RS232, customers understand this distinction.
- c. The text file was read by the source PC and transmitted as a continuous stream of data after the mark session had been initiated. (To prevent timing out, the serial port timeout value should be set to 100 seconds.)
-
d. Note that, from the transmitting side, it can be seen that the 2100 bytes of data are sent in multiple packets (four in testing at Synrad), with each packet size being the amount of data that fills the WinMark Pro PC’s serial buffer. Results showed that a packet would be sent, then a moment would go by while the WinMark Pro PC stored the serial data and flagged the next buffer, then the next buffer would transmit, etc. All of this handshaking was done at the OS/BIOS level, and was handled independently of WinMark Pro. The transmit behavior was the same regardless of the handshaking protocol selected on the source and WinMark Pro PCs.
- e. The entire data set of 100 strings was transmitted within the first three or four marks (~ 2 seconds).
- f. WinMark Pro successfully parsed the data file, grabbing each set of 20 characters (+ CR) from the serial buffer, and all marking was completed as expected.
- g. Once this behavior had been verified, the initialization process was tested by transmitting spurious data before the mark session had begun (while the drawing editor was open, but F1 had not been pressed). All data sent before the mark session start was flushed and ignored.
Note that it is possible to overrun the WinMark data buffer if serial data is continuously transmitted in small packets. If the buffer is overrun, the mark data may be corrupted, or a number of data elements may be skipped in the marking process. The hardware handshaking described below will prevent this from happening.
Is there a way to force handshaking between the serial port data generator and WinMark Pro?
If your serial port data generator (computer, PLC, etc.) supports hardware handshaking and you have an FH head or Fenix with an available output, you can use an output to connect the data generator’s RTS/CTS lines when WinMark Pro is ready to receive data. The example described below will assume that OUT7 is being used to command the data generator to transmit serial data to WinMark Pro.
- 1. Wire the data generator’s RTS signal (pin 7 if using a DB-9 serial port connector) to the OUT7 terminal on the marking head.
- 2. Wire the data generator’s CTS signal (pin 8 if using a DB-9 serial port connector) to the RTN7 terminal on the marking head.
- 3. Configure the WinMark Pro automation to
- a. Set OUT7 immediately prior to reading the data from the serial port
- b. Perform the serial port automation.
- c. Clear OUT7
Note that you can use WinMark Pro’s Event Builder to gain more flexibility in the order of your automation sequence. The output commands and serial port data commands may be defined in the precise order needed to satisfy the automation described above.
- 4. Configure the data generator to use Hardware handshaking so that, when OUT7 is open (the cleared state), the generator does not transmit data.
This handshaking method has that advantage that, if marking is held up for any reason (power is lost at the Marking Head, I/O conditions prevent WinMark Pro from continuing through the automation sequence, etc.), the marking equipment may be restarted again without losing sync with the data generator.
[Back to Questions] [Top of Page] [Previous Page] [Next Page]
