Jump to content
Sign in to follow this  
gviaud

16Bit Variable bug?

Recommended Posts

The following code snip generates an odd happening

 

short TargetLight = 10;

char trash = 0;

 

if (Target_Light < 11)

{

PORTA = Flash_Num;

delay_us(2);

delay_us(2);

delay_us(2);

for (trash = 0; trash < Target_Light; trash++)

{

delay_us(1);

}

PORTA = 0; // quench flash!

Send_Val(Target_Light);

}

 

The code in the main IF block onlt gets called if Target_Light is less than 10.. odd...  Is this a problem with 16bit variables when IFed with literals?

 

Help!

 

Also had some odd timing issues with delay_us but I will save this for when I have more time to see what is going wrong on my scope...

 

Target is SX28 @50MHz

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×