View previous topic :: View next topic |
Author |
Message |
kideltn
Joined: 08 Jun 2010 Posts: 13
|
Problem with can't send data from PC to PIC 18f4550... |
Posted: Sun Jun 27, 2010 11:39 am |
|
|
Hello every one!
Now i have a project with Pic 18f4550 and involved with RS232 interface
Problem is i just can tranfer data from PIC to PC but the contrary isn't.
Because pin RC7 is used for other purpuse so i used 2 pin RD0 and RD1 for rs232.
My connection RS232 schematic:
My code debug RS232:
Code: | #use rs232(baud=9600,parity=N,xmit=PIN_D0,rcv=PIN_D1,BITS =8,stream=GPS,ERRORS)
while(1){
printf("TEST 232");//display OK
data =getc();//wasn't worked ? (the Hyper terminal)
fputc(data,GPS);
}
|
Please help me fix this mistake !
I expect will receive many helping.Thanks very much ! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
jbmiller
Joined: 07 Oct 2006 Posts: 73 Location: Greensville,Ontario
|
|
Posted: Sun Jun 27, 2010 2:58 pm |
|
|
Man I'd love to meet the guy who decided to swap the xmt and rcv pins when the DE-9 connector came out. I'm 'old school' and Pin Two is for Transmit , pin thrEe is for recEive..
WHY 'they' changed the standard is beyond me....
Oh well.... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jun 27, 2010 3:50 pm |
|
|
It's designed to work with a "straight through" cable (The cable is wired
with pin 1 to pin 1, pin 2 to pin 2, etc.). That way, when you connect
a DTE (PC side) to a DCE (PIC board), the Tx on the PIC goes to the Rx
on the PC, etc. |
|
|
kideltn
Joined: 08 Jun 2010 Posts: 13
|
|
Posted: Sun Jun 27, 2010 6:00 pm |
|
|
Thanks you again ! |
|
|
|