4 posts in this topic

Hello everyone,

i am making a weight batching system , my system consists of 9 tanks each tank have a specific raw material , the user should be able to add a formula through scada system so he will be able to specify each weight of each ingredient to add to the formula.

i have managed a connection between my weight indicator (pt650d) and my plc (fx3g) through fx3g232bd module (RS232 communication) , the weight indicator send data in ASCII to plc that we can show on the scada system . 

so how can i change the ASCII numbers that come from the weight indicator to Decimal number without changing the value so i can control a barrel that will add raw material from the tank to the scale untill it reaches what the user specify in the scada ?? 

 

Share this post


Link to post
Share on other sites

Not done much with the 3G, but if I remember correctly it does not have much in the way of string handling. Normally you would use an Fx3U to do this with the VAL function. You could do it the long way and convert the ASCII by your own code. If it’s coming into the PLC serially then depending on how the comms is set up you may find the data is not always at the same location in the buffer every time (so you have to search for it before you convert it). I have done this before mainly for reading load cell values coming in serially. If you went down this path I would recommend that you set up the PLC so that each ASCII character is encoded in one word (turn M8161 on), as it makes comparing the ASCII characters so much easier.

How is the number formatted in the string?

What software are you using?

Share this post


Link to post
Share on other sites

Posted (edited)

i have already succeeded to show the reading of the weight indicator on the scada through the plc as you can see in the attached file.

i now need to control D405 D406 that a barrel will start to flow material inside the weight scale untill it reaches a spedicfied value .... this value is entered by the operator through the scada the value type is unsigned dec 32 bit becuase i need to control weighs in kilograms and fraction of grams for example : 

operator will enter 963.36 in D600 and the barrel should start , the plc should compare the value of (D600) needed by the operator to the change of value by the barrel(D405+D406) and when it reaches the value needed by the operator it should stop.

but i had a problem that the value of the weight indicator is sent in ASCII and the value entered by the operator is in unsigned dec 32 bit . so how can i change the ASCII number to unsigned dec 32 bit without changed the value.

is there any function that will convert the ASCII numbers into decimal numbers without changing its value ?? as i know that they are not even related 

0 in ascii is 48 in decimal

1 in ascii is 49 in decimal

.

.

.

9 in ascii is 57 in decimal .

or should i make my own formula to change that ?? the fx3g will do that or no ??

1.png

 

3.png

2.png

Edited by Tarek_Shawki

Share this post


Link to post
Share on other sites

Hello Tarek_Shawki,

     I don't have my GX Works open.  Does the FX3 have the EVAL(P)/DEVAL(P) instructions?  You could use those to convert the ASCII value to a FLOAT (probably store the result in a different register than the source value), then convert the FLOAT to an unsigned DWORD.

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