Is the example screwed up or is it me?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm never sure. I've attached a short tutorial on bit manipulation. If you search on PINB4, you will find some talk about using a 1 position left shift as a shortcut. I think that the example is completely hosed, but that's just me. If someone has 30 to 60 seconds to read that small section I would appreciate it.

 

Thanks,

 

hj

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, this is wrong

 

 // set PINB4 to output in DDRB 
 DDRB |= 0b00000001;

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would very much doubt tutorials that advocate the use of 0b in the first place. Try setting bit 5 and 3njoy counting those 0s!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

They need to mention that initialization should generally use  = , not  oring  & anding to set the registers.   Use those, only if something needs changed mid-stream.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!