CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem with can't send data from PC to PIC 18f4550...

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kideltn



Joined: 08 Jun 2010
Posts: 13

View user's profile Send private message Yahoo Messenger

Problem with can't send data from PC to PIC 18f4550...
PostPosted: Sun Jun 27, 2010 11:39 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jun 27, 2010 2:14 pm     Reply with quote

The connections to your DB9 (connector P1) are not correct.
This thread has some links which show the correct connections:
http://www.ccsinfo.com/forum/viewtopic.php?t=32455

I Googled a little bit and found some more DB9 to Max232 schematics:
http://www.extremeelectronics.co.in/avrtutorials/images/rs232_sche.GIF
http://www.sparkfun.com/commerce/images/tutorials/BeginningEmbedded/4-UART/UART1.jpg
http://www.coolcircuit.com/circuit/rs232_driver/max232_small.gif
http://www.8051projects.net/e107_files/public/1208135039_5483_FT8010_circuit_232.jpg
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jun 27, 2010 2:58 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jun 27, 2010 3:50 pm     Reply with quote

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

View user's profile Send private message Yahoo Messenger

PostPosted: Sun Jun 27, 2010 6:00 pm     Reply with quote

Thanks you again !
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group