LANC commands with Visual Basic

H

Thread Starter

Harpert

I have build a converter for RS 232 - Lanc
If I use Hyperterminal I can send commands to a VCR (Sony) for example 1034 would make the VCR start

How can I use these codes (1034 / 1030 / 10C2) within Visual Basic (6)

The problem that I am facing is that it is no problem to open a Hyperterminal session.
I type in 1034 en CR and the VCR starts to playback.

Now I want to use these commands in Visual Basic

Private Sub MSComm1_OnComm()

MSComm1.CommPort = 2
MSComm1.Settings = "9600,n,8,1"
MSComm1.PortOpen = True

End Sub


Private Sub Start_Click()

MSComm1.Output = "1034"

End Sub

This does NOT work (error, port not open)
Please advise (I am not very experienced with VB)
 
Y

Yeasir Rahul

Whatever you do with PC serial port using Hyperterminal, can be done also using Visual Basic.

The right segment of code will be something like the following

------------------------
Private Sub Form_Load()

MSComm1.CommPort = 2
MSComm1.Settings = "9600,n,8,1"
MSComm1.PortOpen = True

End Sub

------------------------
Private Sub Start_Click()

MSComm1.Output = "1034"

End Sub

------------------------

If your program needs to receive something from the VCR, then you'll need extra codes. But the above is basically all you need now.

By the way, what is a LANC!

Yeasir Rahul
rahul AT voltsmith DOT com
 
S

Smith, James

You need to put what you have in the oncomm in the form load
Private Sub Form1_Load()

MSComm1.CommPort = 2
MSComm1.Settings = "9600,n,8,1"
MSComm1.PortOpen = True

End Sub
Then it will work.

The oncomm triggers when something happens on the port after it is open (I.E. control line changing, data arriving,....)

Regards,
James Smith
Automation Department
American Castings LLC
Pryor Oklahoma
918-476-4391 V.
918-476-4321 F.
 
I am wanting to build a serial to lanc cable and came across this post and was wondering if someone can help point me in the direction I need to go to make one. I am wanting to control my sony camcorder from a software I am working on in visual basic.

Thanks
Heath
 
Top