Вы находитесь на странице: 1из 2

char keypadPort at PORTD;

sbit LCD_RS at RC4_bit;


sbit LCD_EN at RC5_bit;
sbit LCD_D7 at RC3_bit;
sbit LCD_D6 at RC2_bit;
sbit LCD_D5 at RC1_bit;
sbit LCD_D4 at RC0_bit;

sbit LCD_RS_direction at TRISC4_bit;


sbit LCD_EN_direction at TRISC5_bit;
sbit LCD_D7_direction at TRISC3_bit;
sbit LCD_D6_direction at TRISC2_bit;
sbit LCD_D5_direction at TRISC1_bit;
sbit LCD_D4_direction at TRISC0_bit;
void main() {
///////////variables////////////
int ADCINT;
int cal;
///////////////pRIMERA VARIALBE//////////////
char ADCSTR[15];
///////////////////////////////////////////////
////////////////sEGUNDA VARAIUABLE
char ADCST[15];
ADCON1=0b00001110;
/////////////////////////////////////////////
///////////////////////
////Enciendo el LCD PARA PODER TRABAJAR EN ELLA
Lcd_Init();
//PAMTALLA LCD DE -->2 FILAS X 16
//Lcd_Out(2,1,"HELLO WORD");
///Elimina el cursor (_)
Lcd_Cmd(_LCD_CURSOR_OFF);
///Manda directo un caracter
Lcd_Chr(1,16,'H');

while(1){
//////////////////////////////////////////////////pRIMERA VARIABLE//////////////
////////////////////////////////////////////// ME DEJA VARIAR EL POTENCIOMETRO
ADCINT=ADC_Read(0);
/////////////valor entero a string
IntToStr(ADCINT,ADCSTR);
LCD_Out(2,5,ADCSTR);
///////////////////////
LCD_Out(2,1,"ADC");
///////////////////////
////////////////////////////////////////////////////////////////////////////////
cal=Keypad_Key_Press();
IntToStr(cal,ADCST);
delay_ms(100);

if(portd.f0==1 && portd.f4==1){


LCD_Out(1,7,"7");
}
if(portd.f1==1 && portd.f4==1){
LCD_Out(1,7,"8");
}
if(portd.f2==1 && portd.f4==1){
LCD_Out(1,7,"9");
}
if(portd.f3==1 && portd.f4==1){
LCD_Out(1,7,"/");
}

///////////////////////////////
if(portd.f0==1 && portd.f5==1){
LCD_Out(1,7,"4");
}
if(portd.f1==1 && portd.f5==1){
LCD_Out(1,7,"5");
}
if(portd.f2==1 && portd.f5==1){
LCD_Out(1,7,"6");
}
if(portd.f3==1 && portd.f5==1){
LCD_Out(1,7,"*");
}
///////////////////////////////
if(portd.f0==1 && portd.f6==1){
LCD_Out(1,7,"1");
}
if(portd.f1==1 && portd.f6==1){
LCD_Out(1,7,"2");
}
if(portd.f2==1 && portd.f6==1){
LCD_Out(1,7,"3");
}
if(portd.f3==1 && portd.f6==1){
LCD_Out(1,7,"-");
}
///////////////////////////////
if(portd.f0==1 && portd.f7==1){
LCD_Out(1,7,"ON");
}
if(portd.f1==1 && portd.f7==1){
LCD_Out(1,7,"0");
}
if(portd.f2==1 && portd.f7==1){
LCD_Out(1,7,"=");
}
if(portd.f3==1 && portd.f7==1){
LCD_Out(1,7,"+");
}
///////////////////////////////
}
}

Вам также может понравиться