LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read from starting bit hex

Solved!
Go to solution

Hi everyone,

 

I've been using a touchscreen for a project. I am now able to read the hexidecimal values and convert them to decimal numbers through LabVIEW. However, I need to be able to read from the start bit everytime. Right now, when I move my finger along the touchscreen the hexidecmial values scroll and I end up reading the hex numbers in the middle of string output instead of the beginning. Any help on this would be very much appreciated. 

 

I've attaced my VI so you can see what I've got so far.

 

Thank you very much,

 

James

0 Kudos
Message 1 of 11
(4,097 Views)

I don't know what a touch screen or your finger has to do with the VI you attached.

 

And you don't read bits from a serial port.  You read bytes.

 

So perhaps you can explain your situation a bit more.  Maybe attach an example of the problem.

0 Kudos
Message 2 of 11
(4,074 Views)

The touchscreen sends data which is read by the UART port on the myRIO.  The serial data comes out as byte values such as 55 54 01 0A 04 D2 0D FF 00 C4.

 

The byte starts from 55 and ends at C4 but the data isn't always read from 55 on the screen. Usually, it starts from somewhere in the middle.

 

http://www.elotouch.com/Support/TechnicalSupport/Library/smartset1.asp

 

0 Kudos
Message 3 of 11
(4,059 Views)

I am assuming you are just doing a basic read from a serial port.  Have you looked at the examples that shipped with LabVIEW yet (Help --> Find Examples...)?

 

Edit:

Oops, posted after the previous post.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 11
(4,055 Views)

I would suspect either the touchscreen itself, or the UART Express VI.  I can't look into that as it is not functional on my LabVIEW.  Perhaps it is opening and closing the serial port on every iteration and failing to catch the beginning of messages.

 

If you want to see what that Express VI is doing, right click and pick open front panel. It will turn it into a regular subVI that you can dig into.

Message 5 of 11
(4,047 Views)

You are using an express VI that inits and reads from the port every time.  It's no wonder you are missing data.  You want to init once and then read whatever.  Please refer to the serial port examples shipped with LabVIEW.  (You'll find that it is similar to the express VI if you look inside it.)

 

Examples at Help --> FInd Examples...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 6 of 11
(4,044 Views)

@RavensFan wrote:

I would suspect either the touchscreen itself, or the UART Express VI.  I can't look into that as it is not functional on my LabVIEW.  Perhaps it is opening and closing the serial port on every iteration and failing to catch the beginning of messages.

 

If you want to see what that Express VI is doing, right click and pick open front panel. It will turn it into a regular subVI that you can dig into.


Except the Express VI doesn't even do you the favor of closing the serial port for you.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 7 of 11
(4,037 Views)

Bill,

I saw the version of that VI you got converted and could see inside of it now.  You're right.  That express VI is pretty bad.  It really has no reason to even exist.

 

It also uses the "Bytes at Port" method to read the serial port and the termination character is disabled.  That means there is no way to guarantee the reads will ever be synchronized with the data that is arriving at the serial port.

 

Whoever was responsible for writing that Express VI should look into it.

 

James,

Just delete that Express VI.  It will only give you problems.  Look at the serial port examples.  But look at them with a grain of salt because "Bytes at Port" should only be used in pretty particular serial communication situations.  What is the best method depends on the communication protocol.

Message 8 of 11
(3,993 Views)

@RavensFan wrote:

Bill,

I saw the version of that VI you got converted and could see inside of it now.  You're right.  That express VI is pretty bad.  It really has no reason to even exist.

 

It also uses the "Bytes at Port" method to read the serial port and the termination character is disabled.  That means there is no way to guarantee the reads will ever be synchronized with the data that is arriving at the serial port.

 

Whoever was responsible for writing that Express VI should look into it.

 

James,

Just delete that Express VI.  It will only give you problems.  Look at the serial port examples.  But look at them with a grain of salt because "Bytes at Port" should only be used in pretty particular serial communication situations.  What is the best method depends on the communication protocol.


To be fair, the Express VI was specifically made for Arduino communication, I believe, so maybe the "Bytes at Port" method is the way to do it.  Still, there's no reason to combine the init with the read and not close it afterward.  If it was intended as a one-shot read, why not close the serial port after the read?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 9 of 11
(3,954 Views)

Hey guys,

 

Thank you for all your help. I looked at the examlpes but I still couldn't get the results that I wanted. I know the string of bytes should always start with 5554. Do you think I could use one of the string commands to search for these two bytes and then output the rest of the strong after the 5554?

 

Thanks again,

 

James

0 Kudos
Message 10 of 11
(3,933 Views)