Monday, 3 September 2012

Extremus Coder LCD Lib v1.0-- my lcd library which uses random pins and can be adapted to any compiler or any platform easily

/*******************************************************************
  EXTREMUS CODER LCD LIBRARY V 1.0
  USE RANDOM PINS
  CAN BE EASILY ADAPTED TO ANY COMPILER AND ANY MCU OR EVEN THE PARALLEL PORT FOR THAT MATTER
  THIS IS THE PART CONCERNING THE CONNECTIONS
 

  CONNECTIONS ARE E ,Rs, D4, D5, D6, D7
  DEFINE THEM AS SHOWN IE CHANGE THEM IN THE HEADER FILE "lcd.h" AS SHOWN BELOW


 '(
  For Eg:
  If E pin is connected to PORTC.0, then
  #define EPort PORTC
  #define E 0
  #define Edir DDRC
  ')

'(
 VERY IMPORTANT
 NOTE THE RW PIN IS NOT USED SO DONT DEFINE RW PIN CONNECTIONS
UNLESS ITS ALREADY CONNECTED AND U CAN'T UNDO THE CONNECTION
 
 LOOK FOR THE FOLLOWING FOUR LINES IN THE HEADER AND COMMENT THEM (//) IF THE RW PIN IS NOT CONNECTED
 WHICH SHOULD BE THE CASE IF U ARE MAKING UR OWN CONNECTIONS

 #define RwPort PORTB
#define Rw 1
#define Rwdir DDRB
#define RwExists 1

 ')

 THEN DEFINE THE NO OF ROWS AND COLUMNS OF UR LCD
 

  for eg if ur display is 20*4
  then
  #define displayRow 20
  #define displayColumns 4

BY DEFAULT THEY ARE 16 and 2
  AFTER THAT in ur program include the following files
  without which the program wont work
  FOR EG:
  //TEST PROGRAM FOR WINAVR (main.c)
--------------------------------------------------------------
  #include //winavr io for codevision it is #include and so on
  #include "lcd.h"
  #include "lcd.c"
  #include "printf.c"

  int main(void)
  {
 
  init_lcd(); //initialise the lcd
  lcdTest(); //prints EXTREMUS CODER LCD LIBRARY V1.0
  _delay_ms(3000);
  lcdClear();
 
  char* s="LCD_LIB";
  lcdGotoXY(0,0); //First line first character pos
  lcdPrintf("STRING:%s",s);
  lcdGotoXY(0,1); //SECOND line first character pos
  lcdPrintf("NO:%d, FLOAT:%f",1,1.23);
 


  }
--------------------------------------------------------------

 THE IMPORTANT FUNCTIONS ARE
void init_lcd(); //DONT START UR PROGRAM WITHOUT IT!!!!
void lcdPrintf(char *fmt, ...); //DITTO PRINTF FUNCTIONALITY U SHUD BE USING THIS THE MOST
void lcdGotoXY(int x, int y); // X STARTS FROM 0, Y STARTS FROM 0
void lcdClear(void);
void lcdToHome(void);
void lcdPrintSpaces(int no); //PRETTY NIFTY AI :)

//DONT THINK U WILL BE NEEDING THESE BUT ANYWAY
void lcdPutString(char* s);
void lcdPutInt(int a);
void lcdPutChar(char c);

//LOW LEVEL ROUTINES
void toggleE(void);
void writeByte(int val);
void writeToLcd(int val);



//CODEVISION DOESNT SEEM TO SUPPORT va_arg function for floating point
// so no floating point support for lcdprintf for codevision ie, in winavr it is working fine though




  DONT LOOK BEYOND THE CONNECTIONS PART IF U FEEL A BIT CONFUSED

ANY PROBLEM: MAIL DON'T PESTER AT knapshots@gmail.com

*******************************************************************/
Heres the link:

No comments:

Post a Comment