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

interrupt behaviour / compiler versions?

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



Joined: 13 May 2006
Posts: 1

View user's profile Send private message

interrupt behaviour / compiler versions?
PostPosted: Sat May 13, 2006 3:55 pm     Reply with quote

I have the linux compiler for PIC16.
The serial echoback below functions
if compiled with ccsc version 3.112
If I use 3.249, the pic seems not to
hear me and huh?


-------------- cut here -------

#include <16f877.h>
#use delay (clock=20000000)
#use rs232 (baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7)
#fuses HS,NOWDT,NOPROTECT,NOLVP


#define ringsize 16
int ringbuffer[ringsize];
int ringR = 0;
int ringW = 0;


#int_rda
void receive()
{
// b1 drives a LED.

if (ringW & 1) output_high (pin_b1); else output_low (pin_b1);

ringbuffer[ringW] = getchar();
ringW++;
//ringW %= ringsize;
if (ringW >= ringsize) ringW = 0;
}


void main(void)
{
int j;

printf ("\r\nPower\r\n");

enable_interrupts (INT_RDA);
enable_interrupts (GLOBAL);

for (;;) {

while (ringR != ringW) {
j = ringbuffer[ringR];
ringR++;
// ringR %= ringsize;
if (ringR >= ringsize) ringR = 0;

putchar (j);
} // end while

} // end for (;;)

} // end main()


----------------- end ----------------
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat May 13, 2006 10:47 pm     Reply with quote

I compiled your program with the Windows version of PCM 3.249 and
and ran it on a PicDem2-Plus board. It worked OK. I typed keys in
a terminal window and the LED changed state on each keypress, and
it echoed back the characters. The only things I changed were the
frequency and fuse. I changed them to 4 MHz and XT, to fit my board.

You're using vs. 3.249 of the Linux version. I don't have that. I suggest
that you compile with both 3.112 and 3.249 and compare the .LST
files. There will probably be several differences in the library code
and the start-up code. Sometimes CCS changes the order of
the things they do in the start-up code. Also, at one point, they
changed from loading registers (such as ADCON1) with a byte,
to setting or clearing individual bits. These types of changes won't be
relevant to your problem. You need to find a change that's causing
the problem.
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