Skip to content

Instantly share code, notes, and snippets.

int a;int b;int d;int x=0;int y=0;
void read1(){TMR1H = 0;TMR1L = 0;
PORTa.F6 = 1;Delay_us(10);PORTa.F6 = 0;
while(!PORTa.F7);T1CON.F0 = 1;while(PORTa.F7);T1CON.F0 = 0;
a = (TMR1L | (TMR1H<<8));a = a/34;a = a + (a/5);
if(a<11){a=a+1;}else a=a;}
void read2(){TMR1H = 0;TMR1L = 0;
PORTa.F1 = 1;Delay_us(10);PORTa.F1 = 0;
while(!PORTa.F0);T1CON.F0 = 1;while(PORTa.F0);T1CON.F0 = 0;
b = (TMR1L | (TMR1H<<8));b = b/34;b = b + (b/5);
@SamaHadhod
SamaHadhod / Car program.
Created October 20, 2018 08:17
Controlling the car.
// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;