Skip to content

Instantly share code, notes, and snippets.

@Microcontrolandos
Created January 23, 2015 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Microcontrolandos/d1038d5d3fa2e13d5bbc to your computer and use it in GitHub Desktop.
Save Microcontrolandos/d1038d5d3fa2e13d5bbc to your computer and use it in GitHub Desktop.
/*
EXEMPLO
MCU: PIC12F675
Clock: INTOSC 4MHz
Compilador: MikroC PRO PIC
Autor: Tiago
Bibliotecas Utilizadas: LCD595, Conversions, Lcd_Constants
Ligação dos pinos:
74HC595 <-> LCD
Q0 - D4
Q1 - D5
Q2 - D6
Q3 - D7
Q4 - RS
Q5 - E
*/
/* Pinos do 74HC595 */
sbit LCD595_Data at GP1_Bit;
sbit LCD595_Clock at GP2_Bit;
sbit LCD595_Latch at GP4_Bit;
sbit LCD595_Data_Direction at TRISIO1_Bit;
sbit LCD595_Clock_Direction at TRISIO2_Bit;
sbit LCD595_Latch_Direction at TRISIO4_Bit;
char mensagem[12]; //Usado para armazenar a conversão de um numero para string
char contador = 0;
void main()
{
CMCON = 7; //Desabilita o comparador analogico
ANSEL = 0; //Desabilita o canal analogico
LCD595_Init(); //Iniciliza o display LCD
LCD595_Cmd( _LCD_CLEAR ); //Limpa o display
LCD595_Out( 0, 2, "LCD 74HC595" ); //Escreve o texto no LCD na linha 0, coluna 2
while(1)
{
ByteToStr( contador++, mensagem ); //converte o numero para string
LCD595_Out( 1, 6, mensagem ); //Escreve a mensagem no LCD na linha 1, coluna 6
Delay_ms( 1000 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment