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
 
Thread Tools Display Modes
Old 26th November 2003, 05:09 PM   (permalink)
New Member
foosm is on a distinguished road
Default urgent!! interfacing the pic16f877 to the pc serial port

hi all, lets say i have a pic16f877 with some 9 bit data stored in its registers... can i send these data to a PC running windows OS through the serial port... i have to use C++ pogramming on the PC side...

how do i go about it....?? any tutorials or even ready templates i can use...???

thanks a million
foosm is offline   Reply With Quote
Old 26th November 2003, 10:34 PM   (permalink)
Super Moderator
 
Nigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to behold
Default Re: urgent!! interfacing the pic16f877 to the pc serial port

Quote:
Originally Posted by foosm
hi all, lets say i have a pic16f877 with some 9 bit data stored in its registers... can i send these data to a PC running windows OS through the serial port... i have to use C++ pogramming on the PC side...

how do i go about it....?? any tutorials or even ready templates i can use...???

thanks a million
Check my PIC tutorials at http://www.winpicprog.co.uk, I have tutorials for using RS232 in both hardware and software.

If you really want to transfer 9 bits, you will probably need to do it as two bytes - a single byte is normally only 8 bits, although you could use non-standard methods.
Nigel Goodwin is offline   Reply With Quote
Old 27th November 2003, 12:44 PM   (permalink)
Experienced Member
 
TheAnimus is on a distinguished road
Default

By 9bit data do u mean 8bit + parity?

rs232 is an 8bit "data-space" protocol, you could do something clever with the parity bit, but most computers have hardware USART decoders, and you might find it automatically discards the "deffective" parity bit.
TheAnimus is offline   Reply With Quote
Old 27th November 2003, 03:01 PM   (permalink)
Experienced Member
StupidDum is on a distinguished road
Default Re: urgent!! interfacing the pic16f877 to the pc serial port

serial is the simplest interfacing to PC
well.. i just connect 3 wires, Ground, Transmit, Receive
handshaking is not necessary

hmm... now i'm interested to interface parallel port..
ehh... but kind of lazy to do some study..
besides 8 data pin, what other necessary pin i need to connect from parallel port to PIC?? ignore those Out of Paper pin..etc..
StupidDum is offline   Reply With Quote
Old 27th November 2003, 03:49 PM   (permalink)
Exo
Experienced Member
 
Exo is on a distinguished road
Send a message via ICQ to Exo
Default

If you want to use the parallel port in SPP mode (standard mode, least programming hassle) then those 8 data bits are only output, for input into the pc you can use the other signals like out of paper, online, ...

do a search on google, comes up with lots ot results about pinout and the right registers to adress
Exo is offline   Reply With Quote
Old 28th November 2003, 02:57 AM   (permalink)
New Member
foosm is on a distinguished road
Default

i realsie the 16f877 had got built in USART capabilities...

now i wanna use the asyn. mode....mainly to transmit data out of my pic to a pc...here are my questions:

1. if i had loaded the data into the TXREG register, can i proceed to carry out other instructions? will the transmitting carry out in the background, or do i have to wait till the byte is transmitted b4 carrying on?

2. the pic16f877 has both transmit and receive pins....are they independent of each other?

3. i f i wanna interface to a pc serial port, is it necessary to setup handshaking ??

4. anyone can help me with C++ serial port prggramming ?? like wat functions are available??...i dun need the GUI... just running in MSDOS shell would be fine....

thanks again.
foosm is offline   Reply With Quote
Old 28th November 2003, 08:36 AM   (permalink)
Super Moderator
 
Nigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to behold
Default

Quote:
Originally Posted by foosm
i realsie the 16f877 had got built in USART capabilities...

now i wanna use the asyn. mode....mainly to transmit data out of my pic to a pc...here are my questions:

1. if i had loaded the data into the TXREG register, can i proceed to carry out other instructions? will the transmitting carry out in the background, or do i have to wait till the byte is transmitted b4 carrying on?

2. the pic16f877 has both transmit and receive pins....are they independent of each other?

3. i f i wanna interface to a pc serial port, is it necessary to setup handshaking ??

4. anyone can help me with C++ serial port prggramming ?? like wat functions are available??...i dun need the GUI... just running in MSDOS shell would be fine....

thanks again.
1. Yes you can carry on doing other things, once initiated the transmission of a byte is automatic.

2. As far as I know yes, you can use either or both.

3. Handshaking is completely optional, only needed is you are sending large quantities of data very fast - in which case you need to pause the transmitter while the receiving end catches up. If you are writing both ends of the link it's no problem at all, simply send the data in smallish packets - initiated by the receive end.

4. No idea, I don't use C or C++ - if you want Turbo Pascal serial port help, I'm your man!.
Nigel Goodwin is offline   Reply With Quote
Old 28th November 2003, 12:15 PM   (permalink)
New Member
foosm is on a distinguished road
Default

hi all, can i just connect my PIC pins to the serial port directly ??? is the voltage levels compatiable ??

if i can connect them directly, do i connect my TX (PIC) to RX (PC) and RX (PIC) to TX (PC).... and lastly, the GND(PC) to a common gnd with the PIC ??

thanks
foosm is offline   Reply With Quote
Old 28th November 2003, 01:33 PM   (permalink)
Super Moderator
 
Nigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to behold
Default

Quote:
Originally Posted by foosm
hi all, can i just connect my PIC pins to the serial port directly ??? is the voltage levels compatiable ??

if i can connect them directly, do i connect my TX (PIC) to RX (PC) and RX (PIC) to TX (PC).... and lastly, the GND(PC) to a common gnd with the PIC ??

thanks
No, you can't connect them directly - a PIC works at 0-5V and RS232 works at +/-12V. If you consult my tutorial link I posted earlier it gives examples of both hardware and software for PIC to RS232.

A MAX232 is a common chip used to convert from RS232 (and is the one used in my tutorial), but you can do it crudely with a couple of resistors, this is how the BASIC Stamp does it!.
Nigel Goodwin is offline   Reply With Quote
Old 29th November 2003, 03:01 AM   (permalink)
Experienced Member
 
ivancho is on a distinguished road
Default

Although the RS232 levels are different fromt he 0-5V level that the PIC uses you can connect the PIC to the serial port. One thing is that the connection might not be standard, for debugin purposes is perfect.

The lenght of the cable can't be too long, the longest I have used is about 5-6 feet. No trouble what so ever. The highest baudrate I have used is 19200.

Your connection should have a limiting resistor, a 2.2K will be good... I normally just connected straight, without any trouble.

It works because of the clampind diodes of the PIC, that allows to read the -12v to +12V swing. The serial port even in my 486 laptop recognize the 5-0V levels.... one thing to have in mind to send serially with the PIC connected to the PC you have to send the data inverted..... if you use a MAX232 you send the data no-inverted (true mode).

Ivancho
ivancho is offline   Reply With Quote
Old 11th May 2008, 07:18 AM   (permalink)
New Member
271zmeihc is an unknown quantity at this point
Default

MAX232 or DS275: Translates RS-232 signal levels to common CMOS/TTL levels. Can it translate CMOS/TTL into RS-232?
271zmeihc is offline   Reply With Quote
Old 11th May 2008, 07:24 AM   (permalink)
New Member
271zmeihc is an unknown quantity at this point
Default

Do we need specific software to extract or copy information from the PIC?
271zmeihc is offline   Reply With Quote
Old 12th May 2008, 10:46 AM   (permalink)
New Member
BronzeG3 is on a distinguished road
Default

The MAX232 and the DS275 go both ways. One set of pins will go from RS232->TTL and another set will go from TTL-> RS232.

As for software to capture serial information, I like using Real Term http://realterm.sourceforge.net/. It looks complex but you can ignore 80% of the settings.
BronzeG3 is offline   Reply With Quote
Old 15th May 2008, 11:23 AM   (permalink)
New Member
271zmeihc is an unknown quantity at this point
Default

Thanks. Anyway, can I use USB instead of serial transfer?
271zmeihc is offline   Reply With Quote
Old 15th May 2008, 12:15 PM   (permalink)
Experienced Member
petrv will become famous soon enough
Default

Yes you can use USB if (a few possibilities, choose one) :

a) use USB to RS-232 adapter.
b) use USB to RS-232 chip (like the one from FTDI)

c) use a PIC micro with USB support (PIC18F2455, PIC18F4550 .... etc)

Petr
petrv is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 05:59 AM.


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