You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old April 12th, 2007, 10:02 AM   #1
vislab
Member
United States

vislab is offline
 
vislab's Avatar
 
Join Date: Feb 2005
Posts: 20
Question OMRON CPM2A PLC and RS-232C to the PC

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
sunlee.sti@gmail.com

Last edited by vislab; April 12th, 2007 at 10:04 AM.
  Reply With Quote
Old April 12th, 2007, 10:48 AM   #2
gtsuport
Member
United States

gtsuport is offline
 
Join Date: Feb 2005
Location: Grand Rapids, MI
Posts: 1,018
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.
  Reply With Quote
Old April 12th, 2007, 12:31 PM   #3
vislab
Member
United States

vislab is offline
 
vislab's Avatar
 
Join Date: Feb 2005
Posts: 20
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 by vislab; April 12th, 2007 at 12:34 PM.
  Reply With Quote
Old April 12th, 2007, 12:34 PM   #4
gtsuport
Member
United States

gtsuport is offline
 
Join Date: Feb 2005
Location: Grand Rapids, MI
Posts: 1,018
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 by gtsuport; April 12th, 2007 at 12:36 PM.
  Reply With Quote
Old April 12th, 2007, 12:37 PM   #5
vislab
Member
United States

vislab is offline
 
vislab's Avatar
 
Join Date: Feb 2005
Posts: 20
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 by vislab; April 12th, 2007 at 12:39 PM.
  Reply With Quote
Old April 12th, 2007, 12:46 PM   #6
gtsuport
Member
United States

gtsuport is offline
 
Join Date: Feb 2005
Location: Grand Rapids, MI
Posts: 1,018
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.
  Reply With Quote
Old April 12th, 2007, 12:57 PM   #7
vislab
Member
United States

vislab is offline
 
vislab's Avatar
 
Join Date: Feb 2005
Posts: 20
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.
  Reply With Quote
Old April 12th, 2007, 01:02 PM   #8
gtsuport
Member
United States

gtsuport is offline
 
Join Date: Feb 2005
Location: Grand Rapids, MI
Posts: 1,018
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.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Allen Bradley Guard PLC and RS Logix 5000 Redland Brick LIVE PLC Questions And Answers 2 May 9th, 2006 06:00 PM
Omron CPM2a communication serial vs USB mordred LIVE PLC Questions And Answers 4 April 5th, 2005 07:15 AM
Omron RS 232 Ports guest LIVE PLC Questions And Answers 1 October 20th, 2004 09:19 PM
cable between old PLC console and pc VPSYSTEMS LIVE PLC Questions And Answers 0 July 17th, 2003 06:09 AM
Interfaceing PC to PLC UK Homer LIVE PLC Questions And Answers 12 April 25th, 2003 06:31 AM


All times are GMT -5. The time now is 10:02 AM.


.