Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sbit LCD_RS at RB4_bit;
- sbit LCD_EN at RB5_bit;
- sbit LCD_D4 at RB0_bit;
- sbit LCD_D5 at RB1_bit;
- sbit LCD_D6 at RB2_bit;
- sbit LCD_D7 at RB3_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;
- int i= 0, secunda = 0,interval = 0;
- char sec[16];
- void interrupt()
- {
- INTCON.GIE=0;
- if(INTCON.T0IF)
- {
- INTCON.T0IF=0;
- i++;
- TMR0 = 99;
- if (i == 50)
- {
- secunda++;
- i = 0;
- }
- }
- INTCON.GIE=1;
- }
- void initializare(){
- CMCON0.C1INV = 0;
- CMCON0.CM2=1;
- CMCON0.CM1=0;
- CMCON0.CM0=0;
- TRISD.RD0=0;
- INTCON = 0b10100000;
- OPTION_REG = 0b00000101;
- Lcd_Init();
- Lcd_Cmd(_LCD_CURSOR_OFF);
- }
- void main() {
- initializare();
- interval = secunda;
- while(1){
- PORTD.RD0 = 0;
- IntToStr(secunda, sec);
- Lcd_Out(1,1,sec);
- if(secunda-interval==10){
- PORTD.RD0 = 1;
- if(CMCON0.C1OUT == 0){
- Lcd_Out(2,1,"Pot. RA0>=RA3");
- }
- else if(CMCON0.C1OUT == 1){
- Lcd_Out(2,1,"Pot. RA0<RA3");
- }
- interval = secunda;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement