lcd.h

00001 /*
00002   lcd.h
00003   
00004   Nicolas Williamson - July 2009
00005 */
00006 
00007 #ifndef __H_LCD__
00008 #define __H_LCD__
00009 
00013 typedef enum lcd_state{
00014   LCD_IDLE = 0, 
00015   LCD_MOVE, 
00016   LCD_DISPLAY 
00017 } LCD_STATE;
00018 
00022 typedef struct lcd_char{
00023   unsigned char data; 
00024   unsigned char pos; 
00025   unsigned int quad_num; 
00026 } LCD_CHAR;
00027 
00028 // Functions
00029 void lcd_init(VOID_VOID_F overflowfunc);
00030 void lcd_write_data(unsigned char data);
00031 void lcd_write_instruction(unsigned char instruction);
00032 void lcd_write_bit(unsigned int db, unsigned int bit);
00033 
00034 //void lcd_push(LCD_CHAR c);
00035 //LCD_CHAR lcd_pop(void);
00036 int lcd_push(LCD_CHAR* c);
00037 int lcd_pop(LCD_CHAR* c);
00038 
00039 void lcd_print(char* string, unsigned int length, unsigned int start_pos);
00040 void lcd_print_char(char ch, unsigned int pos);
00041 void lcd_us_delay(long unsigned int delay_time_us);
00042 //methods for CAN setting
00043 void lcd_set_line1(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8);
00044 void lcd_set_line2(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8);
00045 void lcd_set_quad1(char c1, char c2, char c3, char c4);
00046 void lcd_set_quad2(char c1, char c2, char c3, char c4);
00047 void lcd_set_quad3(char c1, char c2, char c3, char c4);
00048 void lcd_set_quad4(char c1, char c2, char c3, char c4);
00049 
00050 //timer isr
00051 __irq void lcd_isr(void);
00052 
00053 /*HARDWARE SETUP
00054 
00055   // *******************************************************************************
00056   // Initialize LCD
00057   // *******************************************************************************
00058   PINSEL0 &= ~(0xFFFF); //Pins P0.0-P0.7 GPIO (D0-D7 on LCD controller)
00059   PINSEL0 &= ~(((unsigned int)3)<<30); //P0.15 GPIO (RS)
00060   PINSEL0 &= ~(3<<20); //P0.10 GPIO (R/~W)
00061   PINSEL0 &= ~(3<<22); //P0.11 GPIO (EN)
00062   FIO0DIR |= 0x8CFF; //set above pins as output
00063   FIO0MASK &= ~(0xFF); //zero fiomask
00064   //Timer stuff
00065   T0PR = 0;//no prescaling
00066   T0MR0 = 60000000/20000;//Match Register for scheduler interrupts
00067   T0TCR = 1;//enabled for counting
00068   T0CTCR = 0;//simple timer
00069   T0MCR = (1)|(1<<1);//interrupt (bit0) and reset (bit1) on MR0
00070 
00071 */
00072 
00073 #endif
Generated on Tue Jun 29 16:36:14 2010 by  doxygen 1.6.3