Advertisement
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;//promeneti poradi data line sto e A
- void interrupt() {
- if (TMR0IF_bit) {
- cnt++;
- TMR0IF_bit = 0;
- TMR0 = 96;
- }
- } //prekin za tmr0, so nego rabotime
- char *ime;
- void main(){
- ANSEL = 0;
- ANSLH = 0;
- TRISA = 0;
- TRISB.B0 = 0xFF;
- OPTIONREG = 0x85; //binarno vo hex za preskaler, prviot bit e 1, poslednite 3 od tabela
- INTCON = 0xA0; // binarno vo hex za interuput, global interupt i tmr0 da se aktivni od tabela
- TMR0 = 96; //formulata?
- cnt = 0;
- while(1){
- if(PORTB.B0 == 1){
- if(cnt >= 196){
- cnt = 0;
- Lcd_Init();
- Lcd_Cmd(_LCD_CURSOR_OFF);
- Lcd_Cmd(_LCD_CLEAR);
- }
- Lcd_Init();
- Lcd_Cmd(_LCD_CURSOR_OFF);
- strcpy(ime, "Angel");
- Lcd_Out(1,1,ime);
- }
- else if(PORTB.B0 == 0){
- if(cnt >= 196){
- cnt = 0;
- Lcd_Init();
- Lcd_Cmd(_LCD_CURSOR_OFF);
- Lcd_Cmd(_LCD_CLEAR);
- }
- Lcd_Init();
- LCD_Cmd(_LCD_CURSOR_OFF);
- LCD_Cmd(_LCD_CLEAR);
- strcpy(ime,"Latkoski");
- Lcd_Out(2,1,ime);
- i = 0 ;
- while(i < 9){
- LCD_Cmd(_LCD_SHIFT_LEFT);
- Delay_ms(10);
- i++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement