View previous topic :: View next topic |
Author |
Message |
dpmohne
Joined: 27 May 2004 Posts: 9
|
16f88 and Recieve Data Available Interupt |
Posted: Thu May 27, 2004 4:48 pm |
|
|
I am attempting to use the Recieve Data Available interupt on an 16f88 with the following code. The RDA_isr() is not being entered as far as I can tell.
Code: |
#include <16F88.h>
#use delay(clock=20000000)
#fuses HS, NOLVP, NOWDT
#use rs232(baud=9600,parity=N,xmit=PIN_B5,rcv=PIN_B2,bits=8,errors)
#int_RDA
RDA_isr()
{
output_high(PIN_B0);
printf("%c",getc();
output_low(PIN_B0);
}
void main()
{
setup_adc_ports(VSS_VDD);
setup_adc(ADC_CLOCK_INTERNAL);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,WDT_18MS);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RDA);
enable_interrupts(global);
while(true)
{
}
}
|
I have been I know the recieve is working, because if I move the printf() to the while loop I get a character echo.
Any Suggestions?
Thanks
Duane |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu May 27, 2004 5:15 pm |
|
|
What is your version of the compiler ?
The Devices.dat file for some versions did not properly
define the existence of the hardware USART in the 16F88. |
|
|
dpmohne
Joined: 27 May 2004 Posts: 9
|
|
Posted: Thu May 27, 2004 5:20 pm |
|
|
We are using version 3.174 of the compiler which definitely has the error. I edited the chip in chipedit and the problem is corrected.
Duane
Last edited by dpmohne on Thu May 27, 2004 5:36 pm; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu May 27, 2004 5:35 pm |
|
|
I installed PCM vs. 3.174, and compiled a small test program
for the 16F88. The compiler does not produce code for a
hardware USART with that version. It creates code for a
software USART instead.
I then installed PCM vs. 3.191, and tested it. It works.
Code for a hardware USART is created.
So the Devices.dat file is probably incorrect for your version.
You could email CCS support and ask them to send you a
corrected Devices.dat file. Tell them your compiler version.
Maybe they will send you one. |
|
|
Guest Guest
|
|
Posted: Thu May 27, 2004 10:46 pm |
|
|
for 16F88 with 3.173, a simple fix for USART is
#use rs232( ... xmit=PIN_C6, rcv=PIN_C7 ...
then it will come out at PIN_B5 and PIN_B2,
I hope it also work for your 3.174
have fun ! |
|
|
prwatCCS
Joined: 10 Dec 2003 Posts: 70 Location: West Sussex, UK
|
|
Posted: Fri May 28, 2004 1:54 am |
|
|
I would also advise against placing printf statements inside interrupt handlers. They can take a lot of time and may result in loss of character reception. _________________ Peter Willis
Development Director
Howard Eaton Lighting Ltd UK |
|
|
dpmohne
Joined: 27 May 2004 Posts: 9
|
|
Posted: Fri May 28, 2004 5:18 am |
|
|
prwatCCS wrote: | I would also advise against placing printf statements inside interrupt handlers. They can take a lot of time and may result in loss of character reception. |
Very true, I was just trying to demonstrate a problem that I had broken out from the main codebase and was working on.
Thanks,
Duane |
|
|
dpmohne
Joined: 27 May 2004 Posts: 9
|
|
Posted: Fri May 28, 2004 5:19 am |
|
|
Guest wrote: | for 16F88 with 3.173, a simple fix for USART is
#use rs232( ... xmit=PIN_C6, rcv=PIN_C7 ...
then it will come out at PIN_B5 and PIN_B2,
I hope it also work for your 3.174
have fun ! |
I could do that, but why when I have chipedit to fix problems like this.
Thanks,
Duane |
|
|
Guest Guest
|
|
Posted: Fri May 28, 2004 9:54 pm |
|
|
dpmohne wrote: | Guest wrote: | for 16F88 with 3.173, a simple fix for USART is
#use rs232( ... xmit=PIN_C6, rcv=PIN_C7 ...
then it will come out at PIN_B5 and PIN_B2,
I hope it also work for your 3.174
have fun ! |
I could do that, but why when I have chipedit to fix problems like this.
Thanks,
Duane |
"chipedit" is better.
Using C6, C7 is just another way to play with CCS back to the time I didn't know how to use chipedit.
Cheers |
|
|
|