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
Posted: Fri Oct 15, 2010 2:04 pm
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.
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