Redlion_Rs232_Value_updation

Hello guys,
My Hmi is not at all updating the values.I have changed my code accordingly.I am trying to send two different values continuously for the same String,but still it was not updating.It is just executing the program once though I kept my program in the while(1) infinite loop.Any one suggest something.

I tend to find RLC stuff does not like constant while loops. I would take the while loop out of your program, leave things like if/else statements and then on the page you want to use the program right click the mouse to get the properties up on the Actions tab under "on tick" put your program here.

That will the run the program once per second.
 
I tend to find RLC stuff does not like constant while loops. I would take the while loop out of your program, leave things like if/else statements and then on the page you want to use the program right click the mouse to get the properties up on the Actions tab under "on tick" put your program here.

That will the run the program once per second.

Can I get much those at much faster rate as while loop itself not existing
 
Hello guys,
My Hmi is not at all updating the values.I have changed my code accordingly.I am trying to send two different values continuously for the same String,but still it was not updating.It is just executing the program once though I kept my program in the while(1) infinite loop.Any one suggest something.


Your code should update once each time the On Update event of the Raw Port fires. There won't be new data to display until that happens, so it doesn't do any good to continue to run the code that parses the string that is read by the program that you call in the On Update event. In fact, if you keep running the code, the string is probably empty and the code doesn't find anything new to put into your Integer tags.

I would suggest you back up and think what is supposed to be happening starting with how often the device in the field puts its string on the wire. After that, think about what the DSP (I can't remember what Crimson 3.0 device you are using) is supposed to do with the string. I suggested that in the On Update event you read the whole string using Port Input and then parse the whole string into individual Integers. Then you should simply wait for another On Update event. Whether it comes in 1 second or 60 seconds, that is up to the field device that generates the string. The Integer Tags will retain the value until the next time your code changes it. If it doesn't, you are doing something wrong that overwrites it.

I have done what you are trying to do several times (with other equipment) and it works very well, but I have found that most people don't back up to look at the big picture and keep making the same mistake over and over.

Your code should be simple and called only as often as it needs to be called (when there is new data). Don't overcomplicate it - you only add opportunities to make mistakes.
 
Thanks to every one who supported me especially @DK MUK and @JHarbin and It actually worked for me as per the suggestion given by DK Mul and I kept my code on the page action where I want to see my values.It actually worked well But it is updating at the rate of 1 sec as told by DK Mul. Can any one suggest how to make it faster ?? Thank U
 
Last edited:
Thanks to every one who supported me especially DK MUL and JHarbin and It actually worked for me as per the suggestion given by DK Mul and I kept my code on the page action where I want to see my values It actually worked well But it is updating at the rate of ! sec as told by DK Mul. Can any one suggest how to make it faster ?? Thank U

If you haven't done it already you can try running your program under the port on the communications pane. Under the "Driver Settings" option put your program to run in there. This will then run every time the port sees new info (I think someone else mentioned this earlier too).

I don't know what the limit is on update rate though, I suppose it depends on your baud rate.
 
If you haven't done it already you can try running your program under the port on the communications pane. Under the "Driver Settings" option put your program to run in there. This will then run every time the port sees new info (I think someone else mentioned this earlier too).

I don't know what the limit is on update rate though, I suppose it depends on your baud rate.

I have done that before , but not working may be bcoz of my page which is not at first
 
I have done that before , but not working may be bcoz of my page which is not at first

If you are updating values at the On Update event, then there is no way to update them faster without doing something to the Device you are reading from to make it *send* data faster. Changing your page configuration won't do anything.

Your device may not be updating but every 15 to 60 seconds.
 
If you are updating values at the On Update event, then there is no way to update them faster without doing something to the Device you are reading from to make it *send* data faster. Changing your page configuration won't do anything.

Your device may not be updating but every 15 to 60 seconds.

When I kept my code ' on update ' It's sure that it's executing the code only once and stopping after the end of code.And my device(DSP) is sending very fast that I am finding on the TeraTerm displaying very fast which is not happening on the Redlion
 
When I kept my code ' on update ' It's sure that it's executing the code only once and stopping after the end of code.And my device(DSP) is sending very fast that I am finding on the TeraTerm displaying very fast which is not happening on the Redlion

What is the field device that is sending the data? Can you repost your current Crimson 3.0 configuration?
 
What is the field device that is sending the data? Can you repost your current Crimson 3.0 configuration?

I am using DSP processor F28335 Device to send the data . Here I am posting my file.Here I given my code for 'page action ' as well as " On Update " for Port setting. I am sending my values as !340.5;342.3;7.5;8.5@ and !450.2;452.9 ;8.9;7.6@ repeatedly
ThanX for your response
 
Last edited:
I am using DSP processor F28335 Device to send the data . Here I am posting my file.Here I given my code for 'page action ' as well as " On Update " for Port setting. ThanX for your response

Get rid of the On Tick Actions - they are useless!

I posted earlier that you need to back up and think about what is happening in your system but I'll try to explain it a little further.

If you are truly supposed to be using Raw Serial Ports, then whenever the Port sees a change (the On Update Event) it will run your Program. That means what every time the data changes it will be updated on the screen.

Putting the Program in the On Tick action will simply re-read the data (at best) but probably overwrite the good data with bad data. The screens will automatically populate with the latest Tag Data on a regular basis - faster than once per second usually. However if the data isn't being updated faster than that, you won't see it.

Please remove the On Tick actions and see what happens. If it doesn't do what you want, then we can see what to do next.

Keep in mind that at 9600 Baud, your data won't be updating all that fast anyway. But beyond that, the device may not be seeing any need to send data very quickly. In your situation, the G306 is at the mercy of the field device. It isn't asking for data, it is waiting for the device to send data. That is why you chose Slave Mode.

Here is my example of the event that runs on the On Update Event of a Raw Serial Port (Slave Mode). ConvertAscii() is another program that actually parses the data from the Tag named ASCII_HOLD_TAG. That part won't necessarily help you because of what my strRawData is, but I do Mid and Left, and TextToInt as necessary in ConvertAscii()

Finally, I would suggest that you put your Variable named Array into a String Tag like I do below, but then put the String Tag on one of your pages so you can see if it is updating. As it updates, you will get an understanding of how often your device is writing to the G306.

Program named ReadAscii()

cstring strRawData;


strRawData := PortInput(8,0, 13, 1000, 30);

if (Len(strRawData) <= 1) return;

ASCII_Hold_Tag := strRawData;

ConvertAscii();
 
Looking at your program I don't understand what this is supposed to be doing

while(PortRead(3, 0) > -1);

If you read the Crimson 3 reference manual the second value after the , is the time to wait in milliseconds, you have zero wait time. The C3 manual says...

Setting period to zero will result in any queued data being returned, but will prevent Crimson from waiting for data to arrive if none is available.

I would expect that the update time of your field device is not fast enough to use the 0 parameter.

Personally I would remove this while statement all together as it serves no real purpose. Especially as this while loop doesn't actually do anything if the condition is met.

I would start by changing your program to

Array=PortInput(2,'!','@',100000,0);

if(Array != "")
{
power.Voltage_Vrb=Left(Array,5);
power.Voltage_Vyb=Mid(Array,Find(Array,';',0)+1,5);
power.Current_Iy=Mid(Array,Find(Array,';',1)+1,3);
power.Current_Ib=Mid(Array,Find(Array,';',2)+1,3);
Power_flow.Voltage_Vr=TextToFloat(Left(Array,5));
Power_flow.Voltage_Vy=TextToFloat(Mid(Array,Find(Array,';',0)+1,5));
Power_flow.Current_Ir=TextToFloat(Mid(Array,Find(Array,';',1)+1,5));
Power_flow.Current_Iy=TextToFloat(Mid(Array,Find(Array,';',2)+1,5));
}

See if this works with the "On update" command.
 
Looking at your program I don't understand what this is supposed to be doing

while(PortRead(3, 0) > -1);

If you read the Crimson 3 reference manual the second value after the , is the time to wait in milliseconds, you have zero wait time. The C3 manual says...

Setting period to zero will result in any queued data being returned, but will prevent Crimson from waiting for data to arrive if none is available.

I would expect that the update time of your field device is not fast enough to use the 0 parameter.

Personally I would remove this while statement all together as it serves no real purpose. Especially as this while loop doesn't actually do anything if the condition is met.

I would start by changing your program to

Array=PortInput(2,'!','@',100000,0);

if(Array != "")
{
power.Voltage_Vrb=Left(Array,5);
power.Voltage_Vyb=Mid(Array,Find(Array,';',0)+1,5);
power.Current_Iy=Mid(Array,Find(Array,';',1)+1,3);
power.Current_Ib=Mid(Array,Find(Array,';',2)+1,3);
Power_flow.Voltage_Vr=TextToFloat(Left(Array,5));
Power_flow.Voltage_Vy=TextToFloat(Mid(Array,Find(Array,';',0)+1,5));
Power_flow.Current_Ir=TextToFloat(Mid(Array,Find(Array,';',1)+1,5));
Power_flow.Current_Iy=TextToFloat(Mid(Array,Find(Array,';',2)+1,5));
}

See if this works with the "On update" command.

The while(PortRead...) statement is a trick I saw in tech support. It clears out the serial buffer so you don't get any garbage characters during the PortInput.Find the url you will find that
http://www.plctalk.net/qanda/showthread.php?t=77007
ThanX for the reply and I will see whether it will work or not
 
Looking at your program I don't understand what this is supposed to be doing

while(PortRead(3, 0) > -1);

If you read the Crimson 3 reference manual the second value after the , is the time to wait in milliseconds, you have zero wait time. The C3 manual says...

Setting period to zero will result in any queued data being returned, but will prevent Crimson from waiting for data to arrive if none is available.

I would expect that the update time of your field device is not fast enough to use the 0 parameter.

Personally I would remove this while statement all together as it serves no real purpose. Especially as this while loop doesn't actually do anything if the condition is met.

I would start by changing your program to

Array=PortInput(2,'!','@',100000,0);

if(Array != "")
{
power.Voltage_Vrb=Left(Array,5);
power.Voltage_Vyb=Mid(Array,Find(Array,';',0)+1,5);
power.Current_Iy=Mid(Array,Find(Array,';',1)+1,3);
power.Current_Ib=Mid(Array,Find(Array,';',2)+1,3);
Power_flow.Voltage_Vr=TextToFloat(Left(Array,5));
Power_flow.Voltage_Vy=TextToFloat(Mid(Array,Find(Array,';',0)+1,5));
Power_flow.Current_Ir=TextToFloat(Mid(Array,Find(Array,';',1)+1,5));
Power_flow.Current_Iy=TextToFloat(Mid(Array,Find(Array,';',2)+1,5));
}

See if this works with the "On update" command.

I'm about to give up on him - you can lead a horse to water...
 
Looking at your program I don't understand what this is supposed to be doing

while(PortRead(3, 0) > -1);

If you read the Crimson 3 reference manual the second value after the , is the time to wait in milliseconds, you have zero wait time. The C3 manual says...

Setting period to zero will result in any queued data being returned, but will prevent Crimson from waiting for data to arrive if none is available.

I would expect that the update time of your field device is not fast enough to use the 0 parameter.

Personally I would remove this while statement all together as it serves no real purpose. Especially as this while loop doesn't actually do anything if the condition is met.

I would start by changing your program to

Array=PortInput(2,'!','@',100000,0);

if(Array != "")
{
power.Voltage_Vrb=Left(Array,5);
power.Voltage_Vyb=Mid(Array,Find(Array,';',0)+1,5);
power.Current_Iy=Mid(Array,Find(Array,';',1)+1,3);
power.Current_Ib=Mid(Array,Find(Array,';',2)+1,3);
Power_flow.Voltage_Vr=TextToFloat(Left(Array,5));
Power_flow.Voltage_Vy=TextToFloat(Mid(Array,Find(Array,';',0)+1,5));
Power_flow.Current_Ir=TextToFloat(Mid(Array,Find(Array,';',1)+1,5));
Power_flow.Current_Iy=TextToFloat(Mid(Array,Find(Array,';',2)+1,5));
}

See if this works with the "On update" command.

Yes,It workrd but it was updating only Numeric tags not String Tags where lines having TextToFloat corresponds to Numeric tags rest are String Tags
 

Similar Topics

Hello, I man trying to use a redlion DA10 converter to read data from a Bronkhorst mini cori flow meter over rs232. I cant seem to get the...
Replies
7
Views
1,547
I want my HMI G07S sending data to both serial port RS232 and RS422 at same time, is it possible? if not, how can I switch the port...
Replies
3
Views
1,882
I hope someone can answer this question quickly, as I have a colleague in Kenya onsite, trying to get the following to work, with no success...
Replies
6
Views
4,905
Hi, I have a strange problem concerning communication between Redlion G306 HMI & Allen-Bradley SLC 5/03 (1747-L531). What it is that I have...
Replies
10
Views
4,983
Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
4
Views
143
Back
Top Bottom