OMRON CPM2A PLC and RS-232C to the PC

vislab

Member
Join Date
Feb 2005
Posts
20
Hello,

I hope someone can help to resolve the current issue that I have now. I am using OMRON CPM2A PLC connected to the desktop PC so that it is able to communicate through the RS-232C COM port.
And I wrote a simple PLC code which uses 2 PLC outputs to operate a simple pneumatic solenoid valves so it just works fine.
Here I also wrote a simple VB code to send "OK" signal to the PLC through the RS-232C COM port so the PLC routine is supposed to run only if it receives "OK" signal from the PC through the RS-232C COM port. I used of course RXD PLC function in the PLC code. So right now there is only one direction communication from the PC to the PLC.

But the problem I saw is this everytime after I shutdown the desktop PC and reboot it, the PLC would not run anymore it means when it receives "OK" signal it did not do anything so no output LEDs lit on. And also when the PC shuts down if I look at the PLC panel there was a COMM LED blinking once.

But if I unplug the power to the PLC and plug it back then it runs OK again. So far I don't know what is wrong and what I can do to fix this problem but it is weird everytime when I just reboot not shutdown then it still works fine.
Anyway this is the problem I see now and I really appreciate if somebody can give me solution or comment.
Then thanks for your taking your time to read this and I am looking forward to hearing from you soon.

Regards,

Sonny
[email protected]
 
Last edited:
Check to make sure the "Settings" for the Host Link port are correct.

Next make sure the RXD instruction is set up correctly. The bottom value in the instruction is the number of bytes to receive. If this is not set properly, it can cause problems.
Also, make sure the data has been received on the port before you initiate the RXD instruction. There are "flag" bits that can be used for this purpose.

The progamming manual for the CPM2A is W353. You can download the manual from www.omron.ca. In the left menu click on Document Library. Enter W353 in the partial document number box and click search (or go?).

Good Luck. Let us know if you have any other questions.
 
Thanks for your comment and information.
This is the PLC RS-232C communication settings that I used.

Custom
Baus: 9600
Format: 1,8,1,N
Mode: RS-232C

Start Code: 0x003E

End Code: 0x000D

And RXD is set to receive 2 bytes because "OK" is 2 bytes.


And I used the Reception Completed Flag AR0806 with RXD instruction together.
But like I said, I cannot understand why it stops running after the PC shuts down and restart.
And then it is weird but if I unplug and plug the PLC power back then it starts working again.
So the bottom line it that until I never turn off the PC, the PLC receives the "OK" from the COM port and keeps running.
Thank you again.
 
Last edited:
Do you have the number of bytes to receive set correctly?
This can cause a problem if is is not correct.

Also the control word can cause a problem if not set properly.

Review those values to make sure they are set correctly for your application.
 
Last edited:
Yes, as I edited above again, RXD is set to receive 2 bytes because the PC sends 2 bytes of "OK" to the PLC through the RS-232C COM port.
And the Control Word is set to #0000 by default.

Thanks
 
Last edited:
Pretty sure the number of bytes is the problem.

You forgot about the start and end codes. Those are also part of the number of bytes received.

Check the manual, there is an AR address that indicates the number of bytes recieved on the port. You can use that address in the instruction.

Hope this helps.
 
Thanks but when I checked it in the W353 manual it says "Start and end codes are not included when the number of bytes to be transmitted is specified."

And also it says "AR09 which stores the number of byted received does not include the start code and end code."

So if it is true then I am lost again and I don't know what else can be the problem!
Thanks.
 
Just try using AR9 for the number of bytes received portion of the instruction.

Another trick, just to check things out, put a normally open 253.14 (always off bit) in the enable line of the RXD. Send your data, then take a look at the value in AR9. This will verify the number of bytes being received.

Hope this will help.
 

Similar Topics

hey anyone, I'm a student from Indonesia.. I have a project, It is about how to send and receive data by serial communication between PLC Omron...
Replies
2
Views
2,095
Hi All, need a little help in here.I never program PLC before but at the moment, I am task to backup PLC program on our machines which is using...
Replies
2
Views
5,648
Dear Experts Help me to upload plc program from Omron PLC CPM2A to laptop. CPM2A name is not in the device type setting list of...
Replies
1
Views
3,155
Hi, I have a CPM2A PLC setup for a machine. There is an rotary incremental encoder connected to the PLC at input 0.00 (A+ terminal of encoder) and...
Replies
1
Views
4,075
Dear PLC Experts, I am trying to go online with Omron Sysmac CPM2A PLC with CX-Programmer V 6.0 on Windows Vista Operating System. It gives...
Replies
7
Views
9,663
Back
Top Bottom