Jump to content

Recommended Posts

Hi All,

 

This is a part of an A to D conversion routine:

 

     bsf    ADCON0,2

loop btfsc ADCON0,2

     Goto  loop

 

How can I rewrite this in C  I tried with a while loop but it did not work

 

Thanks in advance

Koen

Share this post


Link to post
Share on other sites
Guest Pavel
     bsf    ADCON0,2

loop btfsc ADCON0,2

      Goto  loop

 

How can I rewrite this in C  I tried with a while loop but it did not work

A good question. This code will do what you want:

 

adcon0 |= 4;
while( adcon0&4 );

 

but the compiler doesn't optimize the generated assembly much. I will try to fix this by the next compiler release.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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  

×
×
  • Create New...