LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find, separate, and convert hex strings streaming through com port?

Solved!
Go to solution

Still trying to get this to work without much luck. My sad attempt at getting this state machine exmaple to work: 

0 Kudos
Message 11 of 39
(1,659 Views)

updated VI, but still not working. Why won't it recognize my event value changes? 

0 Kudos
Message 12 of 39
(1,644 Views)

You have an event structure for detecting an event for boolean indicator.

-But how does the value of that indicator update?

-I don't see any wire connection to that indicator. did i miss anything?

Thanks
uday
0 Kudos
Message 13 of 39
(1,637 Views)

Your event is looking for a value change on an indicator.

 

You can't have a value change event on an indicator.  Only a control.  (Or if you write a value to the Value(signalling) property node.)

0 Kudos
Message 14 of 39
(1,635 Views)

It is initialized as false before the while loop, so the value changes from false to true, in the intialize state. but that does not trigger the state 1 event to start for some reason. 

0 Kudos
Message 15 of 39
(1,634 Views)

After entering event strcture, then it starts listening to events happened at that time only not before or after the event strcuture exited.

-In that sense you may not need event struture just compare it's value and go to next state accordingly.

Thanks
uday
0 Kudos
Message 16 of 39
(1,635 Views)

@udka wrote:

After entering event strcture, then it starts listening to events happened at that time only not before or after the event strcuture exited.

-In that sense you may not need event struture just compare it's value and go to next state accordingly.


Incorrect.  An event structure is always listening for events that it is registered for, whether the execution has reached the event structure or not.

 

The problem is that writing a value to a terminal or a local variable does not trigger a value change event.  You need to write the the Value(Signalling) property node for that control.

 

Get rid of that whole event structure.  Your program logic is not using it in any way that makes sense.  Let's say you get to State 1.  But if that byte that you have read is not 7E, then you are going backing to waiting for "Is connected?" again.  No.  As mentioned earlier, your next step is to read the next byte until you find the 7E.

Message 17 of 39
(1,631 Views)

@udka wrote:

After entering event strcture, then it starts listening to events happened at that time only not before or after the event strcuture exited.

-In that sense you may not need event struture just compare it's value and go to next state accordingly.


Do you mean just delete the event structrue for the state 1 transition but keep the stop one or delete the event structure all together? 

0 Kudos
Message 18 of 39
(1,628 Views)

Hi mario,

 

still not working

- You are mixing up "hex values" and "normal string display":in state 2 you try to convert the 2 bytes read from port into a number the completely wrong way. Btw. why do you need to write to the local too?

- Which event do you miss? The "stop" event should work, the "port connected" will never work: the event structure is waiting for user events on the frontpanel. Writing to an indicator will never fire such an event as you should have read in the LabVIEW help. Btw. that indicator is written once outside your loop - how will you ever fire an event then?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 19 of 39
(1,626 Views)

@RavensFan wrote:

@udka wrote:

After entering event strcture, then it starts listening to events happened at that time only not before or after the event strcuture exited.

-In that sense you may not need event struture just compare it's value and go to next state accordingly.


Incorrect.  An event structure is always listening for events that it is registered for, whether the execution has reached the event structure or not.

 

The problem is that writing a value to a terminal or a local variable does not trigger a value change event.  You need to write the the Value(Signalling) property node for that control.

 

Get rid of that whole event structure.  Your program logic is not using it in any way that makes sense.  Let's say you get to State 1.  But if that byte that you have read is not 7E, then you are going backing to waiting for "Is connected?" again.  No.  As mentioned earlier, your next step is to read the next byte until you find the 7E.


What would that look like? when you say write value(signalling)?

 

I don't understand what makes this read one byte at a time then 2 bytes state machine a better solution that just reading in all the bytes at once and doing a string search for the node identifier, then reading a fixed length of string characters that follow that identifier. 

0 Kudos
Message 20 of 39
(1,622 Views)