Redlion_Rs232_Value_updation

bjrajendra

Member
Join Date
Jun 2014
Location
*******
Posts
36
Hi,
I am using Redlion g306A for displaying the values for the tag through rs232 port where I am sending different values from my board.But my values are not updating at the same place (tag).Can any one suggest how to overcome this Problem.

ThanX
 
Hi,
I am using Redlion g306A for displaying the values for the tag through rs232 port where I am sending different values from my board.But my values are not updating at the same place (tag).Can any one suggest how to overcome this Problem.

ThanX

You have not given us enough information to help, but if you want to post your Crimson file we can take a look at what you are doing. Maybe then we can help.
 
Here I am attaching my code and power.Voltage_Vrb is my string tag and Power_flow.Voltage_Vr is my integer tag and in the display page I kept these tags and I am receiving only first value and later no update was happening
 
Here I am attaching my code and power.Voltage_Vrb is my string tag and Power_flow.Voltage_Vr is my integer tag and in the display page I kept these tags and I am receiving only first value and later no update was happening

If you will post your Crimson file, I'll take a look at it, but this doesn't tell me what I need to know to help.
 
Here I am attaching the .zip file. And ThanX for showing interest in helping me

On first glance, it appears that all your values are available in a single string. Why don't you read the whole string at once, put it into a string variable, and then write logic to parse it into the various pieces. You appear to have enough information regarding start and stop characters to do this.

Then you can do your TextToInt(). This will allow you to read all of your values each time they are updated rather than every 6th PortRead.
 
On first glance, it appears that all your values are available in a single string. Why don't you read the whole string at once, put it into a string variable, and then write logic to parse it into the various pieces. You appear to have enough information regarding start and stop characters to do this.

Then you can do your TextToInt(). This will allow you to read all of your values each time they are updated rather than every 6th PortRead.

I am trying to write the code per your suggestion and the say Array=PortInput(2,'!','@',100000,55); line makes a complete string (called Array) and now if I want to make it into pieces how can I assign this Array(of string type variable) directly to my string tag called power.Voltage_Vrb.If I use power.Voltage_Vrb=Array; it was showing error as lhs of operator = should be writable.If I create a new string Voltage_Vrb(say) then also It was showing the same can you help n this.
 
Last edited:
This is an example of what I have done in the past. All this program does is look at a raw RS232 input coming from a GPS device and assigns the values into tags. By the sounds of the post that is what you need to do. The program is quite long so I have only put in part of it.

cstring String;
cstring GPSHeader,NSInd,EWInd;
int Lat,LatMin,LatSec,Long,LongMin,LongSec,nos;


//initialize mydata with data string
String = PortInput(1, 0, '\r', 2000, 0); //rs232
//PortInput(PORT, START, END, TIMEOUT, LENGTH)

if(String != "")
{

//Sentence Identifier (Value &GPGGA)
GPSHeader := (Mid(GPS.rawString,1,Find(GPS.rawString,',',0)-1)); //find the value before first(1st) occurrence of ,
GPS.header := GPSHeader; // stores string header in tag GPS.header as string value

//Latitude (Value ddmm.mmmm)
Lat := TextToInt (Mid(GPS.rawString, Find(GPS.rawString, ',', +1) +1,2),10); //find the value after second(2nd) occurrence of , in the 232 string.
GPS.Lat := Lat;// Latitude postion in decimal stored in GPS.Lat as int data
LatMin := TextToInt (Mid(GPS.rawString, Find(GPS.rawString, '.', +0) -2,2),10); //find the value after second(2nd) occurrence of . in the 232 string.
GPS.LatMin := LatMin;// Latitude postion in decimal stored in GPS.LatMin as int data
 
Last edited:
This is an example of what I have done in the past. All this program does is look at a raw RS232 input coming from a GPS device and assigns the values into tags. By the sounds of the post that is what you need to do. The program is quite long so I have only put in part of it.

cstring String;
cstring GPSHeader,NSInd,EWInd;
int Lat,LatMin,LatSec,Long,LongMin,LongSec,nos;


//initialize mydata with data string
String = PortInput(1, 0, '\r', 2000, 0); //rs232
//PortInput(PORT, START, END, TIMEOUT, LENGTH)

if(String != "")
{

//Sentence Identifier (Value &GPGGA)
GPSHeader := (Mid(GPS.rawString,1,Find(GPS.rawString,',',0)-1)); //find the value before first(1st) occurrence of ,
GPS.header := GPSHeader; // stores string header in tag GPS.header as string value

//Latitude (Value ddmm.mmmm)
Lat := TextToInt (Mid(GPS.rawString, Find(GPS.rawString, ',', +1) +1,2),10); //find the value after second(2nd) occurrence of , in the 232 string.
GPS.Lat := Lat;// Latitude postion in decimal stored in GPS.Lat as int data
LatMin := TextToInt (Mid(GPS.rawString, Find(GPS.rawString, '.', +0) -2,2),10); //find the value after second(2nd) occurrence of . in the 232 string.
GPS.LatMin := LatMin;// Latitude postion in decimal stored in GPS.LatMin as int data

How you got the GPS.rawString , did you use PortInput for that
 
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.
 

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,542
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,869
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,904
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,979
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
121
Back
Top Bottom