'porta'에 해당되는 글 1건

  1. 2011.03.31 AVR - PINA / PORTA / DDRA 2
embeded/AVR (ATmega,ATtiny)2011. 3. 31. 09:37
아래는 winavr의 iom64.h의 내용중 일부이다
/* Input Pins, Port A */
#define PINA      _SFR_IO8(0x19)

/* Data Direction Register, Port A */
#define DDRA      _SFR_IO8(0x1A)

/* Data Register, Port A */
#define PORTA     _SFR_IO8(0x1B)

정리하자면
PINA는 입력된 값을 읽고
PORTA는 출력할 값을 읽고
DDRA는 그 포트의 방향을 정해준다.

예를들어, UART 같은 경우
TX 값은 PORTA에 쓰고, RX값은 PINA에서 읽는 식이라고 하면 되려나?
Pin* is for read, Port* is for write and DDR* is for direction... 
* = Register ( A, D,C...) 

PIN* is the register you use to read the value on a port if it is an input (so if the corresponding bit in DDR* is '0'). PORT* is used to output values, or to read earlier outputted values back.
 
[링크 : http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=197070]
 


Posted by 구차니