Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC to PC communication.

Status
Not open for further replies.

ANUPAMA

New Member
hi to all,
I have programmed PIC in asynchronous mode and transmitting data continusly with 9600 baub rate , and on pc side i have written program in visual basic. using mscomm component , and watching received data in one message box. but i'm not receiving proper data, can anyone tell me what might be the problem . if u give me any sample program for both PIC and PC in vb or either , i will be very greatful.
 
ANUPAMA said:
hi to all,
I have programmed PIC in asynchronous mode and transmitting data continusly with 9600 baub rate , and on pc side i have written program in visual basic. using mscomm component , and watching received data in one message box. but i'm not receiving proper data, can anyone tell me what might be the problem . if u give me any sample program for both PIC and PC in vb or either , i will be very greatful.

What sort of data are you sending from the PIC?, normally a PC serial port will only accept ASCII data, you need to open it in a different mode for binary data.

Try using Hyperterminal to see what that shows - this should show you if the probelm is at the PIC end or your VB program.
 
:idea:

If the data is not "proper" it may be that you have set up the UART incorectly for the expected speed, recheck this.......

As Nigel sujjested, try looking at the data in hyperterminal, I prefer to use software called QModem, it's old now and you have to run the installer in win95 compatability mode...... but it has a "debug hex" feature, this allows you to see the numbers you are actually getting.

Another brilliant bit of software to help in these problems is portmon....
**broken link removed**

It's free, start it up before your VB and you can see all traffic etc from the PC<->PIC (also the windows calls etc from VB) it's brilliant!

Hope this helps!
 
are you receiving complete rubbish or just missing some bytes?

I couldn't get a pic to VB thing to work properly some time ago (missing bytes) and it turned out to be the VB software was to blame (to slow?)
opened realterm and all worked well...

Lost trust in VB this way.
Anyhow, if you want a good and free program to monitor the serial port you should get realterm, has 1001 options .
http://realterm.sourceforge.net/

if you're just receiving rubbish then check:
-baudrate , databits, start and stop bits... on both sides
-if you use the hardware usart you need a level shifter that inverts the signal
 
Nigel Goodwin said:
ANUPAMA said:
hi to all,
I have programmed PIC in asynchronous mode and transmitting data continusly with 9600 baub rate , and on pc side i have written program in visual basic. using mscomm component , and watching received data in one message box. but i'm not receiving proper data, can anyone tell me what might be the problem . if u give me any sample program for both PIC and PC in vb or either , i will be very greatful.

What sort of data are you sending from the PIC?, normally a PC serial port will only accept ASCII data, you need to open it in a different mode for binary data.

Windows (and so, any software running on it) can only open the serial port in binairy mode, the ascii option is there in VB, but it doesn't work or is changed to binairy internally
 
Exo said:
Windows (and so, any software running on it) can only open the serial port in binairy mode, the ascii option is there in VB, but it doesn't work or is changed to binairy internally

I was of the opinion that the opposite takes place, under Windows normal serial operations are in ASCII, you have to specifically open it as binary if you wish to use it that way.

But I don't use VB, perhaps that is a VB characteristic?.
 
Can u send me your PIC coding ?

Exo said:
are you receiving complete rubbish or just missing some bytes?

I couldn't get a pic to VB thing to work properly some time ago (missing bytes) and it turned out to be the VB software was to blame (to slow?)
opened realterm and all worked well...

Lost trust in VB this way.
Anyhow, if you want a good and free program to monitor the serial port you should get realterm, has 1001 options .
http://realterm.sourceforge.net/

if you're just receiving rubbish then check:
-baudrate , databits, start and stop bits... on both sides
-if you use the hardware usart you need a level shifter that inverts the signal
 
I have happily transmitted both ASCII and binary data to the PC from the PIC. Although I have not used VB, I have used Borland C++ with the Async Pro without a problem. I also have used Microsoft C# and have had problems with loosing data. I also found the port component slower in C#.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top