PaulB303

Reading ASCII Sign "9" values - Serial Communication from Force Gauge to NX-CIF101 Interface Card using Sysmac Studio

2 posts in this topic

Hi All,

I'm looking to setup communications between a digital force gauge and an Omron NX-CIF1010 RS232 serial communication interface.

 Here is the Output Protocol from the Force Gauges Manual:

Output Protocol RS-232 Parameter - Baudrate: 9600 - Data-Bit: 8 - Parity: none - Stop-bit: 1 The measured value is requested by the PC by the ASCII Sign “9”.

I've tried to follow the youtube video, "How to communicate via RS 232 using an NX CIF to a PC" however setting up communication between the force gauge instead of a PC is proving difficult.

How to communicate via RS 232 using an NX CIF to a PC - YouTube

This is quite new to me so I'm trying to get my head around it at the moment so please correct me if I'm wrong. I'm reading values from the Force gauge in ASCII and I need to convert those values into another numerical value data type. I've seen in CX-Programmer, ASCII values being converted into Floating Point values using the "FVAL" instruction using Data registers however I can't use the same approach in Sysmac Studio.

Do I need to clear the serial buffer everytime before I look to receive a numerical value from the force gauge?

Here are details regarding the screenshots I've included below:

1) CIF101 Parameters to read Force Gauge Output Protcol in Sysmac Studio which should be matching the force gauges output protocol.

2) CIF101 IO Map in Sysmac Studio - ** I'm unsure if this is where I need to be linking the "RcvDat" input of the "NX_SerialRcv" function block?

3) CIF101 Sending Data Function Block - "NX_SerialBufClear" function block setup - "port_id" data type has been changed to "_sDevice_Port".

4) CIF101 Receiving Data Function Block - "NX_SerialRcv" function block setup

5) Global Variable - Array [0..3] OF BYTE - used in "RcvDat" input of "NX_SerialRcv" function block 

6) Internal Variables Created  to send and receive data

7) Force Gauge RS232 Configuration

8) Force Gauge Output Protocol

 

Any help would be greatly appreciated.

Paul

 

CIF101 Parameters to read Force Gauge Output Protol 1.PNG

CIF1010 IO Map - 2.PNG

CIF101 Sending Data Function Block - NX_SerialBufClear - 3.PNG

CIF101 Receiving Data Function Block - NX_SerialRcv - 4.PNG

GLOBAL~1.PNG

Internal Variables Created  to send and receive data- 6.PNG

Force Gauge RS232 Configuration - 7.PNG

Force Gauge Outpu Protocol - 8.PNG

Share this post


Link to post
Share on other sites

A few things that jump out:

  1. You need to assign the Port_ID variable to the sNXUNIT_ID variable in your IO Map.
  2. You Rec_Array should be much bigger. I would use BYTE[16] personally. 4 bytes is too small.
  3. Your order of operations should be: Clear buffer, send the ASCII 9 character, when new data is present then read it and decipher. It looks like the device needs to be polled by the ASCII 9 - it doesn't just send updates regularly. You can check for new data by assigning a tag to the CIF card's "CH1 Receive Data Exist" flag in the IO Map.

 

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