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

Giving a value into a table (PIC16LF877A)

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



Joined: 17 May 2005
Posts: 3

View user's profile Send private message

Giving a value into a table (PIC16LF877A)
PostPosted: Wed Jun 08, 2005 6:52 am     Reply with quote

Hi everyone

I use a PIC 16LF877A with PCW Compiler 3.15 with a frequency clock of 7 372 800 Hz

I have difficulties on entering a value into a table. Sometimes the table return the right value but sometimes not, and I don't know why.

Here is my code :
Code:



if(audio)                     
{
   printf("count_data %d\n",count_test);
   countr_test++;
}
else if(!audio)
{
   count_test=0;
}
               
if(count_test==100)
{
   printf("\ncount_data %d\n",count_test);
   printf("BattLevel : %d\n",Battlevel);
   printf("Audio : %d\n",audio);
   if(audio==1)
   {
      tab_data[0]=BattLevel;           // problem : it works randomly
      printf("tab_data : %d\n",tab_data[0]);
      send_data(1,tab_data);
   }
   count_test=0;
}
...

it is written in an interruption (#int_timer1)

"tab_data" and "BattLevel" are defined as follow :
signed int8 tab_data[];
signed int8 BattLevel;

On the Serial Port Monitor we can read this :

...
count data 100
battlevel 81
audio 1
tab_data 0
data send 00
count data 0
count data 1
count data 2
...

All opinions will be appreciated.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 08, 2005 6:59 am     Reply with quote

Have you tried
Code:
#device *=16
?
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Emm386exe



Joined: 17 May 2005
Posts: 3

View user's profile Send private message

PostPosted: Wed Jun 08, 2005 7:01 am     Reply with quote

rwyoung wrote:
Have you tried
Code:
#device *=16
?


Yes it is included in my code.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 08, 2005 12:17 pm     Reply with quote

Can you make a small test program that shows the problem ?
Or does it only happen with a large program ?

If you can make a small one, then post it. In other words, post
a program with a main(), and show the full interrupt code, and all
#fuses, #use, #include statements.

Also post the exact version of your compiler. 3.15 is not a full version
number. Look at the top of your .LST file after you compile. It shows
the compiler version.
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