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 support@ccsinfo.com

testing a bit in a byte array

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



Joined: 19 Feb 2005
Posts: 11
Location: new york usa

View user's profile Send private message

testing a bit in a byte array
PostPosted: Fri Jul 27, 2007 1:20 pm     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 27, 2007 1:57 pm     Reply with quote

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.
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