/**************************************************************
Description: HOW TO CONTROL A HD44780-BASED CHARACTER LCD
Author(s): VICTOR GOLUTVIN (UT1WPR)
History: FOLLOWED BY MISCELLANIUOIS INTERNET SOURCES
---------------------------------------------------------
Copyright: FOR FREE USE
**************************************************************/
#include <system.h>
#include "main.h"
#pragma CLOCK_FREQ 20000000
// Test line for display
const char* Welcome = "Hello World!!!";
// Test variable;
char temp;
//Define device config block
asm
{
list p=PIC16F84
__config H'3FF9' ;XT,!WDT,!PWRT,!CP
}
// Main program entry
main()
{
//Init ports
//A and B port initialization
trisa = 0; //All pins configured for output
trisb = 0; //All pins configured for output
porta = 0x00;
portb = 0x00;
// LCD init procedure call
init_LCD();
// Send welcome message to LCD
printf(Welcome);
// Place character "A" at 2-nd column of 2-nd line
SetPos(1,1);
LCD_char('A');
// Send space to next place of display
LCD_char(' ');
// Use variable for character send
temp=0x65;
LCD_char(temp);
temp=0xA5;
// Output code as DEC (3 chars)
LCD_char(' ');
Hex2Dec(temp);
LCD_char(' ');
// Output code as HEX (2 chars)
PHex(temp);
//Infinite loop
while( 1 );
}
Copyright © 2002-2006 SourceBoost Technologies