View previous topic :: View next topic |
Author |
Message |
tkidder
Joined: 19 Feb 2005 Posts: 11 Location: new york usa
|
testing a bit in a byte array |
Posted: Fri Jul 27, 2007 1:20 pm |
|
|
I am working on an industrial application using 18f4520. On every encoder pulse a bit is shifted into an array of 500 8bit integers, either a 1 indicating an error or a 0 indicating no error. On each pulse i check if a bit is set at a particular bit position in a byte
int8 sr[500] ;
if(!GError)
{
shift_right(sr,500,0);
else
shift_right(sr,500,1);
}
if(bit_test (sr[BytePos],BitPos)==1)
{
output_high(Kick);
}
The problem seems to be in the bit_test. The manual says you can only use bit_test on a variable. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 27, 2007 1:57 pm |
|
|
1. Post a more complete test program, where you show all the variable
declarations and all #define statements. In other words, make it be
a compilable test program.
2. Post whatever error message you're getting from the compiler.
3. Post your compiler version. |
|
![](templates/subSilver/images/spacer.gif) |
|