ATMEGA128 의 avr studio의 코드를 code vision으로 바꾸고 싶습니다.
페이지 정보
작성자 mental 작성일19-05-28 14:26 조회5,157회 댓글1건본문
/* | |
* PIR sensor with Atmega128.c | |
* | |
* Created: 15-Apr-16 3:26:31 PM | |
* Author : exploreembedded | |
*/ | |
#include <avr/io.h> | |
#include "lcd.h" | |
#define PIR_sensor PA0 | |
unsigned int PIR_Status = 0; | |
int main() | |
{ | |
DDRA = (0 << PIR_sensor); // Configure PORTA as INput to connect switches | |
/*Connect RS->PB0, RW->PB1, EN->PB2 and data bus to PORTC.4 to PORTC.7*/ | |
while(1) | |
{ | |
while(((PINA) & (1<<PIR_sensor)) == 1) | |
{ | |
LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PC_4,PC_5,PC_6,PC_7); | |
LCD_Init(2,16); | |
LCD_DisplayString("Motion Detected!"); | |
} | |
LCD_Clear(); | |
while(((PINA) & (1<<PIR_sensor)) == 0) | |
{ | |
LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PC_4,PC_5,PC_6,PC_7); | |
LCD_Init(2,16); | |
LCD_DisplayString("Motion Ended!"); | |
} | |
LCD_Clear(); | |
} | |
return (0); | |
} |
댓글 : 1
조회수 : 5,157
master님의 댓글
master 작성일
#include "lcd.h"
헤더파일의 양이 많아서 손이 더 많이 갈텐데
헤더파일을 올리지 않은 것은 스스로 할 수 있다는 말인가봅니다.
//
#include <io.h> // #include <avr/io.h>
또는 #include < mega128.h>
//
void main() // int main()
//
// return (0); // 삭제
//
대충 눈에 띄는 것은 3 라인만 수정하면 되겠습니다.