coding을 하다 보면 PORT의 bit 단위로 제어가 필요한 경우가 있지요..
WinAVR환경에서는 compat/deprecated.h을 Include해 줌으로써 sbi와 cbi 함수를 사용할 수 있습니다.
sbi(PORTx, bit) // set the PORTX.bit
ex) sbi(PORTD, 0) // set the PORTD.0 = 1 ==> PORTD = 0x01
cbi(PORTx, bit) // clear the PORTX.bit
ex) cbi(PORTD, 0) // clear the PORTD.0 = 0 ==> PORTD = 0x00
ex) sbi(PORTD, 0) // set the PORTD.0 = 1 ==> PORTD = 0x01
cbi(PORTx, bit) // clear the PORTX.bit
ex) cbi(PORTD, 0) // clear the PORTD.0 = 0 ==> PORTD = 0x00
'Embedded' 카테고리의 다른 글
ATmega128간의 TWI 통신기능 구현하자 - 마스터 송신모드(Master Transmitter Mode) (Posted by H2K) (2) | 2010.07.12 |
---|---|
ATmega128간의 TWI 통신기능 구현하자 - TWI 단계별 동작 (Posted by H2K) (0) | 2010.07.09 |
ATmega128간의 TWI통신기능 구현하자 - TWI 관련 레지스터(TWCR, TWSR, TWDR, TWAR 등) (Posted by H2K) (1) | 2010.07.09 |
ATmega128 datasheet 다운로드 (0) | 2010.06.29 |
AVR(Alf Vergard Risc) 너는 무엇이냐? (0) | 2010.05.15 |