LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Good Programming with event and Serial Data

HI,
until now I used LabView for Patern recongnation in Images (no programming for Hardware). now I hav to programm a User Interface for a communication with µC with Serial Port. I can communcatewith my device. on my GUI I Have:
one Button "Version" to get the firmware Version of the µC.
ListBox (Event change value) with 4 Running Mode: 0 to Stop the device
                                                 1 device is running but no data is send to serial
                                                 2 device send data continus to serial port (e.g. 4095;4095;4095;4095;79)
                                                 3 device send data continuous to serial Port (e.g. 0.2365;0.4555;15)
 Stop Button (Event value)
one Button to open other Dialog for parameter set (not implemented until now) need your Help
2 chart to see the data for the 2 sensors in Mode 2 or 3 (not implemented until now) need your Help
 
My questions are:
How can I break the While loopto read data by running Mode 2 and 3 if other Evant is activated( for example if I Mode 2 is shoosed, device send data and if I click the version button for read version, the event is not occur.)?
How can I call other dialog ?event or other Methode? In this dialog I will set different parameter can I use Table with default and new paramter and change value event?
Show sensor data in Charts? mode 2: 2 chart pro sensor and Mode 3 1 chart pro Sensor
 
thanks
0 Kudos
Message 1 of 10
(3,969 Views)
any suggestion pls
0 Kudos
Message 2 of 10
(3,937 Views)
Howdy,

I would suggest putting your case statement inside the Event Structure's Timeout case (Add Event Case... <Application> Timeout). Set the Timeout input to 50 or something.

Then, "Replace With Shift Register" the New Value coming from the 'Choose Run Mode Change', so the case statement will see the new value.

That should let your program act accordingly based on the Run Mode.

What do the data strings look like? You may have to parse the data and convert it from strings to integers or doubles or whatever, and then display the data in the charts.

B-)
0 Kudos
Message 3 of 10
(3,926 Views)

Hello,

thanks for the response. I testted your suggestion but it did not work as I will. you can Look on my changes.If I shoosed Running  Mode 2 or 3 and than I click the Version Button or Stop Button the Event for this 2 Button will be not handeld?

Perhaps wenn I handel Versio Button I have to change Run Mode from 2 or 3 to 1 Than read Version. How cann I implement it ?

Data String for Mode 3 are 5 Value with ; as determinator: on Chart Sensor 1 (two 1st value as integer for example 4095;4095)  on Chart Sensor 2 (4095;4095 1st value as integer) the last Value is for Data checking.

Data String for Mode 2 are 3 Value with ; as determinator: on Chart Sensor 1 (one value as floate 0.2547)  on Chart Sensor 2 (one value as Floate e.g. 0.2547) the last Value is for Data checking.

How can I display this data by shoosing the run Mode in the some Chart (Senosr1 and Sensor 2)?

0 Kudos
Message 4 of 10
(3,882 Views)
OK, on the right-hand side of the event structure, right-click on the blue box and select "Use Default if Unwired". Then, you will need to add a constant to that connector for each event case, corresponding to the next desired value. That will make sure the current value is carried over to the next timming loop. For the "Version": Value Change event, you just want the same value to carry over, so connect a wire from the left side of the case to the right side.

See the example for "Standard State Machine" as an example. Even though you are also using events, the general idea is still there.

For the charts, if you move them outside the case statement, but still inside the Timeout event. Then, you'll create a constant or feed data to the charts for each case. Oh, but you will have to either convert the Integer data to double values, or change the Range and Scale values for the charts using Property Nodes when you switch between Mode 2 and Mode 3.

Other than that, your program looks pretty good.


Message Edited by LabViewGuruWannabe on 12-03-2007 11:13 AM
0 Kudos
Message 5 of 10
(3,857 Views)


 you will need to add a constant to that connector for each event case, corresponding to the next desired value.

 I do not have a defined next desired Value. It can be any event from the event case.
 

See the example for "Standard State Machine" as an example. Even though you are also using events, the general idea is still there.

 I do not find ths Example in LabView 8.2 Perhaps another name?
 
 
can you mack a Modification pls?

Other than that, your program looks pretty good.

 with your suggestion and this Forum I will


Message Edited by LabViewGuruWannabe on 12-03-2007 11:13 AM
0 Kudos
Message 6 of 10
(3,845 Views)
The State Machine example comes up in 8.2 on my machine when I select "New..." VI--From Template--Frameworks--Design Patterns--Standard State Machine.

I'm attaching a modified version of your program. I can't test it completely, because I don't have the instrument you are communicating with, but this should help some.

- Greg
0 Kudos
Message 7 of 10
(3,839 Views)

HI,

Thanks the problem with event is resolved but I have A Problem to update data in chart.

in Debug Mode (highlights execution) I can update chart with data. im Normal Mode (continous running ) I can not do this. I tested with different Wait-delay but it dos not work. have any seggestion

Thanks

0 Kudos
Message 8 of 10
(3,816 Views)
received data is string (line) with CRLF as terminator e.g.
4095;4095;4095;4095;15<\r\n>
4095;4095;4095;4095;15<\r\n>
4095;4095;4095;4095;15<\r\n>
4095;4095;4095;4095;15<\r\n>
4095;4095;4095;4095;15<\r\n>
0 Kudos
Message 9 of 10
(3,811 Views)
Ok,
 
I solved this Probleme . I us e VISA Wait on Event to get Data from Serial Port.
 
now I will Call per Event a sub VI  with Click on the Button.  the sub VI has a Pannel to Set Setting for the device. how can I do it and come back to main pannel if click a clos Button in the subvi?
for the setting  i will ust a table and if the user change the value the command will be send to device with the new Value? any examples pls? or other suggestion ?
Thanks
0 Kudos
Message 10 of 10
(3,777 Views)