LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial data manchester

Hello All,

 

I am new to the forums here. I need help converting the following code for use in LabVIEW. The data is coming in using rs232 format in ASCII. The bits are manchester encoded. I have setup the normal vi for reading serial data but when indexing it in an array the data is all over the place and inconsistent. Your help would be greatly appreciated.

 

 

               'SERIAL NUMBER
                Cells(24, 3) = Chr(ReadValue(0)) & Chr(ReadValue(1)) & Format(Str((CVar(ReadValue(2)) * 65536) + (CVar            (ReadValue(3)) * 256) + (CVar(ReadValue(4)))), "00000")
                'PART NUMBER
                PNRval = Format(Str(CVar(ReadValue(5)) * 65536) + (CVar(ReadValue(6)) * 256) + (CVar(ReadValue(7))), "00000")
                Cells(25, 3) = "X" & Mid(PNRval, 1, 2) & "-" & Mid(PNRval, 3, 3)
                'STATUS
                Cells(26, 3) = CVar(ReadValue(8))
                Cells(row, 24) = Cells(26, 3)
                'Pressure
                Cells(27, 3) = ((CVar(ReadValue(9)) * 256) + CVar(ReadValue(10))) / 100
                Cells(row, 21) = Cells(27, 3)
                'SensTmp
                If (ReadValue(11) > 127) Then
                    Cells(28, 3) = (((CVar(ReadValue(11)) * 256) + CVar(ReadValue(12))) / 100) - 655.36
                Else
                    Cells(28, 3) = ((CVar(ReadValue(11)) * 256) + CVar(ReadValue(12))) / 100
                End If
                Cells(row, 22) = Cells(28, 3)
                'ElecTmp
                If (ReadValue(13) > 127) Then
                    Cells(29, 3) = (((CVar(ReadValue(13)) * 256) + CVar(ReadValue(14))) / 100) - 655.36
                Else
                    Cells(29, 3) = ((CVar(ReadValue(13)) * 256) + CVar(ReadValue(14))) / 100
                End If
                Cells(row, 23) = Cells(29, 3)
               
                Cells(30, 3) = "PASS"
                Cells(row, 25) = 1
                'Cells(row, 26) = " "

0 Kudos
Message 1 of 8
(3,247 Views)

Manchester encoding is typically used for synchronous communications and RS-232 is asynchrounous. ASCII has nothing to do with how the bits are encoded.  So what are you really doing?

 

What is that "code" supposed to do?  What language is it?

 

What do you actaully receive in your array when you read serial? The "normal" serial VI does not generate an array.

 

Exactly what do you mean by "...data is all over the place and inconsistent."? Is some of the data at one latitude and other parts at a different latitude?

 

Please run your VI until you have some data. Make the current value default and svve the VI. Then post that VI with the data. Tell us exactly what bytes were transmitted and exactly what you think the output should be.

 

Lynn

0 Kudos
Message 2 of 8
(3,237 Views)

Thanks Lynn,

 

Let me clarify. I was stating that the data in the module uses manchester encoding. It outputs data on the serial port and I am reading that into the computer using a rs232 to usb adapter. I am converting the string to decimal using the unsigned byte array then indexing it from there. I will upload the data shortly.

0 Kudos
Message 3 of 8
(3,229 Views)

The stream looks like this:  ªªeZeiUUUUUYUUVši¦.  ASCII characters, it takes 18 bytes to send a message.

0 Kudos
Message 4 of 8
(3,133 Views)

What should the resulting data for that string look like?

 

Lynn

0 Kudos
Message 5 of 8
(3,124 Views)

Preamble

1

Byte to   stablise the DC component signal

serial number

5

Serial   number of the unit:

- 2 Bytes   for the 2 ASCII characters (AA to ZZ)
  - 3 Bytes for the number (0 to 99999)

part number

3

Part Number   of the unit( The last 5 numbers SSHHh):

  •   3 Bytes for the number (0 to 99999)

Status

1

Byte   indicating the status

Sensor   pressure

2

Value of   the measured sensor pressure :

2 Bytes   (unsigned integer) with 16 significant bits, decimal value x100 (0.00 to   655.35 psi)

Sensor   temp

2

Value of   the measured sensor temp :

2 Bytes   (signed integer) with 1 sign bit and 15 significant bit, decimal value x100   (-327.68 à +327.67°C)

E.   temperature

2

Value of   the measured E. temperature :

2 Bytes   (signed integer) with 1 sign bit and 15 significant bit, decimal value x100   (-327.68 à +327.67°C)

Checksum

2

Arithmetic sum of Bytes on the message frame   (without preamble and checksum)

0 Kudos
Message 6 of 8
(3,115 Views)
Instead of a string of gibberish in a post, it would have been so much better if you had actually posted your VI with a string indicator that you saved with some default data as Lynn asked you to do. No one can debug code that you don't attach.
0 Kudos
Message 7 of 8
(3,109 Views)

The format you posted does not match the stream in your previous post.

 

The second and third bytes are not an upper case ASCII letters. How are the three-byte numbers (0 to 99999) encoded? Unsigned integer? which is the most significant bit? On the two-byte integers is the most significant byte first or second? 

 

Again, what should the result be for the string you posted?

 

Lynn

0 Kudos
Message 8 of 8
(3,101 Views)