Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure/Foot Switch

Solved!
Go to solution

All,

 

I have a project that I am trying to acquire readings from a Magna Mike. While I can successfully do this via a button on the UI, my users want to use the provided foot switch which sends data via the RS-232 port. The foot switch is plugged into the Magna Mike.

 

My problem is I cannot figure out how to tell Labview that the foot switch has been pressed and tell the Event Structure that data is being sent. Any ideas?

0 Kudos
Message 1 of 19
(4,528 Views)

read the data coming from the rs232 port and signal an event in case it is the foot switch

greetings from the Netherlands
0 Kudos
Message 2 of 19
(4,526 Views)

So an Event Structure would not be good here? From what I gather from your post, I should use a Enumerator with a Case Structure?

0 Kudos
Message 3 of 19
(4,516 Views)

first you need to detect that a foot switch has been pressed by polling something.

You can do this in a separate parallel loop and the signal the event to the other loop in which you have the event structure.

greetings from the Netherlands
0 Kudos
Message 4 of 19
(4,509 Views)

Have you looked at the documentation for the Magna Mike to see what kind of signal is sent when the foot switch is pressed? This should help you figure out what to poll for in LabVIEW

 

Travis-E

National Instruments
Product Marketer
0 Kudos
Message 5 of 19
(4,497 Views)

The user manual states "The Foot Switch is programmed to function identically to the [SEND] key on the front pannel of the gage."

 

The [SEND] key, I believe, sends a "t" ASCII command (or a 116 decimal or a 74 HEX). I guess I don't know how to pool the Event Structure to look for the "t" command.

0 Kudos
Message 6 of 19
(4,489 Views)
Solution
Accepted by Eric1977

do not use an event structure for polling.

in a blank vi put visa open initialise the serial port you need, start a while loop and in that wile use a visa send of a t with possible endcharacters,

followed by a visa read of x characters (the answer) and show that answer on the frontpanel.

use error in and error out for sequencing and check the error to stop the loop ored with a stop button you also read inside the loop.

After the loop you close the visa serial port and show th error contents.

 

good luck

greetings from the Netherlands
0 Kudos
Message 7 of 19
(4,483 Views)

I have something like that currently (a Sub VI) but I use the foot switch and the Configure Serial.vi eariler in my code. FYI - this isn't completely done yet.

 

Download All
0 Kudos
Message 8 of 19
(4,479 Views)

Make sure you use Open VISA. You want to try to keep the convention of Open Communication >> Read/Write >> Close Communication >> Check Errors. In your code you don't Open or close a VISA connection. 

 

Travis-E

National Instruments
Product Marketer
0 Kudos
Message 9 of 19
(4,465 Views)

Doesn't the VISA Config Serial Port VI automatically open the serial port? I'm under the impression that it does which is why I do not have the VISA Open.

0 Kudos
Message 10 of 19
(4,463 Views)