Sannin

Problem communication rs232 sysmac studio

26 posts in this topic

Hello everyone on the forum and happy new year. I have a problem and I hope you can help me. I have to communicate via RS-232 with a board that drives gate motors. Can you tell me which blocks to use on the Sysmac Studio (NX1P2-9024DT1 and NX1W-CIF01) to send and receive packets? I attach (apologies if I'm in Italian and not in English) the structure of the packages (and some examples) that accepts the card with the hope that you can help me. Thank you all and happy new year

Edited by Sannin

Share this post


Link to post
Share on other sites

Post links to the document sources if you can.

Share this post


Link to post
Share on other sites
7 hours ago, Sannin said:

Hello everyone on the forum and happy new year. I have a problem and I hope you can help me. I have to communicate via RS-232 with a board that drives gate motors. Can you tell me which blocks to use on the Sysmac Studio (NX1P2-9024DT1 and NX1W-CIF01) to send and receive packets? I attach (apologies if I'm in Italian and not in English) the structure of the packages (and some examples) that accepts the card with the hope that you can help me. Thank you all and happy new year

Looks like raw serial data. You'll need to setup the option board as no protocol and match the specs. The instructions you'll use are :

NX_SerialSend

NX_SerialRcv

It's good practice to use the NX_SerialBufClear before a new communication cycle as well but that's up to you. You'll need the node location variable which is hidden by default. You can display it and assign a tag by right clicking on the CIF01 in your IO Map and selecting "Display Node Location Port". The rest of the steps can be found in the instruction help file. I can't read Italian but if you need start or end codes you'll have to add them. There is an end code by default (0D).

 

 

Edited by photovoltaic
1 person likes this

Share this post


Link to post
Share on other sites

Thank you for answering. I took an example from Omron where the card was an NX-CIF and modified it for use with the NX1W-CIF01. Regarding the use of the two blocks Send and Rcv, in the card manual it is written that the packet to be sent must be made up of four blocks starting from the left:

1 byte of "header",

1 byte of "data length",

0 to 252 bytes of "data",

1 byte of "checksum".

I tried to send an array, for example to restart the board, but despite the command being "DONE", I get no response and the board does not restart. Sure I'm wrong, but shouldn't the value of the array[0] be the "header" of the packet and the "size" on the "send" block equal to 1? Thank you

Edited by Sannin

Share this post


Link to post
Share on other sites

Can you link this section of the manual? My understanding is that you only send whatever you specify in the SendDat array.

Share this post


Link to post
Share on other sites

Unfortunately I only have the paper manual in Italian of which I took some photos and which I have attached in the post above

Share this post


Link to post
Share on other sites
42 minutes ago, Sannin said:

Unfortunately I only have the paper manual in Italian of which I took some photos and which I have attached in the post above

I meant the Omron manual where it claims that you need :

1 byte of "header",

1 byte of "data length",

0 to 252 bytes of "data",

1 byte of "checksum".

Share this post


Link to post
Share on other sites

Excuse me, maybe I wrote wrong, I meant the card manual

Share this post


Link to post
Share on other sites
38 minutes ago, Sannin said:

Excuse me, maybe I wrote wrong, I meant the card manual

Do you mean the gate control device needs to receive the data in that format?

Share this post


Link to post
Share on other sites
38 minutes ago, photovoltaic said:

Do you mean the gate control device needs to receive the data in that format?

Yes

Share this post


Link to post
Share on other sites

In that case, configure your SendDat accordingly.  For the hardware details command in your message you would:

SendDat[0] = byte#16#48

SendDat[1] = byte#16#01

SendDat[2] = byte#16#00

SendDat[3] = byte#16#49

Your SendSize would be 4. This will send "Jolly3" as the manual states.  Once sent you can check for received data and verify that it returned 49 hex.

Share this post


Link to post
Share on other sites
59 minutes ago, photovoltaic said:

In that case, configure your SendDat accordingly.  For the hardware details command in your message you would:

SendDat[0] = byte#16#48

SendDat[1] = byte#16#01

SendDat[2] = byte#16#00

SendDat[3] = byte#16#49

Your SendSize would be 4. This will send "Jolly3" as the manual states.  Once sent you can check for received data and verify that it returned 49 hex.

Okay.  So should I do four nx-Send blocks in series for each sendDat[n], or just one for sendDat[0]?  Thank you

Share this post


Link to post
Share on other sites

The Send block will send all of that data in one message - so just one. I can't upload pictures right now but you can set all those value and then set the size to 4.

 

Share this post


Link to post
Share on other sites

Okay. I'll let you know on Monday. Meanwhile, thanks again for the help, have a good weekend and best wishes

Share this post


Link to post
Share on other sites

If you remove the cable does the light go out?

Share this post


Link to post
Share on other sites
39 minutes ago, photovoltaic said:

If you remove the cable does the light go out?

Yes

Share this post


Link to post
Share on other sites

This sounds a bit like a cable issue to me - I have seen this behavior with an incorrect cable before. Do you have a pinout for the gate controller?

Share this post


Link to post
Share on other sites

Just an FYI: wire it TX - TX and RX - RX.

Share this post


Link to post
Share on other sites

Ok, yes I have the board pinout, and I cross connected it, am I wrong?.  I knew it was wired Rx to tx and Tx to rx. However if I put them paired, rx with rx and tx with tx, the led turns off and turns on only when I send the command

Edited by Sannin

Share this post


Link to post
Share on other sites
2 hours ago, Sannin said:

Ok, yes I have the board pinout, and I cross connected it, am I wrong?.  I knew it was wired Rx to tx and Tx to rx. However if I put them paired, rx with rx and tx with tx, the led turns off and turns on only when I send the command

Correct. Its a bit confusing. TX-TX and RX-RX is correct from what I can find. Generally when the light stays on they are backwards. Is it communicating now?

Share this post


Link to post
Share on other sites

I'll try tomorrow and let you know, because I noticed the mistake at the end of the day.  Thanks anyway.  I keep it updated

Share this post


Link to post
Share on other sites

Hello, even changing the cable connection. Now the COMM led only lights up when I send packets, but I receive nothing

Share this post


Link to post
Share on other sites

Do you have the ability to communicate with the gate controller using your PC? ( a usb to serial converter). This is much easier to test with. Have you tried using either CR or LF (or both) as the end code?

Also a link to the manual will help.

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