I need to control my Sony camcorder through the LANC connection. Right now I can control the camera by way of Tera Term, through the computer serial port, through a Sony LANC controller board, to the camera. I would like to build a program in LabView where I can click on buttons to control the camera through the serial port. Example: power on; zoom in; zoom out; etc... I know the commands to control the camera because I type them in, in Tera Term. How do I associate the commands to buttons in LabView to execute the commands?
Thanks for your help.
Solved! Go to Solution.
I have some questions regarding the information you gave me. I'm real new to LabView and have been playing around with the event structure in a sample program called Radio Buttons with Event Structure.vi. This seems close to what I would like, so I combined it with another sample program called Basic Serial Write and Read.vi. What benefit do I get using the Event Structure over using a Case Structure? I don't understand the Event Data Node that is attached to the inside left border. Why not just attach the Radio Buttons control to the Case Structure? I don't understand the association between the Radio Buttons, the Case Structure Cases, and the String in the Case Structure. It appears that I can name the Radio buttons anything I want, but can not rename the selector terminal cases in the Case structure. When I change them to something else they turn red. On the Front Panel I rename the white box below the String control but when I save and close the program and then open it back up all the white boxes have changed and all say "Option 1'. And finally how do I get HEX codes out of the VISA Write? If I understand this correctly what ever is in the string and sent to the VISA Write gets sent to the hardware that I am trying to talk to?
Thanks for your help,
Before there was an event structure, everyone had to use a while loop with a case statement. With each iteration of the loop, the value of the control wired to the case statement had to be read. This was/is called polling and used quite a bit of computer resources. With the event structure, nothing runs until an event actually happens - no polling and the computer resources used are minimal.
The event data node returns different information depending on the event and the control that is firing the event. In the example you mention, the NewVal is wired to the case structure. This is the same thing as wiring the control but in some cases, the control might be located in a different event. You can have a single event fired for multiple controls and in that case, you might want to use the CtrlRef (control reference) to determine the actual control. There are a lot of possibilities.
The radio button is an enum. The case statement have to match the enum values. Those are not visible in the example. Right click on one of the controls and select Visible Items>Label. If you change that, you will see the value in the case statement change.
In order to send hex, you can simply right click on your string control/constant and select 'Hex Display'. You can also use the Typecast and Byte Array to String. This question has been asked and answered hundreds (perhaps thousands) of times and there that many example programs attached to those posts. Do a search.