Gnomes Posted September 6, 2005 Report Posted September 6, 2005 Hi, I'm trying to experiment with the RS-232 port and some serial communications. I'm using a versamax plc with a cpu001 and machine edition software. What I would like to be able to do is when a certain input is set, a certain output response is sent out through the rs232 serial port. I'm not sure what steps are needed to accomplish this. I've messed around with trying to use COMREQ commands, I've tried to set up a few data blocks (One for serial I/O, Initialize port, write bytes) which seem to be a little tricky for me to create and keep track of (not to overwrite any or something like that). What I've tried to do to see if my program works is after the program is downloaded to the PLC and the outputs are enabled, I go offline from the PLC and then open up a hyperterminal window, which uses the same cable and port that was just used to program the PLC, to see if my message appears when the input is turned on. So far I haven't been able to get any type of response. I was wondering if anyone has ideas or suggestions for me. Thanks for your help. Quote
Guest Guest Posted September 6, 2005 Report Posted September 6, 2005 You are on the right track. Here are a couple suggestions. 1. In the CPU configuration, setup one of the ports as 'Serial I/O' I recommend Port 1 which is RS-232 for this. You will not need the Comm_Req to 'Initialize' the port then. Then use Port 2 (RS-485) for programming. 2. Double check your Data Block for the Write command, make sure that you have the correct data offsets as some start with '0' and others with '1'. Quote
Gnomes Posted September 19, 2005 Author Report Posted September 19, 2005 It's been awhile but I've finally have some more time to come back to this project. I've still been trying to use the same port to accomplish both tasks (write a program to it, then use it to send an output in response to an input being sent) only because we currently do not have any converter or cable to use the rs485 port. I went through my program again and I was able to pick out one error when setting up the data block for the serial i/o comm_req. Is there a particular order for using these comm_reqs? Right now the program follows the format of setting up data block then using the comm_req starting with the serial i/0 protocol first followed by initialize port and then finally write bytes. I've also come across this write port control command and I'm not sure what this means and if it's something I should be trying to use or not. Someone mentioned something about checking data offsets. I'm having some difficulty with doing this. I can't seem to find out what offsets, if any, I need to check or where to look. The only one I think I see is for the status pointer offset but other then that I'm not sure what else. And finally after I try to run my program two of my outputs turn on supposedly indicating that my comm_reqs didn't work. When I get back connected online with the plc I look in the register memory table and the values where the status word is supposedly going I get several different numbers. In the spot for the serial i/0 protocol I get a 1 (does that mean that it worked correctly?). Then for the initialize part I get a 524 and the write bytes spot a 0, which I'm not sure what errors these may be referring to. Anyways thanks for any help and in the meantime I will continue to beat my head against the desk!! Quote
Guest Guest Posted September 21, 2005 Report Posted September 21, 2005 Why do you not use the 485 box that you used to upload the firmware? Quote
Gnomes Posted September 21, 2005 Author Report Posted September 21, 2005 That PLC was shipped to me from an outstate plant with the box and so when we changed the program on the plc and sent it back to the plant the box went with it. So that leaves me right back at the beginning! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.