Sign in to follow this  
Followers 0
pszczepan

electronic scale ith RS232

54 posts in this topic

Hi ! Still nothing ! I changed the TXD Rung and when I switch 200.01 ON TXD instruction should be done once and I guess it is, because 200.05 is set up at the same time. I switch off the power and PLC is reseted. PLC RS232 switch I set to OFF - correct? What about RS232 errors when I disconnect cable? HOST LINK PORT setting has strt code - what should I have there? Any other help???? Pawe?

Share this post


Link to post
Share on other sites
Yes the switch next to the RS232 port should be turned OFF to use the "Settings" parameters. Disconnecting the cable really should not create an error. I would have to review what conditions cause the Error bit to turn on. Try this. Can you set up a test circuit for the @TXD instruction using only a plc input. Then disconnect the computer from the plc. Now watch the COMM led on the plc and turn on the input. You should see the COMM led flash. This would tell us that the plc is sending data to the port and the port is transmitting. Another option would be to connect a computer running Hyperterminal to the RS232 port, initiate the TXD instruction and see what data is being sent. Hope this helps.

Share this post


Link to post
Share on other sites
I changed Start Code in host link settings to Disable and I have communication with scale. I made another small step - for now I do not have question. Maybe one. When AR 8.04 is switching ON. As I wrote even I disconnect RS232 Cable I do not get this error . Thanks Pawel

Share this post


Link to post
Share on other sites
Hi there, I'm developping a similar application, with a Omron CP1L (with 2 serial extensions) linked to a KERN 440 scale via RS232. I'm using serial 1 for a NS5 screen and serial 2 for the scale. Here are the specifications of the scale : RS232 parameters : 9600bauds, 8 bits, 1 stop, parity none The weighing values are sent automatically and continuously, no matter if the value is stable or unstable. Format for stable values for weight 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 B* B B B B B B B B 0 . 0 B g B B CR LF Format in case of fault 1 2 3 4 5 6 7 8 9 10 11 12 13 14 B B B B B B B E r r o r CR LF Format for unstable values for weight 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 B* B B B B B B B B 0 . 0 B CR LF SYMBOLS: B* = blank or M B / 0 /. = blank / weight values / decimal dot, depending on the measuring Value g = weight unit / unit / % E, o, r = ASCII code or “E, o, r” CR = carriage return symbol LF = line feed symbol I guess I'll have to extract the significant characters in order to convert this string to a numeral value (without the "g" and "."). My problem is that, with the PLC set to the right parameters, I can't get any string from the scale. Communication with the NS5 is OK. I have used RXD instruction, with "#0200" set as control data. I don't have to use TXD since the scale is set for continuous data transmission. I have already used OMRON PLCs communicating with NS, but never used TXD / RXD instructions. Could you tell me if I have forgotten anything, or explain me how I could check that the scale is transmitting ? Thanks in advance.

Share this post


Link to post
Share on other sites
Hi ! What pin out did you use for RS232 port with scale. Are you sure that it is correct? I had pinout for connecting scale to PC and it was different than pinout for RS232 in PLC. Look at few first posts. You see difference. You wrote about values which scale transferring. How do you know - from manual or you used some RS232 monitor.

Share this post


Link to post
Share on other sites
Bonjour Simon Does the LED light? Connect the scale to your PC with Hyperterminal or Windmill (excellent) and confirm that the scale is sending data. Pp

Share this post


Link to post
Share on other sites
Hi, The pinout I use was indicated in the scale's manual. Here it is : Pin 2 : TXD Pin 3 : RXD Pin5 : Signal ground I'll try with hyperterminal or windmill if I can get the appropriate cable. Which light is supposed to be lit ? Is it the one on the extension serial board ? Thanks for your help !

Share this post


Link to post
Share on other sites
I think the cable for a PC will be pin-pin. Anyone confirm this? When connected to the CIF, the LED here should light when receiving data. Pp

Share this post


Link to post
Share on other sites
OK I'll try this. By the way, what do you mean by "CIF" ?

Share this post


Link to post
Share on other sites
Give this a try. Scale: ----------------------------------PLC: 2 (RXD) ------------------------------- 2 (TXD) 3 (TXD) ------------------------------- 3 (RxD) 5 (GND) ------------------------------ 9 (GND) CIF it is name of RS232 board. It has a Led and when data is transmitted it is flashing

Share this post


Link to post
Share on other sites
Hi, I've tried with Hyperterminal and Windmill, I can't get any characters. Here's the pinout of the cable I used : Scale PC 2 : TXD --- 3 : RXD 3 : RXD --- 2 : TXD 5 : GND --- 5 : GND Should I connect other pins ? This thing is quite annoying Before doing anything else I would like to check that the scale is OK (It's brand new so it should be) and that the settings are OK too...

Share this post


Link to post
Share on other sites
On a PC, 2 is RXD and 3 is TXD Swap 2 and 3 Bonne Chance! Pp

Share this post


Link to post
Share on other sites
I swapped 2 & 3 and it works. I'm going to check the cable between scale and PLC. Thanks for your help Simon

Share this post


Link to post
Share on other sites
Okay, so, I also swapped 2 & 3 on my cable between PLC and scale, and I get the LED lighting. BUT... I still can't read any value in the variable I specified in the RXD instruction. Only " is indicated. - Do you think it could be a parameter error ? - What size should I specify for this incoming string ? Do I have to include CR and LF in this string size ? Thanks for your help Simon Edited by Simon27

Share this post


Link to post
Share on other sites
What monitor did you use - if windmill - attach screenshot of data which you received from scale. It gives us clue how many DM address you need to read data. Then I attach some sample program how to read data from PLC.

Share this post


Link to post
Share on other sites
See the screenshot attached. Bytes 1 to 3 (non visible) are blank. Thanks Simon

Share this post


Link to post
Share on other sites
In my sample I read scale value every 0.2 second. To read value I have to send "SI" to the scale which is in D100. Read value goes to address D140-D148 - It is my case. In your case it is enough to catch also 16 bytes and if you transfer it to address from D140. Just look what values you have in D144, D145, D146. The value which you have in windmill you should have in these PLC address in HEX.

Share this post


Link to post
Share on other sites
Thanks Pawel, By reading the CP1L documentation, I've realised that only port #1 can use the non-protocol mode which is necessary in this case. I've swapped port #1 and 2 and now I get value ' 0.' It doesn't change when I change the weight on the scale. I guess it's not far from working, maybe the key is in the parameters of the RXD instruction. So I just have a question about the control word. I've seen that you use the value #0, but It seemed to me that you have to specify the number of the serial port you are using (#0100 in my case). Am I wrong ? By the way, what is the data type of your receive word (D140) ? Thanks, Simon

Share this post


Link to post
Share on other sites
Yes you are right - you need control word #100. In my case D140 it is first word with read value. Each address from D140 has 2 bytes received from Scale in HEX. If you set it to D140 also you should get values from scale like this D144=#2030 D145=#2E30, D146=#3220. (example from your screenshot) Look at screenshot from windmill and compare byte's number, characters and Hex values Edited by pszczepan

Share this post


Link to post
Share on other sites
Hello Simon What is the extra "." (2D) at byte 6? Strange! I agree - you need a control word of #0100 What Pawel has said is correct. This is how I would do it... We may have to remove the first few bytes (the extra ".") if you want to convert the string to a REAL number using the FVAL instruction. Cordialement, Pp Edited by ParaffinPower

Share this post


Link to post
Share on other sites
In byte 6 he has "-" (2D). Probably Simon didn't tare the scale and he had weight -0.02 g

Share this post


Link to post
Share on other sites
Oh yes! My old eyes can't tell the difference!!

Share this post


Link to post
Share on other sites
Hi guys, Just a few questions : - are A392.14 and A394 standard variables ? I have found them in the CP1 programming manual but they were not specified as standard variables in my program. - I have modified my program exactly the way ParaffinPower showed, but nothing happens. It seems that A392.14 never turns On Did I miss something ? I guess I'll have to remove lots of characters (including the "-" ) to convert the value, but I'll look at it afterwards. Edit : In fact, having a look at A392.15 (Overflow), I've realised that, when I restar port#1 (bit A526.01), A392.14 turns on and A392.15 also turns on imediately. From the programming manual : Overflow bit : ON when a data overflow occurred during reception through a serial port in no-protocol mode. When the number of bytes was specified: ON when more data is received after the reception was completed but before RXD(235) was executed. When the end code was specified: ON when more data is received after the end code was received but before RXD(235) was executed. ON when 257 bytes are received before the end code. I think it can be because the scale sends data constantly (data transmitted after the end code), do you agree ? In this case I could use the same principle as Pawel's application (send command - read response). I wish I could avoid this, but for the moment I can't see any other solution. Edited by Simon27

Share this post


Link to post
Share on other sites
Hi Simon I think you are right - there is no delay between the end of 1 message and the start of the next. Can you change the scale to "Send request - Read Response"? Let us know how it goes. Pp

Share this post


Link to post
Share on other sites
Hi there, Sorry for my absence, I was away for a while and I'm just starting to work again on this application. I have set the scale to "Send request - Read Response" mode. It needs an "s" (+ CR and LF) as send request. I've done the same programme as Pawel's, but it still doesn't work. I've attached the com port settings, and a view of the program screen. As it didn't work when I set "CR+LF" as end characters, I've stored value #00730D0A (s + CR + LF) in variable D150 that I send. Do you think I'm on the right way ? I've already programmed OMRON PLCs, but I'm not skilled with serial data transmission, so maybe I'm totally misunderstanding... Or is this application very complicated ? Thanks for your help Simon

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
Sign in to follow this  
Followers 0