PDA

View Full Version : vb6 to pic basic



Darrenmac
- 11th December 2005, 05:17
I have written a basic program in vb6 that sends serial data to a 2way radio. This software works fine, I then tried to do the same in pic basic but the serial comms does not appear to be working.The first line of code is the vb6 code that sends a connect command to the radio.

MSComm1.Output = Chr$(8) + Chr$(0) + Chr$(181) + Chr$(0) + Chr$(0) + Chr$(0) + Chr$(1) + Chr$(6) + Chr$(196)

Pic basic equivelent
SerOut PORTA.0,n9600,[8,0,181,0,0,0,1,6,196]' logon as DTE

the second line tellls the radio to transmit


MSComm1.Output = Chr$(4) + Chr$(0) + Chr$(187) + Chr$(128) + Chr$(63)

and the pic basic equivelent
SerOut PORTA.0,n9600,[4,0,187,128,63]' transmitt

is ther something wrong in my conversion here or maybe I have a problem elsewhere. I can see data comming out of the port when I look on a CRO.

PBP_NeuBoi
- 12th December 2005, 12:11
Hi

Sorry I can't help, but am interested in controlling radio doing this myself in VB or VC++ and PBP or PIC C, or maybe even AVR so to use telemetry with a robot.

Can you point me in the right direction to resources, etc? I have Visual Studio and plenty of uC C programming tools.

Thanks

Cheers

|-]

Dale

Darrenmac
- 12th December 2005, 20:54
The radio that I am controlling is a Simoco SRM9000, but if you wish to send data over short distances try on of the many 433MHz modules as they are simple and they are cheap

skimask
- 16th December 2005, 05:23
A simple thought that's tripped me up more than once...
Is there a MAX232 type RS232 converter in the middle somewhere?
Have you tried both SerOut with n9600 and then with t9600?
The PIC's 5v serial comm's might not be enough to drive the radio's serial port input.
But I'm guessing since I don't know anything about the radio itself...just mentioning something that's bitten me a number of times for a number of days only to have me kick my own butt for not thinking of it sooner!
JDG

Darrenmac
- 16th December 2005, 13:19
No this is not a max232 in the circuit, just direct connect, I have not tried any other baud rate (this is the default in the radio and works fine with simple vb6 program

skimask
- 18th December 2005, 07:17
Well, if there's not a max232 in the middle, then you might be back to the 5v serial comm not being enough to drive the receivers inputs, which might want the +12/-12v that a real rs232 serial port would give you. The PicBasic code looks fine to me, no errors I can see. Hope this helps in some small way.
JDG

Darrenmac
- 18th December 2005, 12:19
Thanks for that but I have found that using a 10MHz crystal I had the fuse bit for XT set instead of HS. Thanks to Charles in another thread that I picked up on my mistake.

skimask
- 19th December 2005, 01:56
DOH! Good find...you're not alone on that one!
JDG