IO_Rack

NX1P2 w/ NX-CIF12 Option Module

9 posts in this topic

Where can I find the Receive Buffer?

If not, then how can I, at least, know if the Receive Buffer has any data?

I'm feeling very silly right now but all the examples I've found in several documents shows the NX Bus Module examples. The I/O Map only shows 'Node Location Information'.

Share this post


Link to post
Share on other sites

Are you referring to using the CIF12 for no protocol mode?  If so, look at the NX_SerialRCV instruction.  It has the size and the buffer data as variables (either in/out or out).

5ebc50dad5af2_NXSerialRCV.jpg.4b16338442

Share this post


Link to post
Share on other sites

Thanks to the reply. Yes, I'm using no protocol mode. I'm communicating with a third party device where I'm performing Command and Response actions. It's working well but I want better control for initiating the read. Right now I'm sending the command, pausing for about 50ms, then reading the response using the NX_SerialRcv instruction.

I was looking for a flag or some feedback that data is ready (hardware buffer has something in it). For the NX Bus Modules, there is a E001_NX_Unit_I_O_Data_Active_Status_63[x] in the examples. For the CJs using the RXD instruction, there is the A392.06 RS232C Port Receive Ready Flag.

I would like to know that it's ready before executing the NX_SerialRcv. Maybe I'm misunderstanding how this instruction works. Is this different for the CIF12?

Share this post


Link to post
Share on other sites

No, you are thinking about it the right way, not misunderstanding.  I will look and see if I can dig that up.  You are right, there seems to be limited info on this.  

Share this post


Link to post
Share on other sites

Look at the NX_SerialStatusRead Function block.

Share this post


Link to post
Share on other sites

The equivalent of E001_NX_Unit_I_O_Data_Active_Status_63[x] for the CIF12 option board would be _PLC_OptBoardSta[1].Run

Share this post


Link to post
Share on other sites

Due to our limited availability at our facility, I'm not able to test this week.

The NX_SerialStatusRead Function block looks like what I'm looking for and it exists for the option board only. I saw it before but the description confused me. It looks like it was Japanese translated verbatim... which I should be used to by now.

MrPLC_CIF12_PortStatus.JPG.228987911baf7

It's possible they are saying, PortStatus.FullRcvBuf means, Receive Buffer is full but note (*1) that it may not be completely full. I'll give it shot and post back with my results.

Share this post


Link to post
Share on other sites

IO Rack

Let me try to shed some light on this discussion.

In the CS / CJ platform, you looked at the AR bit to know when the reception was complete, based on terminator, size, etc.  When the condition was met, you executed the RXD instruction to get the data from the buffer.

In the NX / NJ, you have to look at it differently.  In the NX / NJ you execute the instruction and if there is data already in the buffer that matches the criteria, the data is pulled from the buffer.  If the end condition is not met immediately upon executing the instruction, the instruction waits to see if the condition is met withing the amount of time specified the Option.Timeout parameter.  If not, it ends with an error.

So I typically execute the receive with a long timeout to wait for incoming data.

 

I have also included a writeup on using the DevicePort parameter on the NX / NJ.

CONFIG~1.PDF

1 person likes this

Share this post


Link to post
Share on other sites

The light has been shown! :idea:

I now have total control of my serial responses. Setting the long timeout is key when testing. This also cleared up my confusion with the CS / CJ comms. For some reason, I thought that setting start and end codes to nothing would allow the AR bit to turn on if any non-zero bytes were in the buffer. :no: It's been a while. I prefer fieldbus solutions whenever possible.

Thank you Mr PMCR for the explanation and suggestions!

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