View previous topic :: View next topic |
Author |
Message |
Rianna Guest
|
P!C16F688 EUSART |
Posted: Tue Sep 21, 2004 4:04 pm |
|
|
Hello
I have tried using #use rs232 (<options>) with the 16F688 and it did not work. I had to explicitly set/clear bits of registers to make it work. Of course then, I had to write my own putc and getc functions. Has anyone successfully used #use rs232 in PIC16F688? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 21, 2004 4:10 pm |
|
|
What version of the PCM compiler do you have ? |
|
|
Rianna Guest
|
|
Posted: Tue Sep 21, 2004 4:28 pm |
|
|
PCM programmer wrote: | What version of the PCM compiler do you have ? |
How do I find out? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 21, 2004 4:41 pm |
|
|
Compile a small test program and then load the .LST file into
the MPLAB editor. The compiler version will be at the top
of the file. It will be a number like this: 3.211
For example, if you compile a source file called TEST.C,
then the list file will have the name TEST.LST. |
|
|
Rianna Guest
|
|
Posted: Tue Sep 21, 2004 4:45 pm |
|
|
PCM programmer wrote: | Compile a small test program and then load the .LST file into
the MPLAB editor. The compiler version will be at the top
of the file. It will be a number like this: 3.211
For example, if you compile a source file called TEST.C,
then the list file will have the name TEST.LST. |
Thanks, it's 3.200. Now that I am trying to test again how it was not working, I used #use rs232(<options>) and putc() is not recognized according to the compiler. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 21, 2004 5:01 pm |
|
|
I installed PCM vs. 3.200 and compiled the test program shown below.
It compiled without error. However, vs. 3.200 does not recognize
that the 16F688 has a hardware USART on pins C4 and C5. It creates
a software UART for those pins. I don't have a 16F688 chip to test,
so I don't know if the software UART code actually works.
I installed vs. 3.211 (the latest version), and re-compiled the program.
Now it generates proper code for a hardware UART on those pins.
So, if you have PCW or PCWH, you could use the Device Editor to
edit the device data for the 16F688 and fix the problem.
If you only have the plain PCM compiler, then I suggest that you email
CCS and ask for a 1-day extension of your download rights, so you
can get a working version of the compiler for your PIC. CCS will
often do this.
Code: | #include <16F688.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C4, rcv=PIN_C5, ERRORS)
//==================
void main()
{
putc(0x55);
while(1);
} |
|
|
|
Rianna Guest
|
|
Posted: Tue Sep 21, 2004 5:12 pm |
|
|
I will do that. I'll keep this thread posted as to what happens when I get the newer version. Thank you very much. |
|
|
|