Ja imam ovaj fajl pisan u C programu i sad polako skapiravam sta je sta sad pokusavam da uparim izlaze sa pica na ulaze na lcd posto nisu isti na ovom mom instrumentu sa kesat net i sa ovog sto je ovaj c fajl , nisam prekopirao ceo fajl da nezauzima veliki prostor za pisanje samo pocetne detalje..
1. #define _XTAL_FREQ 4000000
2. // Lcd pinout settings
3. sbit LCD_RS at RB2_bit;
4. sbit LCD_EN at RB3_bit;
5. sbit LCD_D4 at RB4_bit;
6. sbit LCD_D5 at RB5_bit;
7. sbit LCD_D6 at RB6_bit;
8. sbit LCD_D7 at RB7_bit;
// Pin direction
sbit LCD_RS_Direction at TRISA3_bit;
sbit LCD_EN_Direction at TRISA2_bit;
sbit LCD_D4_Direction at TRISA1_bit;
sbit LCD_D5_Direction at TRISA0_bit;
sbit LCD_D6_Direction at TRISA7_bit;
sbit LCD_D7_Direction at TRISA6_bit;
// MAX_TIMECOUNT sets the number of loops after which the power is switched off
// one loop is aproximately 1.15 seconds long and the time period will be T = MAX_TIMECOUNT x 1.15
#define MAX_TIMECOUNT 208
int f1;
char PowerOFF_flag;
// inerrupt procedure
void interrupt() {
T0IF_bit = 0; // clear T0IF bit
f1++;
if (RBIF_bit) { // if there is change on PORTB
if (!PORTB.F5) // check if Power button is pressed
PowerOFF_flag = 1; // sets the PowerOFF_flag
RBIF_bit = 0; // clear the interrupt flag
}
1. #define _XTAL_FREQ 4000000
2. // Lcd pinout settings
3. sbit LCD_RS at RB2_bit;
4. sbit LCD_EN at RB3_bit;
5. sbit LCD_D4 at RB4_bit;
6. sbit LCD_D5 at RB5_bit;
7. sbit LCD_D6 at RB6_bit;
8. sbit LCD_D7 at RB7_bit;
// Pin direction
sbit LCD_RS_Direction at TRISA3_bit;
sbit LCD_EN_Direction at TRISA2_bit;
sbit LCD_D4_Direction at TRISA1_bit;
sbit LCD_D5_Direction at TRISA0_bit;
sbit LCD_D6_Direction at TRISA7_bit;
sbit LCD_D7_Direction at TRISA6_bit;
// MAX_TIMECOUNT sets the number of loops after which the power is switched off
// one loop is aproximately 1.15 seconds long and the time period will be T = MAX_TIMECOUNT x 1.15
#define MAX_TIMECOUNT 208
int f1;
char PowerOFF_flag;
// inerrupt procedure
void interrupt() {
T0IF_bit = 0; // clear T0IF bit
f1++;
if (RBIF_bit) { // if there is change on PORTB
if (!PORTB.F5) // check if Power button is pressed
PowerOFF_flag = 1; // sets the PowerOFF_flag
RBIF_bit = 0; // clear the interrupt flag
}