Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sbit LCD_RS at RA4_bit;
- sbit LCD_EN at RA5_bit;
- sbit LCD_D4 at RA0_bit;
- sbit LCD_D5 at RA1_bit;
- sbit LCD_D6 at RA2_bit;
- sbit LCD_D7 at RA3_bit;
- sbit LCD_RS_Direction at TRISA4_bit;
- sbit LCD_EN_Direction at TRISA5_bit;
- sbit LCD_D4_Direction at TRISA0_bit;
- sbit LCD_D5_Direction at TRISA1_bit;
- sbit LCD_D6_Direction at TRISA2_bit;
- sbit LCD_D7_Direction at TRISA3_bit;
- bit prikazuva;
- int counter; // broi do 3, odnosno bidejki 128 ni e preskaler, a brojacot ni broi 187 pati, 187 * 128 * 3 = 71808 ~~ 72k == 36ms
- void interrupt(){
- if (INTF_bit==1){
- prikazuva = !prikazuva;
- Lcd_Cmd(_LCD_CLEAR);
- if(prikazuva){
- Lcd_Out(1,1,"Kristijan");
- INTCON = INTCON | 0x20; // ovozmozi tajmerot
- counter = 0;
- }
- INTF_bit = 0;
- }
- if(TMR0IF_bit){
- TMR0 = 78; // broi 187 pati do overflow -- reset
- counter++;
- if(counter == 2) {
- Lcd_Out(2,1,"165025");
- INTF_bit = 0;
- INTCON= INTCON & 0xDF; // iskluci go tajmerot
- }
- TMR0IF_bit = 0;
- }
- }
- void main() {
- int cekori = 0;
- int povtoruvanja = 0;
- ANSEL = 0;
- ANSELH= 0;
- C1ON_bit = 0;
- C2ON_bit = 0;
- TRISA = 0;
- Lcd_Init();
- INTCON=0x90; // ovozmozi nadvoresen interrupt no ne i tajmer
- OPTION_REG = 0x86; // preskaler 1;128
- TMR0 = 78; // broi 187 pati do overflow
- PORTA.B4 = 0;
- PORTA.B5 = 1;
- while(1){
- }
- }
Add Comment
Please, Sign In to add comment