안녕하세요!easyPic v7 마이크로 컨트롤러와 초음파 센서 hc-sr04 인터페이스 방법
사람 카운터를 만들기 위해 PIC18F45K22 칩과 함께 microicroller easyPic v7과 초음파 센서를 연결하는 방법에 대한 아이디어가있는 사람이 있습니까?
// Lcd module connections
sbit LCD_RS at LATB4_bit;
sbit LCD_EN at LATB5_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
void main()
{
int a;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,5,"ITCE444");
Lcd_Out(2,3,"Term Project");
Delay_ms(3000);
Lcd_Cmd(_LCD_CLEAR);
TRISA.RA0 = 0; //RB0 as Input PIN (TRG)
TRISA.RA4 = 0; //RB4 as Input PIN (ECHO)
while(1)
{
if(PORTA.RA4==1 && PORTA.RA0==1)
{
a = a + 1;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Person in: ");
Lcd_Out(1,12,a);
Lcd_Out(1,15,"Person");
}
else
{
a = a - 1;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Person out: ");
Lcd_Out(1,13,a);
}
Delay_ms(400);
}
}
감사와 관련하여 ..
어떤 도움을주세요 .... –