Search:

Return to previous page

Contents of file 'dogm16x.h':



    1   /*=============================================================================
    2    * File:        dogm16x.h
    3    * Created:     September 12, 2010 [v.1.0]
    4    * Last change: September 3, 2011 [v.1.4]
    5    * Author:      Fredrik Jonsson <http://jonsson.eu/>
    6    *
    7    * Copyright (C) 2011, Fredrik Jonsson <http://jonsson.eu/>
    8    * Non-commercial copying welcome.
    9    *===========================================================================*/
   10   #define DOGM163_NUM_COLS (16) /* LCD width of 16 characters  */
   11   #define DOGM163_NUM_ROWS (3)  /* LCD height of 3 rows        */
   12   #define DOGM162_NUM_COLS (16) /* LCD width of 16 characters  */
   13   #define DOGM162_NUM_ROWS (2)  /* LCD height of 2 rows        */
   14   #define DOGM161_NUM_COLS (16) /* LCD width of 16 characters  */
   15   #define DOGM161_NUM_ROWS (1)  /* LCD height of 2 rows        */
   16   
   17   #define DOGM_TAB_LENGTH (3)   /* Number of spaces per tab    */
   18   
   19   #define LCDDATA (0x01)        /* Address of data register    */
   20   #define LCDCMD  (0x00)        /* Address of command register */
   21   #define PMDATA (PMDIN1)       /* The PMP data buffer         */
   22   
   23   /*
   24    * Define:s for the main Instruction Table of the DOGM display family, straight
   25    * from the bit pattern settings listed in the data sheet.
   26    */
   27   #define DOGM_CLEAR__DISPLAY (0x01)        /* 00000001 = 0x01 */
   28   #define DOGM_RETURN_HOME (0x02)           /* 00000010 = 0x02 */
   29   
   30   /*
   31    * Define:s for cursor move direction and display shift; operations performed
   32    * after data read and write. Concatenate patterns by bitwise OR:
   33    *    DOGM_ENTRY_MODE_SET
   34    *        |{DOGM_CURSOR_MOVE_DIR_FORWARD OR DOGM_CURSOR_MOVE_DIR_BACKWARD}
   35    *        |{DOGM_CURSOR_SHIFT_DIR_UP OR DOGM_CURSOR_SHIFT_DIR_DOWN}
   36    */
   37   #define DOGM_ENTRY_MODE_SET (0x04)           /* 00000100 = 0x04 */
   38   #define DOGM_CURSOR_MOVE_DIR_FORWARD (0x02)  /* 00000010 = 0x02 */
   39   #define DOGM_CURSOR_MOVE_DIR_BACKWARD (0x00) /* 00000000 = 0x00 */
   40   #define DOGM_CURSOR_SHIFT_DIR_UP (0x01)      /* 00000001 = 0x01 */
   41   #define DOGM_CURSOR_SHIFT_DIR_DOWN (0x00)    /* 00000000 = 0x00 */
   42   
   43   /*
   44    * Display appearance for cursor etc. Concatenate patterns by bitwise OR:
   45    *    DOGM_DISPLAY_ON
   46    *        |{DOGM_ENTIRE_DISPLAY_ON OR DOGM_ENTIRE_DISPLAY_OFF}
   47    *        |{DOGM_CURSOR_ON OR DOGM_CURSOR_OFF}
   48    *        |{DOGM_CURSOR_POSITION_ON OR DOGM_CURSOR_POSITION_OFF}
   49    */
   50   #define DOGM_DISPLAY_ON (0x08)            /* 00001000 = 0x08 */
   51   #define DOGM_ENTIRE_DISPLAY_ON (0x04)     /* 00000100 = 0x04 */
   52   #define DOGM_ENTIRE_DISPLAY_OFF (0x00)    /* 00000000 = 0x00 */
   53   #define DOGM_CURSOR_ON (0x02)             /* 00000010 = 0x02 */
   54   #define DOGM_CURSOR_OFF (0x00)            /* 00000000 = 0x00 */
   55   #define DOGM_CURSOR_POSITION_ON (0x01)    /* 00000001 = 0x01 */
   56   #define DOGM_CURSOR_POSITION_OFF (0x00)   /* 00000000 = 0x00 */
   57   
   58   /*
   59    * Define:s for the set function and selection of instruction table.
   60    * after data read and write. Concatenate patterns by bitwise OR:
   61    *    DOGM_FUNCTION_SET
   62    *        |{DOGM_EIGHT_BIT_INTERFACE OR DOGM_FOUR_BIT_INTERFACE}
   63    *        |{DOGM_NUM_LINE_IS_ONE OR DOGM_NUM_LINE_IS_TWO}
   64    *        |{DOGM_SINGLE_HEIGHT_FONT OR DOGM_DOUBLE_HEIGHT_FONT}
   65    *        |{DOGM_INSTRUCTION_TABLE_ONE OR DOGM_INSTRUCTION_TABLE_TWO}
   66    */
   67   #define DOGM_FUNCTION_SET (0x20)          /* 00100000 = 0x20 */
   68   #define DOGM_EIGHT_BIT_INTERFACE (0x10)   /* 00010000 = 0x10 */
   69   #define DOGM_FOUR_BIT_INTERFACE (0x00)    /* 00000000 = 0x00 */
   70   #define DOGM_NUM_LINE_IS_ONE (0x00)       /* 00000000 = 0x00 */
   71   #define DOGM_NUM_LINE_IS_TWO (0x08)       /* 00001000 = 0x08 */
   72   #define DOGM_SINGLE_HEIGHT_FONT (0x00)    /* 00000000 = 0x00 */
   73   #define DOGM_DOUBLE_HEIGHT_FONT (0x04)    /* 00000100 = 0x04 */
   74   #define DOGM_INSTRUCTION_TABLE_ZERO (0x00)/* 00000000 = 0x00 */
   75   #define DOGM_INSTRUCTION_TABLE_ONE (0x01) /* 00000001 = 0x01 */
   76   #define DOGM_INSTRUCTION_TABLE_TWO (0x02) /* 00000002 = 0x02 */
   77   
   78   /*
   79    * Define:s for Instruction Table 1 of the DOGM display family, straight
   80    * from the bit pattern settings listed in the data sheet. Concatenate
   81    * patterns by bitwise OR:
   82    *    DOGM_BIAS_SET
   83    *        |{DOGM_ONE_FOURTH_BIAS OR DOGM_ONE_FIFTH_BIAS}
   84    *        |{DOGM_THREELINE_BIAS OR DOGM_TWOLINE_BIAS OR DOGM_ONELINE_BIAS}
   85    */
   86   #define DOGM_BIAS_SET (0x14)              /* 00010100 = 0x14 */
   87   #define DOGM_ONE_FOURTH_BIAS (0x08)       /* 00001000 = 0x08 */
   88   #define DOGM_ONE_FIFTH_BIAS (0x00)        /* 00000000 = 0x00 */
   89   #define DOGM_THREELINE_BIAS (0x01)        /* 00000001 = 0x01 */
   90   #define DOGM_TWOLINE_BIAS (0x00)          /* 00000000 = 0x00 */
   91   #define DOGM_ONELINE_BIAS (0x00)          /* 00000000 = 0x00 */
   92   
   93   extern void delayms(unsigned t);
   94   extern void initialize_display(void);
   95   extern char read_display_register(int addr);
   96   extern int read_current_address_counter(void);
   97   extern char display_is_busy(void);
   98   extern void write_to_display_register(int addr, char c);
   99   extern void write_character_to_display(char c);
  100   extern void send_command_to_display(char c);
  101   extern void setLCDG(char a);
  102   extern void setLCDC(char a);
  103   extern void clear_display(void);
  104   extern void move_to_position_on_display(int rowpos, int colpos);
  105   extern void move_to_beginning_of_display(void);
  106   extern void move_to_beginning_of_line(void);
  107   extern void advance_to_next_line(void);
  108   extern void write_string_to_display(char *s);
  109   

Return to previous page

Generated by ::viewsrc::

Last modified Wednesday 15 Feb 2023