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

shift right problems

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



Joined: 07 Feb 2008
Posts: 167

View user's profile Send private message

shift right problems
PostPosted: Thu Feb 07, 2008 9:21 am     Reply with quote

Hi: any help is appreciated, seems so simple, but shift right doesn't seem to work. Compiler is 3.249 PCWH. Code follows

TestBitIn is confirmed to be a one. After shift_right Preamble_In still 0x00. Continued shift_rights -- Preamble_In still 0x00.

What's up?


HDLC_In()
{
int8 Preamble_In;
int8 Rx_Data; //holds shifted in rx data
int8 Index,BitPos,Ones_Count;
int1 Good_Preamble; //good preamble flag
int1 TestBitIn;


Preamble_In = 0x0000;
Good_Preamble = False;
Ones_Count= 0;
output_bit(Md_RxEn, 1);
TestBitIn = 0;
Wt_RxSync();

While (!Good_Preamble)
{
TestBitIn = input (Md_RxClDta);
shift_right (Preamble_In, 1, TestBitIn);
if (Preamble_In == MSK_Preamble) Good_Preamble = True;
else
Wt_RxSync(); }
}
Bob Sacamano



Joined: 17 Jan 2008
Posts: 16
Location: Somewhere Cold, USA

View user's profile Send private message

PostPosted: Thu Feb 07, 2008 9:40 am     Reply with quote

shift_right (address, bytes, value)

address is a location in RAM--a pointer to or address of a variable. You need:

Code:
shift_right (&Preamble_In, 1, TestBitIn);


Also, although in this case it wasn't a big deal with the small snippet of code, use the code button when posting code to keep the formatting. Also make sure the "Disable HTML in this post" checkbox is checked.
_________________
"And you want to be my latex salesman."
JerryR



Joined: 07 Feb 2008
Posts: 167

View user's profile Send private message

PostPosted: Thu Feb 07, 2008 10:19 am     Reply with quote

Bob:

Thanks for the quick reply. Yes, caught my mistake just after the initial post.

Thanks also for the steer on posting manners. Will keep that in mind.

All the best,
JerryR
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