48 lines
831 B
Plaintext
48 lines
831 B
Plaintext
/*
|
|
Progetto di irrigatore automatico comandato da microcontrollore.
|
|
Collegare un display LCD con controller HITACHI ai piedini:
|
|
|
|
RB0->D4
|
|
RB1->D5
|
|
RB2->D6
|
|
RB3->D7
|
|
RA2->LCD_RS
|
|
RA3->LCD_EN
|
|
|
|
quindi dei pulsanti ai piedini RB4öRB7 e il LMC1983CN ai pin RA0-RA1.
|
|
RA4 e RA5 restano a disposizione per eventuali collegamenti con un
|
|
orologio real time clock.
|
|
*/
|
|
|
|
#include <pic.h>
|
|
#include "delay.h"
|
|
#include "lcd.h"
|
|
#define RELE RB5
|
|
#define ON 1
|
|
#define OFF 0
|
|
|
|
__CONFIG(FOSC0|UNPROTECT);
|
|
|
|
void main(void)
|
|
{
|
|
OPTION=0x01;
|
|
TRISA=0x03;
|
|
TRISB=0xD0;
|
|
lcd_init();
|
|
lcd_goto(0x00);
|
|
lcd_puts("L'irrigatore 0.1");
|
|
lcd_goto(0x40);
|
|
lcd_puts("By Paolo");
|
|
RB5=0;
|
|
do {
|
|
if (RA1==0){
|
|
RELE=OFF;
|
|
DelayMs(250);
|
|
}
|
|
else if (RA4==0){
|
|
RELE=ON;
|
|
DelayMs(250);
|
|
};
|
|
} while (1);
|
|
}
|