View previous topic :: View next topic |
Author |
Message |
leem
Joined: 16 Jan 2008 Posts: 7
|
16f688 uart problems still |
Posted: Wed Jan 16, 2008 10:13 pm |
|
|
Hello,
I have been trying to program a 16f688 with the hardware uart enabled however It doesn't seem to work. I have looked all over this forum and noticed a mention that v3.2 of the compiler was screwed up and did not work. My question is what version of the compiler did they finally fix this or haven't they. I have tried it in version 4.038 and it seems to not work. If I just use pins A4 and A5 for a software uart, that works.
Thanks. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 17, 2008 12:31 am |
|
|
Try the following simple test program. lt uses the hardware UART pins.
See if it works.
Code: |
#include <16F688.H>
#fuses INTRC_IO, NOWDT, NOBROWNOUT, PUT, NOMCLR
#use delay(clock=8000000)
#use rs232(baud=9600, xmit=PIN_C4, rcv=PIN_C5, ERRORS)
//===================================
void main()
{
printf("Hello World \n\r");
while(1);
} |
|
|
|
leem
Joined: 16 Jan 2008 Posts: 7
|
|
Posted: Thu Jan 17, 2008 8:33 pm |
|
|
Thanks PCM. That worked. I guess I should have actually programmed a pic before I posted. I was running the code in the oshonsoft Pic Simulator and it didn't display anything. I tried your example and it also didn't work in the simulator either, but works fine if I program a chip. hmmm 2nd possible bug I have found in that software.
Thanks again |
|
|
Gigalite Guest
|
|
Posted: Wed Dec 10, 2008 8:38 pm |
|
|
This code doesn't seem to work at a 20MHz oscillator. Is there a #FUSES missing? Have somebody worked with the 16f688 uart at 20MHz that can provide a working code? |
|
|
Ttelmah Guest
|
|
Posted: Thu Dec 11, 2008 3:19 am |
|
|
Some obvious ones:
1) Internal RC oscillator, 8MHz max. - need to use 'HS' for an external 20MHz crystal, instead of INTRC_IO.
2) Voltage. 4.5v _minimum_, for 20MHz operation, as against 3v, for 8MHz operation.
Best Wishes |
|
|
|