...

반응형

ATMEGA128을 이용해서 키입력을 받아봤어요

 

http://magicom9.tistory.com/52

 

여기 자료를 참고 해서 만들었어요 여기 말고도 여러곳 참고하긴 했는데 주소를 다 까먹었네요^^;

 

여기 자료대로 하면 되지만 회로도가 없어서 직접 그린 회로도를 첨부할께요 참고하세요

 

그리고 위의 자료에서 잘못된 부분이 하나 있네요

 

usbconfig.h 파일안의

 

#define USB_CFG_IOPORTNAME      D
/* This is the port where the USB bus is connected. When you configure it to
 * "B", the registers PORTB, PINB and DDRB will be used.
 */
#define USB_CFG_DMINUS_BIT      2
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
 * This may be any bit in the port.
 */
#define USB_CFG_DPLUS_BIT       0
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
 * This may be any bit in the port. Please note that D+ must also be connected
 * to interrupt pin INT0!

 

이 부분을

 

#define USB_CFG_IOPORTNAME      D
/* This is the port where the USB bus is connected. When you configure it to
 * "B", the registers PORTB, PINB and DDRB will be used.
 */
#define USB_CFG_DMINUS_BIT      0
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
 * This may be any bit in the port.
 */
#define USB_CFG_DPLUS_BIT       2
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
 * This may be any bit in the port. Please note that D+ must also be connected
 * to interrupt pin INT0!

 

로 바꾸면 됩니다 아니면 연결을 바꿔도 되고요

 

위의 사이트에서 받은 파일을 컴파일 할때 헤더파일을 포함해서 전부를 포함해서 컴파일 해야 됩니다.

 

혹시나 컴파일시 에러가 나면 안될거에요 무조건 에러가 안나야 되요

 

저도 처음엔 똑같이 해도 에러가 나더니 어떻게 하다보니 에러가 안나고 잘되더라고요

 

혹시 모르니 폴더 이름을 한글로 하지마세요 왠지 그게 원인이 되기도 하는거 같아요

 

키 설정은 KeyAssign.h, keycodes.h 를 수정하시면 됩니다

 

그리고 드라이버는 자동으로 깔리는데 혹시 안깔린다면 뭔가 잘못된걸꺼에요

 

 

 

전원은 USB 전원으로 사용이 가능하더라고요 따로 전원을 줄 필요는 없습니다

 

 

아 그리고 회로도의 키패드는 맘대로 연결한거라 순서가 바뀔수도 있으니 바꼈다면 소스에서 수정하시는게 빠를거에요^^

 

 

 

 

 

USB 연결한 부분에 자꾸 떨어질라 해서 테이프로 붙였습니다.

 

반응형

'Embeded > ATMEGA128' 카테고리의 다른 글

ATMEGA128로 Micro SD 카드 초기화  (0) 2013.07.15
ATMEGA128로 TFT LCD 제어하기  (10) 2012.09.08