NX1P2/CIF105 Buffer control

2 posts in this topic

Hello people!

I use the CIF-105 serial card installed on NX1P2 CPU. I have a device that continuously transmits data, which is connected to the serial card and I want to have sample data every one minute.

I have two questions for this topic.

Question #1:

Even though I have set the serial communication instruction (NX_SerialRcv) to operate every one minute, while checking the status of the channels input data at I/O Map, I realized that data keep coming on CIF-105 continuously meaning that operates independently and does not synch with the NX_SerialRcv operation. As a result, buffer on CIF-105 gets full and when data are transmitted to the CPU, some data are discarded from the final data received. I thought that if I could control the port status CIF-105 card (enabled every one minute) I could control the flow of the data and buffer wouldn't be full all the time. The thing is I cannot find any description and data type in the port section of CIF-105 to assign a variable and control the operation of the card. What is the optimum way to control the serial communication and eliminate this issue?

  Question #2:

Sentences from serial device have the following format:

[02]20210624162456,P,11562467,17647325*7C[03][02]20210624162456,A,      79,1000,     980,I    9.7,    30*0B[03][00][02]20210624162456,D,    NORM,    NORM,    RUN ,    STOP,    NORM*28[03]

How can I use the start and end for text (02 & 03) so my serial communication with the device to begin from [02] and end at [03]? I tried configuring the RcvCfg with the _SERIAL_START_CODE2 by setting to the the start code byte1 the 16#30 value and to the start code byte1 the 16#32 value but didn't work...


Thanks a lot!

Edited by man31

Share this post

Link to post
Share on other sites

Generally you read the buffer from the card whenever data is available. The bit for this is in your IO Map called CH1 Receive Data Exist. You may want to wait a second or two after this bit becomes true before you read the buffer.

Assigning an ASCII number as your start/end characters isn't a good idea in my opinion since you will be receiving ASCII numbers in the data. I would simply read all the data and parse out what you need using the FIND instruction. Locate [02] and [03] and remove the contents in between.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now