Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

I need to control my sony camcorder through the LANC connection

Solved!
Go to solution

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.

0 Kudos
Message 1 of 13
(3,927 Views)
Simplest would probably be to use an event structure. For a value change event for each button, have a VISA Write with the appropriate command..
0 Kudos
Message 2 of 13
(3,923 Views)

Back from a long weekend.  I give it a shot.

 

Thanks

0 Kudos
Message 3 of 13
(3,880 Views)

Dennis,

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,

howzz

0 Kudos
Message 4 of 13
(3,860 Views)
Solution
Accepted by topic author howzz

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.

0 Kudos
Message 5 of 13
(3,858 Views)
Thank you for your guidance.  I've got it figured out for now.
0 Kudos
Message 6 of 13
(3,834 Views)
Then you could mark my response as the actual answer instead of your thank you. That can be changed by clicking on 'Options' above the message body.
0 Kudos
Message 7 of 13
(3,831 Views)
May I ask what type of cable you are using for the LANC control? I have a camcorder with a LANC connector that I would love to control using labview. How do you connect it to the PC?
0 Kudos
Message 8 of 13
(3,810 Views)
I looked under Thread Options top left and options on the right for something called actual answer and didn't see it.  This is the first form I have ever wrote to so I don't know any of the protocol or etiquette and am not clear on what it is you want me to do.
0 Kudos
Message 9 of 13
(3,805 Views)
It was under the Options on the right and I believe the text was Unmark Accepted Solution. The time limit has probably expired. If you notice the 'Go to Accepted Solution' in your original post, clicking on that will bring someone to your thank you. On short threads it's no big deal but it does make it a bit harder for someone to find the actual fix when they have done a search and find the post.
Message 10 of 13
(3,799 Views)