View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 10, 2012 7:34 pm |
|
|
The PIC data sheet says you have to set the APFCON0 bits to 1,
in order to select the alternate pins. I did that and it works:
Code: |
#include <16F1824.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PLL_SW, NOLVP
#use delay(clock=4M)
#use rs232(baud=9600, UART1, ERRORS)
#byte APFCON0 = getenv("SFR:APFCON0")
#bit TXSEL = APFCON0.2
#bit RXSEL = APFCON0.7
#int_RDA
void RDA_isr(void)
{
char c;
c = getc();
putc(c);
}
//========================================
void main()
{
TXSEL = 1;
RXSEL = 1;
clear_interrupt(INT_RDA);
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
while(1);
} |
|
|
|
Beowulf
Joined: 10 Feb 2012 Posts: 7 Location: washington
|
|
Posted: Fri Feb 10, 2012 8:53 pm |
|
|
just updated to the 4.129 software version.
this no longer appears in the LST file in the default case(tx=C4,rx=C5)
Code: |
0056: MOVLB 02
0057: BSF 1D.2
0058: BSF 1D.7
|
I am no longer at my work bench ...so I can't load this onto the PIC to be sure...but It seems as though the 4.128 version has a bug when compiling for this processor. If I have time this weekend I will try this out to see if it works on the PIC. |
|
|
Beowulf
Joined: 10 Feb 2012 Posts: 7 Location: washington
|
(Solved) |
Posted: Mon Feb 13, 2012 9:15 am |
|
|
I listed my compiler version incorrectly in the problem statement. The version that has this issue is:
Code: |
CCS PCM C Compiler, Version 4.124
|
I am convinced that this was a compiler bug. I upgraded to 4.129 and the problem has gone away. Th tx/rx pins are correctly assigned now and the interrupts occur as expected.
**always check for updates** |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19529
|
Re: (Solved) |
Posted: Mon Feb 13, 2012 9:23 am |
|
|
Beowulf wrote: | I listed my compiler version incorrectly in the problem statement. The version that has this issue is:
Code: |
CCS PCM C Compiler, Version 4.124
|
I am convinced that this was a compiler bug. I upgraded to 4.129 and the problem has gone away. Th tx/rx pins are correctly assigned now and the interrupts occur as expected.
**always check for updates** |
No!.
Not if the compiler works for what you want.....
Key here is that the 1824 is a pretty new chip, and it always seems to take CCS perhaps a dozen versions to get these working.
However CCS's 'updates', generally are not reliable till they have been tested for a while, so rule has to be 'check for updates _if_ you have something not working right'. Otherwise you may well be asking for problems.....
Best Wishes |
|
|
Beowulf
Joined: 10 Feb 2012 Posts: 7 Location: washington
|
|
Posted: Mon Feb 13, 2012 11:27 am |
|
|
you are correct....updates are only useful when there is an actual problem to solve... |
|
|
|