CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

16f88 and Recieve Data Available Interupt

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dpmohne



Joined: 27 May 2004
Posts: 9

View user's profile Send private message MSN Messenger

16f88 and Recieve Data Available Interupt
PostPosted: Thu May 27, 2004 4:48 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu May 27, 2004 5:15 pm     Reply with quote

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

View user's profile Send private message MSN Messenger

PostPosted: Thu May 27, 2004 5:20 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu May 27, 2004 5:35 pm     Reply with quote

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







PostPosted: Thu May 27, 2004 10:46 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri May 28, 2004 1:54 am     Reply with quote

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

View user's profile Send private message MSN Messenger

PostPosted: Fri May 28, 2004 5:18 am     Reply with quote

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

View user's profile Send private message MSN Messenger

PostPosted: Fri May 28, 2004 5:19 am     Reply with quote

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







PostPosted: Fri May 28, 2004 9:54 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group