#ifndef _MAIN_H_
#define _MAIN_H_
////////////////////////////////////////////////////////////////////
// David Hobday 22/09/2003 - Correction:
// 1) Corrected port details, that where previously incorrect to
// work with 16F84
// 2) Detailed required connections
//
// David Hobday 07/09/2003 - Correction:
// 1) R/W Pin should be connected to VSS - was VDD.
//
// Connections required, if the following port definitions are used
// RS RA1
// R/W VSS - tied to 0V
// E RA0
//
// DB0 None
// DB1 None
// DB2 None
// DB3 None
// DB4 RB4
// DB5 RB5
// DB6 RB6
// DB7 RB7
// Ports naming
#define LCD portb
#define CONTROL porta
// PINs naming
#define LCD_E 0
#define LCD_RS 1
// Some usefull macroses
#define LCD_E_U set_bit(CONTROL,LCD_E)
#define LCD_E_D clear_bit(CONTROL,LCD_E)
#define LCD_RS_U set_bit(CONTROL,LCD_RS)
#define LCD_RS_D clear_bit(CONTROL,LCD_RS)
#define SetPos(line,pos) LCD_cmd(0x80 + line*0x40 + pos)
#define byte unsigned char
// Use nested macroses
#define write_data LCD_RS_U; LCD_E_U; LCD_E_D;
#define write_cmd LCD_RS_D; LCD_E_U; LCD_E_D;
// Function prototypes
void ph1(byte data);
void LCD_char(byte data);
void LCD_cmd(byte data);
void LCD_icmd(byte data);
void Hex2Dec(byte data);
void PHex(byte data);
void init_LCD(void);
void printf( const char* text );
#endif //_MAIN_H_
Copyright © 2002-2006 SourceBoost Technologies