Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 5th May 2004, 02:10 PM   (permalink)
Default PIC to PC communication.

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.
__________________
MOTGI ANUPAMA.
ANUPAMA is offline  
Old 5th May 2004, 02:21 PM   (permalink)
Default Re: PIC to PC communication.

Quote:
Originally Posted by ANUPAMA
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 5th May 2004, 02:34 PM   (permalink)
Default

: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....
http://www.sysinternals.com/ntw2k/fr.../portmon.shtml

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!
__________________
Regards


MATT!
Matt(Pic progger) is offline  
Old 5th May 2004, 11:40 PM   (permalink)
Default

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
Exo is offline  
Old 5th May 2004, 11:44 PM   (permalink)
Default Re: PIC to PC communication.

Quote:
Originally Posted by Nigel Goodwin
Quote:
Originally Posted by ANUPAMA
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 is offline  
Old 6th May 2004, 12:17 AM   (permalink)
Default Re: PIC to PC communication.

Quote:
Originally Posted by Exo
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?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 6th May 2004, 12:25 AM   (permalink)
Default

No, it's windows itself that doesn't allow nonbinary transactions

Here is a MSDN view of a DCB structure used to set/get serial port settings
http://msdn.microsoft.com/library/de...se/dcb_str.asp

take a look at the explanation for the member fBinairy...
Exo is offline  
Old 7th May 2004, 08:17 AM   (permalink)
Default Can u send me your PIC coding ?

Quote:
Originally Posted by Exo
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
__________________
MOTGI ANUPAMA.
ANUPAMA is offline  
Old 7th May 2004, 09:51 AM   (permalink)
Default

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#.
gtrman1992 is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 04:58 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker