Red Lion DSPSX Raw Serial Port

It didn't worked. I can see the TextToInt value on Virtual HMI but not a string from device. even tried putty to feed the DSP. Had a luck to get the TextToInt but no string at all.

Help is appreciated.

Cheers
 
My guess is that you're overwriting the string after. Check for a valid input before moving the readline to your tag string.

You can do something like

if (input != "") STRING2 := input; //Assigning String to STRING2

or if (len(input) > 2) string2 = input
 
Thanks John,

It works perfect now..

The next question is how can I extract the specific information from received string and set the alarm accordingly.

For example..DSP unit needs to be able to receive a signal from the on board Navigational system (which is working now)and then determine the signal strength from the string information supplied.
The string in the form
$GPGGA;144058.00;5034.1905051;N;00226.1677476;W;2;08;1.1;24.8934;M;48.7867;M;14.6;1006

In this string the 2 (it could be 0,1) is the signal quality of the received signal. If I receive 0 instead of 1 & 2 then I want some sort of alarm indication to show signal quality has degraded.

Thanks
Amit
 
The answer depends on the form of your string data.

If you know that the digit of interest is always the 48th character in the string (numbered starting at 0) then you could use the Mid function as so:

TextToInt(Mid(MyString, 48, 1), 10)

to extract the single character and convert it to an integer.

If the string length is not constant but you know that the digit occurs directly after the 6th occurrence of a semicolon, then you could combine Find with Mid:

TextToInt(Mid(MyString, Find(MyString, ';', 5) + 1, 1), 10)


Once you have the character in an integer tag, it's easy to trigger actions from it. One way would be to go to the Triggers tab for the tag and set a Data Match trigger with a value of 0, to activate a specific action. Another way would be to create a formula bit tag with the expression "IntegerTag == 0" which would cause the tag to be true when the integer is 0, and false otherwise.
 
Thanks John,

In my case length of the string is not fixed but the digit for signal quality occurs after 6th occurrence of a semicolon (;).

I will try this solution and let you know. Have a nice day buddy !!

Cheers
 
Thanks John,

The way you suggested is worked fine.but i didn't get alarm worked for signal quality 0.

Could you suggest, how can I parse the entire string.

$GPGGA;144058.00;5034.1905051;N;00226.1677476;W;2;08;1.1;24.8934;M;48.7867;M;14.6;1006

; => separator
GPGGA => Global Positioning System Fix Data
Time => 144058.0 (want to display as 14:40:58 )
Latitude => 5034.1905051 (want to display 50d 34.1905051')
Longitude => 00226.1677476 (want to display 02d 26.1677476')
Number of Satellites => 08
Horizontal dilution of Precision => 1.1
Altitude => 24.8934

Cheers
Amit
 
If you want to use the semicolon as a locator, you can use the expression I posted previously with Find and Mid, with some modifications to handle the different data types.

For example, to get the Altitude value, use TextToFloat instead of TextToInt. Make sure you put the result into a Real tag or the decimal places will get truncated.

Some are a little trickier. For the Latitude, you might have to extract the first two digits (50) into an integer and the remaining number to a Real. When you display tags in Crimson you can append the apostrophe as part of the primitive properties. Another option would be to create a new string from the tags you've created. The function DecToText will convert a floating point value back to a string, and you can combine strings with the "+" operator.

So, for the Time value you could extract the individual numbers as integers, then combine them into a single string with the punctuation. Like this:
TimeString := IntToText(HourValue,10,2) + ":" + IntToText(MinValue,10,2) + ":" + IntToText(SecondValue,10,2)
 
Thanks John,

Could you tell me how can I set the alarm please ?As I mentioned in previous post that I want to set the alarm as signal quality goes down to 0 (from 1 or 2).

Cheers
Amit
 
Both methods I mentioned will work, but it depends what you want the "alarm" to do. Are you using the built-in alarming functionality of the Data Station? In that case just turn on the Data Match event mode in the Alarms tab of the integer tag.

The caveat of my other suggestion (using the Triggers tab) is that the action you specify will only be executed once, and only when the value transitions from a non-zero value to zero.
 
In my Crimson 3 database, Signal_Quality integer data tag has the values related to the signal received from GPS Navigation device. I have tried to set the trigger on match and the Action as a complex code (Signal_Quality = 0;). But had no luck.

I am using the DSP's inbuilt alarm.

I want to trigger alarm as values of Signal_Quality tag matches to 0.

help is appreciated.

Cheers
Amit
 
There's no need for complex code when setting up an alarm. Go to the Alarms tab for the Signal_Quality tag. Set the Event Mode to Data Match with a Value of 0. Setting the trigger to Level Triggered will force the alarm to appear for as long as the condition remains true. Of course, you'll need an alarm viewer primitive on your display to see the result.

If this doesn't work, then there's a problem with the data in your tag. Put it on the virtual HMI and make sure that it's actually 0 when you expect it to be.
 
Thanks John,

It worked but in reverse manner. If Signal_Quality values becomes 1 or 2 alarm turn ON and goes OFF when it is 0. I am using Pilot Indicator primitives to show alarm status.

Cheers
Amit
 

Similar Topics

Hello all, thanks for reading! This is my first post so please be gentle. I have a difficult scenario that I'm struggling to make work. I have a...
Replies
6
Views
3,052
Hello, I am trying to take data from PAXI (with RS485 comms cards) and log it using a DSPSX. I have the PAXI hooked to a rotary length...
Replies
4
Views
2,979
Hi, We are trying to connect (for the 1st time) a Red Lion DSPSX to a Siemens S7. Unfortunately I do not have the S7 in front of me but I have...
Replies
0
Views
3,601
Hi folks, I got four PAXS and one PAXD connected to DSPSX via RS485. Each meter has its own number and baud rate is 9600,data bit 8, stop bit 1...
Replies
4
Views
2,144
I am having trouble using Sync Manager with a MicroLogix 1100. I am reading a 20 digit barcode and adding some more information then using the...
Replies
0
Views
2,818
Back
Top Bottom