ASCII extract + or -
ASCII extract + or -
(OP)
I have a project, which utilizes an MVI46-GSC that is basically a RS232 serial communications card. (RSLogic, SLC505 Processor) I'm receiving data from a multiplexer, which communicates to up to 4 other field devices. The multiplexer in only capable of sending the information in an ASCI format. I have established communications and worked out the logic to extract from the ASCII string a value which is metric, and the logic converts this seven character text value (floating decimal example 000.001 or 0.00001 or 00000.0) to an integer then into a floating decimal point value all of which works.
The problem is within the string the value will also contain the polarity of the value "+ or -" it is always the character just before the value. I cannot determine how to identify or detect when this value changes.
If I extract the value with an AEX command then move it to an integer with a AIC command it shows up within the integer as "3356" for both a + and - value. Does anyone know how to I can determine the state of the value + or - from a ASCII string (also a : equals a value of 3320)
Any help greatly appreciated
Thanks in advance
The problem is within the string the value will also contain the polarity of the value "+ or -" it is always the character just before the value. I cannot determine how to identify or detect when this value changes.
If I extract the value with an AEX command then move it to an integer with a AIC command it shows up within the integer as "3356" for both a + and - value. Does anyone know how to I can determine the state of the value + or - from a ASCII string (also a : equals a value of 3320)
Any help greatly appreciated
Thanks in advance





RE: ASCII extract + or -
HELP still needed
Please advise
RE: ASCII extract + or -
For example, a value that is +1000
in ASCII = +1000
in Hex = 2B 31 30 30 30
in SLC = +1000 or \2B \31 \30 \30 \30
a value that is -1000
in ASCII = -1000
in Hex = 5F 31 30 30 30
in SLC = -1000 or \5F \31 \30 \30 \30
If you do a move from String (ST:) register to an Integer (N:) register the processor should automatically show the sign of the number based on the string read from the buffer.
RE: ASCII extract + or -
I have another computer setup and monitoring the data as it comes into the MVI46-GSC card serial port via Hyper-Terminal. It is raw and before it is placed in the M0 area of memory then moved to the processor into a ST:
An exact example of what I see is
[1][:][+][0][0][0][.][0][0][7][CR]
[1]= Input channel
[:]= Sepatator
[+]= Polarity
[0]= Value six digits with floating decimal
[0]= Value
[0]= Value
[.]= Value
[0]= Value
[0]= Value
[7]= Value
[CR] Line Terminator
There may be a way that I could move the data directly from the M0 area into something other than a String text??
RE: ASCII extract + or -
RE: ASCII extract + or -
Hyper Terminal sees
[1][:][-][0][0][0][.][3][9][3][CR]
ST9:0 contains
1:-000.393^M\00
Exactly
RE: ASCII extract + or -
RE: ASCII extract + or -
I'm using an AEX and moving what I need to another ST word then converting the characters into an Integer with an ACI
Hey !!!!
1 : - 0 0 0 . 3 9 3 ^ M \ 0 0
I extracted the sign and all of the values before the decimal result=(-000)
Then extracted the values after the decimal (393)
Then
Used an ACN to put them back together in another ST
Result=(-000393)
Then simply converted it to an integer the sign follows along
Result=(-393)
I lose any zeros that are in front, but it does not matter I simply used the sign bit S:0/3 to set the actual floating point to a negative value when it occurs.
Thanks for you help