Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • PINA = rather than PINA |=. I'm not 100% certain what will happen with the SBI that PINA |= expr appears to be generating; but it if actually behaves as PINA = PINA | expr it is trying to toggle port pins in part based on the current read value of the port. In any case, PINA = is sufficient and winds up generating an OUT which is 1 cycle compared to SBI's two cycles. It's peanuts. But then they are going for speed. Commented Jan 14, 2023 at 14:20
  • @timemage: You are right, PINA = is faster here. sbi is safe, as it is a real bitwise access, not a bytewise read-modify-write. PINA |=, on the other hand, is only safe when you know PINA lives in the bit-addressable part of the I/O space. Commented Jan 14, 2023 at 15:42
  • I suspected that about sbi simply because it would be much less useful otherwise. Re. I/O space: Yeah I didn't spell it out, but PINH/PINJ/PINK/PINL (curiously no PINI; perhaps it looks too much like a 1) all result lds,ori,sts Commented Jan 14, 2023 at 16:16