Nothing Special   »   [go: up one dir, main page]

1sbit LCD

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

sbit LCD_RS at RB2_bit;

sbit LCD_EN at RB3_bit;

sbit LCD_D4 at RB4_bit;

sbit LCD_D5 at RB5_bit;

sbit LCD_D6 at RB6_bit;

sbit LCD_D7 at RB7_bit;

sbit LCD_RS_Direction at TRISB2_bit;

sbit LCD_EN_Direction at TRISB3_bit;

sbit LCD_D7_Direction at TRISB7_bit;

sbit LCD_D6_Direction at TRISB6_bit;

sbit LCD_D5_Direction at TRISB5_bit;

sbit LCD_D4_Direction at TRISB4_bit;

sbit S1 at RA0_bit;

sbit S2 at RA1_bit;

sbit S3 at RA2_bit;

void main() {

cmcon=7;trisa=255;trisb=0;

portb=0;

Lcd_Init(); //inicia LCD

Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

Lcd_Out(1,1,"TANQUE DE AGUA");

while(1){

if(S1==0 && S2==0 && S3==0){

Lcd_Out(2,6,"VACIO");

if(S1==1 && S2==0 && S3==0){

Lcd_Out(2,6,"BAJO ");

if(S1==1 && S2==1 && S3==0){


Lcd_Out(2,6,"MITAD ");

if(S1==1 && S2==1 && S3==1){

Lcd_Out(2,6,"LLENO ");

You might also like