View previous topic :: View next topic |
Author |
Message |
Emm386exe
Joined: 17 May 2005 Posts: 3
|
Giving a value into a table (PIC16LF877A) |
Posted: Wed Jun 08, 2005 6:52 am |
|
|
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
|
|
Posted: Wed Jun 08, 2005 6:59 am |
|
|
Have you tried ? _________________ 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
|
|
Posted: Wed Jun 08, 2005 7:01 am |
|
|
rwyoung wrote: | Have you tried ? |
Yes it is included in my code. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jun 08, 2005 12:17 pm |
|
|
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. |
|
|
|