Jump to content

Recommended Posts

Hi All:

this simple code doesn't works with 16F84A at 20 MHz:

 

************************************************

 

#include

 

char A;

 

main()

{

disable_interrupt( GIE );

trisb = 0;

portb = 0;

A=01010101b;

 

 

while (1)

   {

      A = A:D

Link to post
Share on other sites
Guest Pavel
      A = A<<1;

From your post it looks like you assume that the << operation is circular. But that's not the case in C. After 8 loop cycles A becomes 0 and stays 0 forever.

 

Regards,

Pavel

Link to post
Share on other sites
  • 2 weeks later...
Guest ismael

what about change a little bit the code for this...

 

#include

 

char A;

 

main()

{

disable_interrupt( GIE );

trisb = 0;

portb = 0;

//A=01010101b;

 

 

while (1)

  {

     A = 01010101b;

     portb=A;

     A = 10101010b;

  }

}

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...
×
×
  • Create New...