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

12f509 and RS232 problems

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



Joined: 15 Oct 2010
Posts: 1

View user's profile Send private message

12f509 and RS232 problems
PostPosted: Fri Oct 15, 2010 1:44 pm     Reply with quote

I am using a PIC 12f509 to communicate with RS232 with a PC and a VMUSIC2 mp3 device. The PIC is connected to the PC via a Max232 and connected to the VMUSIC2 directly. The problem is that the PIC sends correctly using putc. The messages appear correctly in HyperTerminal and the mp3 player responds to commands to play. The problem is when data is sent to the PIC (getc). I use a getc and then a putc to echo data to the PC. I only get every other character when HyperTerminal sends data to the PIC and the data coming from the VMUSIC is just garbage. I thought the serial settings might be wrong but then I would think sending data wouldn't work. The PIC is definitely receiving something. Just not what I expect to see.

Any ideas?

Thanks,
Bob
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 15, 2010 2:04 pm     Reply with quote

The 12F509 has no hardware UART. All UARTs will therefore be software
UARTs. The #use rs232() library code uses polling and delay loops to
read in the bits in an incoming byte. It uses bit-banging and delay loops
to transmit the bits in an outgoing byte. Each process, Rx or Tx, takes
100% of the PICs time. You can only do one thing (Rx or Tx) at a time,
not both. Neither process can be interrupted without wrecking the bit
timing.

CCS uses Method #3 to make their software UART code, as described
in this link:
http://www.8052.com/faqs.phtml?FAQ=124758
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