Another way of toggling a PORT bit: tgl_bit: sbis PORTC, BIT rjmp sbi_bit clr_bit: cbi PORTC, BIT ret set_bit: sbi PORTC, BIT ret Mark On 12 Jun 2005 at 1:58, Roy E. Burrage wrote: > > I often have to toggle a bit and this is about as short and elegant as I've been > able to do with the AVR. > > > Toggle_A1: ; Toggles PB0 (A1) output state > LDI T1,1 ; Set bit 0 in T1 > IN T2,PORTB > EOR T2,T1 ; XOR T1 and Port B (T2) to toggle PB0 > OUT PORTB,T2 > RET > > This routine is called from the main program and could be performed a couple of > other ways, but not anything shorter that I can see. > > With the 8x31/32 series we had the CPL operation. With the er, uh, those other > guys...we have BTG. > > Anyone know of a shorter means, code wise, of doing this? Am I missing > something, like a single operation? > > > REB > > > Yahoo! Groups Links > * To visit your group on the web, go to: > http://groups.yahoo.com/group/AVR-Chat/ > > * To unsubscribe from this group, send an email to: > AVR-Chat-unsubscribe@yahoogroups.com > > * Your use of Yahoo! Groups is subject to the Yahoo! > Terms of Service. >
Message
Re: [AVR-Chat] Bit logic...
2005-06-12 by Mark Jordan
Attachments
- No local attachments were found for this message.