Instrument Control (GPIB, Serial, VISA, IVI)

取消
显示结果 
搜索替代 
您的意思是: 

Event Structure/Foot Switch

已解决!
转到解答

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 项奖励
1 条消息(共 19 条)
4,808 次查看

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

greetings from the Netherlands
0 项奖励
2 条消息(共 19 条)
4,806 次查看

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 项奖励
3 条消息(共 19 条)
4,796 次查看

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 项奖励
4 条消息(共 19 条)
4,789 次查看

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 项奖励
5 条消息(共 19 条)
4,777 次查看

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 项奖励
6 条消息(共 19 条)
4,769 次查看
解答
接受人 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 项奖励
7 条消息(共 19 条)
4,763 次查看

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.

 

下载全部
0 项奖励
8 条消息(共 19 条)
4,759 次查看

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 项奖励
9 条消息(共 19 条)
4,745 次查看

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 项奖励
10 条消息(共 19 条)
4,743 次查看