View previous topic :: View next topic |
Author |
Message |
JerryR
Joined: 07 Feb 2008 Posts: 167
|
shift right problems |
Posted: Thu Feb 07, 2008 9:21 am |
|
|
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
|
|
Posted: Thu Feb 07, 2008 9:40 am |
|
|
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
|
|
Posted: Thu Feb 07, 2008 10:19 am |
|
|
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 |
|
|
|