--- /dev/null
+/*------------------------------------------------------------------------/\r
+/ EZ-LCD - Generic control module for HD44780 LCDC - R0.01c\r
+/-------------------------------------------------------------------------/\r
+/\r
+/ Copyright (C) 2010, ChaN, all right reserved.\r
+/\r
+/ * This software is a free software and there is NO WARRANTY.\r
+/ * No restriction on use. You can use, modify and redistribute it for\r
+/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.\r
+/ * Redistributions of source code must retain the above copyright notice.\r
+/\r
+/-------------------------------------------------------------------------/\r
+/ Nov 12,'10 R0.01c First release.\r
+/------------------------------------------------------------------------*/\r
+#include <machine.h>\r
+#include "hd44780.h"\r
+\r
+/*-------------------------------------------------------------------------*/\r
+/* Platform dependent macros and functions needed to be modified */\r
+/*-------------------------------------------------------------------------*/\r
+\r
+/* Bus controls */\r
+#include "iodefine.h" /* Device specific include file */\r
+#include "rskrx210def.h"\r
+\r
+#define IF_BUS 4 /* Data bus width (4 or 8) */\r
+#define IF_INIT() {} /* Initialize control port */\r
+#define E1_HIGH() LCD_EN = 1 /* Set E(E1) high */\r
+#define E1_LOW() LCD_EN = 0 /* Set E(E1) low */\r
+#define E2_HIGH() /* Set E2 high (dual controller only) */\r
+#define E2_LOW() /* Set E2 low (dual controller only) */\r
+#define RS_HIGH() LCD_RS = 1 /* Set RS high */\r
+#define RS_LOW() LCD_RS = 0 /* Set RS low */\r
+#define OUT_DATA(d) LCD_DATA = (d & 0x0F)//LCD_DATA = ((LCD_DATA & 0xF0) | (d & 0x0F)) /* Output a byte d on the data bus (higher 4 bits of d in 4-bit mode) */\r
+#define IF_DLY60() {nop();nop();nop(); } /* Delay >=60ns (can be blanked for most uC) */\r
+#define IF_DLY450() {unsigned long x; for(x=0; x<22; x++){nop();}} /* Delay >=450ns@3V, >=250ns@5V */\r
+#define DELAY_US(n) {unsigned long x; for(x=0; x<(n*50); x++){nop();}} /* Delay n microseconds */\r
+\r
+/* Characteristics of LCD module */\r
+#define LCD_ETIME_1 1530 /* Execution time of Clear Display command [us] */\r
+#define LCD_ETIME_2 43 /* Execution time of other command and data write [us] */\r
+#define LCD_DLF 2.0 /* Delay factor (>=2.0) */\r
+\r
+\r
+\r
+/*-------------------------------------------------------------------------*/\r
+\r
+\r
+#if _LCD_ROWS >= 2 || _LCD_COLS > 8\r
+ #define LCD_IF_2ROW 8 /* 2-row cfg. */\r
+ #if _LCD_ROWS == 1\r
+ #define LCD_IF_SPLIT 1 /* Half split row */\r
+ #else\r
+ #define LCD_IF_SPLIT 0 /* Direct row */\r
+ #endif\r
+#else\r
+ #define LCD_IF_2ROW 0 /* 1-row cfg. */\r
+#endif\r
+\r
+#if _LCD_ROWS == 4 && _LCD_COLS <= 20\r
+ #define LCD_IF_ALTROW 1 /* Alternate row layout */\r
+#else\r
+ #define LCD_IF_ALTROW 0 /* Incremental row layout */\r
+#endif\r
+\r
+#if _LCD_ROWS == 4 && _LCD_COLS > 20\r
+ #define LCD_IF_DUAL 1 /* Dual controller */\r
+#else\r
+ #define LCD_IF_DUAL 0 /* Single controller */\r
+#endif\r
+\r
+#define LCD_DT1 ((uint16_t)(LCD_ETIME_1 * LCD_DLF))\r
+#define LCD_DT2 ((uint16_t)(LCD_ETIME_2 * LCD_DLF))\r
+\r
+\r
+\r
+static\r
+uint8_t Row, Column; /* Current cursor position */\r
+#if _USE_CURSOR\r
+static\r
+uint8_t Csr; /* Current cursor state */\r
+#endif\r
+\r
+\r
+\r
+\r
+/*----------------------------------------------*/\r
+/* Write a byte to the LCD controller */\r
+/*----------------------------------------------*/\r
+\r
+static\r
+void lcd_write (\r
+ uint8_t reg, /* b0:command(0)/data(1), b2..1:E1(2)/E2(1)/both(0)(don't care on single controller), b3:write high nibble only(don't care on 8-bit bus) */\r
+ uint8_t dat /* Byte to be written */\r
+)\r
+{\r
+ if (reg & 1) /* Select register */\r
+ RS_HIGH();\r
+ else\r
+ RS_LOW();\r
+ IF_DLY60();\r
+\r
+#if IF_BUS == 4\r
+ if (!(reg & 8)) {\r
+ OUT_DATA(dat);\r
+#if LCD_IF_DUAL\r
+ if (!(reg & 2)) E1_HIGH();\r
+ if (!(reg & 4)) E2_HIGH();\r
+ IF_DLY450();\r
+ E1_LOW();\r
+ E2_LOW();\r
+#else\r
+ E1_HIGH();\r
+ IF_DLY450();\r
+ E1_LOW();\r
+#endif\r
+ IF_DLY450();\r
+ dat <<= 4;\r
+ }\r
+#endif\r
+\r
+ OUT_DATA(dat);\r
+#if LCD_IF_DUAL\r
+ if (!(reg & 2)) E1_HIGH();\r
+ if (!(reg & 4)) E2_HIGH();\r
+ IF_DLY450();\r
+ E1_LOW();\r
+ E2_LOW();\r
+#else\r
+ E1_HIGH();\r
+ IF_DLY450();\r
+ E1_LOW();\r
+#endif\r
+\r
+ DELAY_US(LCD_DT2); /* Always use timer */\r
+}\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Initialize LCD module */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+void lcd_init (void)\r
+{\r
+ uint8_t d;\r
+ \r
+ E1_HIGH();\r
+ DELAY_US(40000);\r
+ E1_LOW();\r
+\r
+// IF_INIT();\r
+\r
+// DELAY_US(40000);\r
+ lcd_write(8, 0x30);\r
+ DELAY_US(4100);\r
+ lcd_write(8, 0x30);\r
+ DELAY_US(100);\r
+ lcd_write(8, 0x30);\r
+\r
+ d = (IF_BUS == 4 ? 0x20 : 0x30) | LCD_IF_2ROW;\r
+ lcd_write(8, d);\r
+#if IF_BUS == 4\r
+ lcd_write(0, d);\r
+#endif\r
+ lcd_write(0, 0x08);\r
+ lcd_write(0, 0x01);\r
+ DELAY_US(LCD_DT1);\r
+ lcd_write(0, 0x06);\r
+ lcd_write(0, 0x0C);\r
+\r
+ Row = Column = 0;\r
+#if _USE_CURSOR\r
+ Csr = 0;\r
+#endif\r
+}\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Set cursor position */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+void lcd_locate (\r
+ uint8_t row, /* Cursor row position (0.._LCD_ROWS-1) */\r
+ uint8_t col /* Cursor column position (0.._LCD_COLS-1) */\r
+)\r
+{\r
+ Row = row; Column = col;\r
+\r
+ if (row < _LCD_ROWS && col < _LCD_COLS) {\r
+ if (_LCD_COLS >= 2 && (row & 1)) col += 0x40;\r
+ if (LCD_IF_SPLIT && col >= _LCD_COLS / 2) col += 0x40 - _LCD_COLS / 2;\r
+ if (LCD_IF_ALTROW && (row & 2)) col += _LCD_COLS;\r
+ col |= 0x80;\r
+ } else {\r
+ col = 0x0C;\r
+ }\r
+\r
+#if LCD_IF_DUAL\r
+ if (_USE_CURSOR && !(row &= 2)) row |= 4;\r
+ lcd_write(row, col);\r
+#if _USE_CURSOR\r
+ if (col != 0x0C) lcd_write(row, Csr | 0x0C);\r
+ row ^= 6;\r
+ lcd_write(row, 0x0C);\r
+#endif\r
+#else\r
+ lcd_write(0, col);\r
+#if _USE_CURSOR\r
+ if (col != 0x0C) lcd_write(0, Csr | 0x0C);\r
+#endif\r
+#endif\r
+}\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Put a character */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+void lcd_putc (\r
+ uint8_t chr\r
+)\r
+{\r
+ if (chr == '\f') { /* Clear Screen and Return Home */\r
+ lcd_write(0, 0x01);\r
+ DELAY_US(LCD_DT1);\r
+ lcd_locate(0, 0);\r
+ return;\r
+ }\r
+\r
+ if (Row >= _LCD_ROWS) return;\r
+\r
+ if (chr == '\r') { /* Cursor return */\r
+ lcd_locate(Row, 0);\r
+ return;\r
+ }\r
+ if (chr == '\n') { /* Next row */\r
+ lcd_locate(Row + 1, 0);\r
+ return;\r
+ }\r
+ if (chr == '\b') { /* Cursor back */\r
+ if (Column)\r
+ lcd_locate(Row, Column - 1);\r
+ return;\r
+ }\r
+\r
+ if (Column >= _LCD_COLS) return;\r
+\r
+ lcd_write((LCD_IF_DUAL && Row >= 2) ? 3 : 5, chr);\r
+ Column++;\r
+\r
+ if (LCD_IF_SPLIT && Column == _LCD_COLS / 2)\r
+ lcd_write(0, 0x40);\r
+\r
+ if (Column >= _LCD_COLS)\r
+ lcd_locate(Row + 1, 0);\r
+}\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Set cursor form */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+#if _USE_CURSOR\r
+void lcd_cursor (\r
+ uint8_t stat /* 0:off, 1:blinking block, 2:under-line */\r
+)\r
+{\r
+ Csr = stat & 3;\r
+ lcd_locate(Row, Column);\r
+}\r
+#endif\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Register user character pattern */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+#if _USE_CGRAM\r
+void lcd_setcg (\r
+ uint8_t chr, /* Character code to be registered (0..7) */\r
+ uint8_t n, /* Number of characters to register */\r
+ const uint8_t* p /* Pointer to the character pattern (8 * n bytes) */\r
+)\r
+{\r
+ lcd_write(0, 0x40 | chr * 8);\r
+ n *= 8;\r
+ do\r
+ lcd_write(1, *p++);\r
+ while (--n);\r
+\r
+ lcd_locate(Row, Column);\r
+}\r
+#endif\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Put a fuel indicator */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+#if _USE_FUEL && _USE_CGRAM\r
+void lcd_put_fuel (\r
+ int8_t val, /* Fuel level (-1:plugged, 0:empty cell, ..., 5:full cell) */\r
+ uint8_t chr /* User character to use */\r
+)\r
+{\r
+ static const uint8_t plg[8] = {10,10,31,31,14,4,7,0};\r
+ uint8_t gfx[8], d, *p;\r
+ int8_t i;\r
+\r
+\r
+ if (val >= 0) { /* Cell (0..5) */\r
+ p = &gfx[8];\r
+ *(--p) = 0; *(--p) = 0x1F;\r
+ for (i = 1; i <= 5; i++) {\r
+ d = 0x1F;\r
+ if (val < i) d = (i == 5) ? 0x1B : 0x11;\r
+ *(--p) = d;\r
+ }\r
+ *(--p) = 0x0E;\r
+ } else { /* Plug (-1) */\r
+ p = (uint8_t*)plg;\r
+ }\r
+ lcd_setcg(chr, 1, p);\r
+ lcd_putc(chr);\r
+}\r
+\r
+\r
+#endif\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Draw bargraph */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+#if _USE_BAR && _USE_CGRAM\r
+void lcd_put_bar (\r
+ uint16_t val, /* Bar length (0 to _MAX_BAR represents bar length from left end) */\r
+ uint8_t width, /* Display area (number of chars from cursor position) */\r
+ uint8_t chr /* User character code (2 chars used from this) */\r
+)\r
+{\r
+ static const uint8_t ptn[] = {\r
+ 0xE0, 0xE0, 0xE0, 0xC0, 0xC0, 0xC0, 0x80, 0,\r
+ 0xF0, 0xE0, 0xE0, 0xE0, 0xC0, 0xC0, 0xC0, 0,\r
+ 0xF0, 0xF0, 0xE0, 0xE0, 0xE0, 0xC0, 0xC0, 0\r
+ };\r
+ const uint8_t *pp;\r
+ uint16_t n, m, s, gi;\r
+ uint8_t gfx[16];\r
+\r
+\r
+ for (n = 0; n < 16; n++) /* Register common pattern (space/fill) */\r
+ gfx[n] = n < 7 ? 0 : 0xFF;\r
+ lcd_setcg(_BASE_GRAPH, 2, gfx);\r
+\r
+ /* Draw edge pattern into gfx[] */\r
+ val = (unsigned long)val * (width * 18) / (_MAX_BAR + 1);\r
+ pp = &ptn[(val % 3) * 8]; /* Get edge pattern */\r
+ s = val / 3 % 6; /* Bit shift */\r
+ for (n = 0; n < 7; n++) { /* Draw edge pattern into the pattern buffer */\r
+ m = (*pp++ | 0xFF00) >> s;\r
+ gfx[n] = m;\r
+ gfx[n + 8] = m >> 6;\r
+ }\r
+\r
+ /* Put graphic pattern into the LCD module */\r
+ gi = val / 18; /* Indicator start position */\r
+ for (n = 1; n <= width; n++) { /* Draw each location in the bargraph */\r
+ if (n == gi) { /* When edge pattern is exist at the location */\r
+ m = chr + 1; /* A edge pattern */\r
+ } else {\r
+ if (n == gi + 1) {\r
+ lcd_setcg(chr, 2, gfx); /* Register edge pattern */\r
+ m = chr;\r
+ } else {\r
+ m = (n >= gi) ? _BASE_GRAPH : _BASE_GRAPH + 1; /* A space or fill */\r
+ }\r
+ }\r
+ lcd_putc(m); /* Put the character into the LCD */\r
+ }\r
+}\r
+#endif\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Draw point indicator */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+#if _USE_POINT && _USE_CGRAM\r
+void lcd_put_point (\r
+ uint16_t val, /* Dot position (0 to _MAX_POINT represents left end to write end) */\r
+ uint8_t width, /* Display area (number of chars from cursor position) */\r
+ uint8_t chr /* User character code (2 chars used from this) */\r
+)\r
+{\r
+ static const uint8_t ptn[] = {\r
+ 0x06, 0x0C, 0x0C, 0x0C, 0x18, 0x18, 0x18, 0,\r
+ 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x18, 0x18, 0,\r
+ 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x18, 0\r
+ };\r
+ const uint8_t *pp;\r
+ uint16_t n, m, s, gi;\r
+ uint8_t gfx[16];\r
+\r
+\r
+ for (n = 0; n < 16; n++) /* Register common pattern (space) */\r
+ gfx[n] = n < 7 ? 0 : 0xFF;\r
+ lcd_setcg(_BASE_GRAPH, 1, gfx);\r
+\r
+ /* Draw edge pattern into gfx[] */\r
+ val = (uint32_t)val * (width * 18 - 12) / (_MAX_BAR + 1);\r
+ pp = &ptn[(val % 3) * 8]; /* Get edge pattern */\r
+ s = val / 3 % 6; /* Bit shift */\r
+ for (n = 0; n < 7; n++) { /* Draw edge pattern into the pattern buffer */\r
+ m = *pp++; m <<= 6; m >>= s;\r
+ gfx[n] = m;\r
+ gfx[n + 8] = m >> 6;\r
+ }\r
+ lcd_setcg(chr, 2, gfx); /* Register dot pattern */\r
+\r
+ /* Put graphic pattern into the LCD module */\r
+ gi = val / 18; /* Indicator start position */\r
+ for (n = 0; n < width; n++) { /* Draw each location in the bargraph */\r
+ if (n == gi) { /* When edge pattern is exist at the location */\r
+ m = chr + 1; /* A edge pattern */\r
+ } else {\r
+ if (n == gi + 1)\r
+ m = chr;\r
+ else\r
+ m = _BASE_GRAPH; /* A space */\r
+ }\r
+ lcd_putc(m); /* Put the character into the LCD */\r
+ }\r
+}\r
+#endif\r
+\r
+\r
--- /dev/null
+/*-----------------------------------------------------------------------*/\r
+/* EZ-LCD - Generic control module include/configuration file */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+#ifndef _EZ_LCD\r
+#define _EZ_LCD\r
+\r
+/*--------------------------------------------------*/\r
+/* Configuration Options */\r
+/*--------------------------------------------------*/\r
+\r
+#define _LCD_ROWS 2 /* Number of Rows (1,2 or 4) */\r
+#define _LCD_COLS 8 /* Number of Columns (8..40) */\r
+\r
+#define _USE_CURSOR 0 /* 1:Enable lcd_cursor function */\r
+#define _USE_CGRAM 0 /* 1:Enable lcd_setcg function */\r
+\r
+#define _USE_FUEL 0 /* 1:Enable lcd_put_fuel function (_USE_CGRAM must be 1) */\r
+\r
+#define _USE_BAR 0 /* 1:Enable lcd_put_bar function (_USE_CGRAM must be 1) */\r
+#define _MAX_BAR 255 /* Maximum value for lcd_put_bar function */\r
+\r
+#define _USE_POINT 0 /* 1:Enable lcd_put_point function (_USE_CGRAM must be 1) */\r
+#define _MAX_POINT 255 /* Maximum value for lcd_put_point function */\r
+\r
+#define _BASE_GRAPH 0 /* Common user character used by lcd_put_bar/lcd_put_point function (2 chars from this) */\r
+\r
+\r
+\r
+/*--------------------------------------------------*/\r
+/* API declareations */\r
+/*--------------------------------------------------*/\r
+\r
+#include <stdint.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+void lcd_init (void);\r
+void lcd_locate (uint8_t, uint8_t);\r
+void lcd_putc (uint8_t);\r
+void lcd_cursor (uint8_t);\r
+void lcd_setcg (uint8_t, uint8_t, const uint8_t*);\r
+void lcd_put_fuel (int8_t, uint8_t);\r
+void lcd_put_bar (uint16_t, uint8_t, uint8_t);\r
+void lcd_put_point (uint16_t, uint8_t, uint8_t);\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#define CSR_OFF 0\r
+#define CSR_BLOCK 1\r
+#define CSR_UNDER 2\r
+\r
+\r
+#endif /* #ifndef _EZLCD */\r
--- /dev/null
+/***********************************************************************************\r
+Filename: lcd.c\r
+DESCRIPTION LCD Module utility functions.\r
+ Written for KS0066u compatible LCD Module.\r
+ (8 characters by 2 lines)\r
+\r
+Copyright : 2006 Renesas Technology Europe Ltd.\r
+Copyright : 2006 Renesas Technology Corporation.\r
+All Rights Reserved\r
+\r
+***********************************************************************************/\r
+\r
+/***********************************************************************************\r
+Revision History\r
+DD.MM.YYYY OSO-UID Description\r
+26.07.2006 RTE-MBA First Release\r
+***********************************************************************************/\r
+\r
+/**********************************************************************************\r
+System Includes\r
+***********************************************************************************/\r
+#include <machine.h>\r
+\r
+/**********************************************************************************\r
+User Includes\r
+***********************************************************************************/\r
+/* iodefine.h provides a structure to access all of the device registers. */\r
+#include "iodefine.h"\r
+/* rsk1664def.h provides common defines for widely used items. */\r
+#include "rskrx210def.h"\r
+#include "lcd.h"\r
+\r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "semphr.h"\r
+\r
+\r
+/**********************************************************************************\r
+Global variables\r
+***********************************************************************************/\r
+xQueueHandle SwitchQueue;\r
+xSemaphoreHandle LCD_Mutex;\r
+\r
+char datastring[]=\r
+"........Rx210 Highlights....1.56 DMips/MHz....DSP functions....1.62V-5.5V operation....200 uA/MHz....Up to 512 kBytes Flash....up to 64 kbytes SRAM....EE Dataflash with 100k w/e....1.3 uA in Real Time Clock Mode....Powerful Motor control timer....4 x 16-bit timers....4 x 8-bit timers....Full Real Time Clock calendar with calibration and alarm functions....Up to 16 channels 1 uS 12-bit ADC, with Dual group programmable SCAN, 3 sample and holds, sample accumulate function....DMA controller....Data Transfer Controller....Up to 9 serial Channels....Up to 6 USARTs ( with Simple I2C / SPI )....USART ( with unique Frame based protocol support )....Multimaster IIC....RSPI....Temperature Sensor....Event Link Controller....Comparators....Safety features include CRC....March X....Dual watchdog Timers with window and independent oscillator....ADC self test....I/O Pin Test....Supported with E1 on chip debugger and RSK210 evaluation system....Rx210 Highlights........";\r
+\r
+\r
+\r
+struct _LCD_Params Line1 = \r
+{\r
+ LCD_LINE1, 215, datastring \r
+};\r
+\r
+struct _LCD_Params Line2 = \r
+{\r
+ LCD_LINE2, 350, datastring \r
+};\r
+\r
+\r
+\r
+/**********************************************************************************\r
+User Program Code\r
+***********************************************************************************/\r
+\r
+/*****************************************************************************\r
+Name: InitDisplay \r
+Parameters: none \r
+Returns: none\r
+Description: Intializes the LCD display. \r
+*****************************************************************************/\r
+void InitialiseDisplay( void )\r
+{\r
+ /* Power Up Delay for LCD Module */\r
+ EN_PIN = SET_BIT_HIGH;\r
+ DisplayDelay(7000);\r
+ EN_PIN = SET_BIT_LOW;\r
+ \r
+ /* Display initialises in 8 bit mode - so send one write (seen as 8 bit)\r
+ to set to 4 bit mode. */\r
+\r
+ /* Function Set */\r
+ LCD_nibble_write(CTRL_WR,0x03);\r
+ LCD_nibble_write(CTRL_WR,0x03);\r
+ DisplayDelay(39);\r
+ \r
+ /* Configure display */\r
+ LCD_nibble_write(CTRL_WR,0x03);\r
+ LCD_nibble_write(CTRL_WR,0x02);\r
+ LCD_nibble_write(CTRL_WR,(LCD_DISPLAY_ON | LCD_TWO_LINE ));\r
+ LCD_nibble_write(CTRL_WR,(LCD_DISPLAY_ON | LCD_TWO_LINE ));\r
+ DisplayDelay(39);\r
+\r
+ /* Display ON/OFF control */\r
+ LCD_write(CTRL_WR,LCD_CURSOR_OFF);\r
+ DisplayDelay(39);\r
+\r
+ /* Display Clear */\r
+ LCD_write(CTRL_WR,LCD_CLEAR);\r
+ DisplayDelay(1530);\r
+\r
+ /* Entry Mode Set */\r
+ LCD_write(CTRL_WR,0x06);\r
+ LCD_write(CTRL_WR,LCD_HOME_L1);\r
+}\r
+/**********************************************************************************\r
+End of function InitialiseDisplay\r
+***********************************************************************************/ \r
+\r
+/*****************************************************************************\r
+Name: DisplayString \r
+Parameters: position Line number of display\r
+ string Pointer to data to be written to display.\r
+ Last character should be null.\r
+Returns: none\r
+\r
+Description: This function controls LCD writes to line 1 or 2 of the LCD.\r
+ You need to use the defines LCD_LINE1 and LCD_LINE2 in order\r
+ to specify the starting position.\r
+ For example, to start at the 2nd position on line 1...\r
+ DisplayString(LCD_LINE1 + 1, "Hello")\r
+*****************************************************************************/\r
+void DisplayString(unsigned char position, char * string)\r
+{\r
+ static unsigned char next_pos = 0xFF;\r
+\r
+ /* Set line position if needed. We don't want to if we don't need \r
+ to because LCD control operations take longer than LCD data\r
+ operations. */\r
+ if( next_pos != position)\r
+ {\r
+ if(position < LCD_LINE2)\r
+ {\r
+ /* Display on Line 1 */\r
+ LCD_write(CTRL_WR, (unsigned char)(LCD_HOME_L1 + position) );\r
+ }\r
+ else\r
+ {\r
+ /* Display on Line 2 */\r
+ LCD_write(CTRL_WR, (unsigned char)(LCD_HOME_L2 + position - LCD_LINE2) );\r
+ }\r
+ /* set position index to known value */\r
+ next_pos = position; \r
+ }\r
+\r
+ do\r
+ {\r
+ LCD_write(DATA_WR,*string++);\r
+ /* increment position index */\r
+ next_pos++; \r
+ }\r
+ while(*string);\r
+}\r
+/**********************************************************************************\r
+End of function DisplayString\r
+***********************************************************************************/ \r
+\r
+/*****************************************************************************\r
+Name: LCD_write\r
+Parameters: value - the value to write\r
+ data_or_ctrl - To write value as DATA or CONTROL\r
+ 1 = DATA\r
+ 0 = CONTROL\r
+Returns: none\r
+\r
+Description: Writes data to display. Sends command to display. \r
+*****************************************************************************/\r
+void LCD_write(unsigned char data_or_ctrl, unsigned char value)\r
+{\r
+ /* Write upper nibble first */\r
+ LCD_nibble_write(data_or_ctrl, (value & 0xF0) >> 4);\r
+\r
+ /* Write lower nibble second */\r
+ LCD_nibble_write(data_or_ctrl, (value & 0x0F));\r
+}\r
+/**********************************************************************************\r
+End of function LCD_write\r
+***********************************************************************************/ \r
+\r
+/*****************************************************************************\r
+Name: LCD_nibble_write\r
+Parameters: value - the value to write\r
+ data_or_ctrl - To write value as DATA or CONTROL\r
+ 1 = DATA\r
+ 0 = CONTROL\r
+Returns: none\r
+\r
+Description: Writes data to display. Sends command to display. \r
+*****************************************************************************/\r
+void LCD_nibble_write(unsigned char data_or_ctrl, unsigned char value)\r
+{\r
+ unsigned char ucStore;\r
+ if (data_or_ctrl == DATA_WR)\r
+ {\r
+ RS_PIN = SET_BIT_HIGH;\r
+ }\r
+ else\r
+ {\r
+ RS_PIN = SET_BIT_LOW;\r
+ }\r
+ /* There must be 40ns between RS write and EN write */\r
+ DisplayDelay(1);\r
+ /* EN enable chip (HIGH) */\r
+ EN_PIN = SET_BIT_HIGH;\r
+ /* Tiny delay */ \r
+ DisplayDelay(1);\r
+ /* Clear port bits used */ \r
+ /* Set upper lower 4 bits of nibble on port pins. */\r
+ ucStore = DATA_PORT;\r
+ ucStore &= ~DATA_PORT_MASK;\r
+ /* OR in data */ \r
+ ucStore |= ((value << DATA_PORT_SHIFT) & DATA_PORT_MASK );\r
+ /* Write lower 4 bits of nibble */\r
+ DATA_PORT = ucStore;\r
+\r
+ /* write delay while En High */\r
+ DisplayDelay(20);\r
+ /* Latch data by dropping EN */ \r
+ EN_PIN = SET_BIT_LOW;\r
+ /* Data hold delay */ \r
+ DisplayDelay(20); \r
+\r
+ if(data_or_ctrl == CTRL_WR)\r
+ {\r
+ /* Extra delay needed for control writes */\r
+ DisplayDelay(40); \r
+ } \r
+}\r
+/**********************************************************************************\r
+End of function LCD_nibble_write\r
+***********************************************************************************/ \r
+\r
+/*****************************************************************************\r
+Name: DisplayDelay \r
+Parameters: units - Approximately in microseconds \r
+Returns: none \r
+\r
+Description: Delay routine for LCD display.\r
+*****************************************************************************/\r
+void DisplayDelay(unsigned long int units)\r
+{\r
+ unsigned long counter = units * DELAY_TIMING;\r
+ while(counter--)\r
+ {\r
+ nop(); // ~ 10ns\r
+ }\r
+}\r
+/**********************************************************************************\r
+End of function DisplayDelay\r
+***********************************************************************************/ \r
+\r
+\r
+void prvLCDTaskLine1( void *pvParameters )\r
+{\r
+ #define RIGHT_TO_LEFT 0\r
+ #define LEFT_TO_RIGHT 1\r
+ \r
+ struct _LCD_Params *Local_Params = (struct _LCD_Params*)pvParameters;\r
+ \r
+ char str_lcd[9];\r
+ unsigned short pos = 0;\r
+ unsigned char Direction = RIGHT_TO_LEFT;\r
+ \r
+ for(;;)\r
+ {\r
+ vTaskDelay( Local_Params->Speed / portTICK_RATE_MS ); \r
+\r
+ strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);\r
+ \r
+ xSemaphoreTake( LCD_Mutex, portMAX_DELAY );\r
+ DisplayString(Local_Params->Line, str_lcd);\r
+ xSemaphoreGive( LCD_Mutex );\r
+ \r
+ if(Direction == RIGHT_TO_LEFT)\r
+ {\r
+ pos++;\r
+ if( pos == strlen(datastring) - 7)\r
+ {\r
+ Direction = LEFT_TO_RIGHT;\r
+ pos--; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ pos--;\r
+ if( pos == 0 )\r
+ {\r
+ Direction = RIGHT_TO_LEFT; \r
+ }\r
+ } \r
+ }\r
+}\r
+\r
+void prvLCDTaskLine2( void *pvParameters )\r
+{\r
+ #define RIGHT_TO_LEFT 0\r
+ #define LEFT_TO_RIGHT 1\r
+ #define RUNNING 0\r
+ #define STOPPED 1\r
+\r
+ \r
+ struct _LCD_Params *Local_Params = (struct _LCD_Params*)pvParameters;\r
+ \r
+ char str_lcd[9];\r
+ unsigned short pos = 0;\r
+ unsigned char Direction = RIGHT_TO_LEFT;\r
+ unsigned char Status = RUNNING;\r
+ \r
+ unsigned char QueueData;\r
+ portTickType Delay = ( Local_Params->Speed / portTICK_RATE_MS );\r
+ \r
+ for(;;)\r
+ {\r
+// vTaskDelay( Local_Params->Speed / portTICK_RATE_MS ); \r
+\r
+ if( xQueueReceive (SwitchQueue, &QueueData, Delay) != pdPASS )\r
+ {\r
+ strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);\r
+ \r
+ xSemaphoreTake( LCD_Mutex, portMAX_DELAY );\r
+ DisplayString(Local_Params->Line, str_lcd);\r
+ xSemaphoreGive( LCD_Mutex );\r
+ \r
+ if(Direction == RIGHT_TO_LEFT)\r
+ {\r
+ pos++;\r
+ if( pos == strlen(datastring) - 7)\r
+ {\r
+ Direction = LEFT_TO_RIGHT;\r
+ pos--; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ pos--;\r
+ if( pos == 0 )\r
+ {\r
+ Direction = RIGHT_TO_LEFT; \r
+ }\r
+ } \r
+ }\r
+ else\r
+ {\r
+ if(QueueData == 0x02) // stop/start\r
+ {\r
+ if(Delay != portMAX_DELAY)\r
+ {\r
+ Delay = portMAX_DELAY;\r
+ Status = STOPPED;\r
+ }\r
+ else\r
+ {\r
+ Delay = ( Local_Params->Speed / portTICK_RATE_MS );\r
+ Status = RUNNING;\r
+ } \r
+ }\r
+ \r
+ if(QueueData == 0x01) // RIGHT or shift back\r
+ {\r
+ if(Status == STOPPED)\r
+ {\r
+ if(pos != 0)\r
+ {\r
+ pos--;\r
+ \r
+ strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);\r
+ \r
+ xSemaphoreTake( LCD_Mutex, portMAX_DELAY );\r
+ DisplayString(Local_Params->Line, str_lcd);\r
+ xSemaphoreGive( LCD_Mutex );\r
+ }\r
+ }\r
+ }\r
+ \r
+ if(QueueData == 0x03) // LEFT or shift forward\r
+ {\r
+ if(Status == STOPPED)\r
+ {\r
+ if(pos != strlen(datastring) - 7)\r
+ {\r
+ pos++;\r
+ strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);\r
+ \r
+ xSemaphoreTake( LCD_Mutex, portMAX_DELAY );\r
+ DisplayString(Local_Params->Line, str_lcd);\r
+ xSemaphoreGive( LCD_Mutex );\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+#ifndef LCD_H\r
+#define LCD_H\r
+/***********************************************************************************\r
+\r
+FILE NAME lcd.h\r
+\r
+DESCRIPTION Driver for KS0066u LCD Module Controller (8 characters by 2 lines )\r
+ on the Renesas RSK boards - header file\r
+\r
+Copyright : 2006 Renesas Technology Europe Ltd.\r
+Copyright : 2006 Renesas Technology Corporation.\r
+All Rights Reserved\r
+***********************************************************************************/\r
+\r
+/***********************************************************************************\r
+Revision History\r
+DD.MM.YYYY OSO-UID Description\r
+26.07.2006 RTE-MBA First Release\r
+***********************************************************************************/\r
+void InitialiseDisplay( void );\r
+void DisplayString(unsigned char position, char * string);\r
+void LCD_write(unsigned char data_or_ctrl, unsigned char value);\r
+void LCD_nibble_write(unsigned char data_or_ctrl, unsigned char value);\r
+void DisplayDelay(unsigned long int units);\r
+\r
+\r
+#define SET_BIT_HIGH (1) \r
+#define SET_BIT_LOW (0) \r
+#define SET_BYTE_HIGH (0xFF) \r
+#define SET_BYTE_LOW (0x00) \r
+\r
+struct _LCD_Params {\r
+ unsigned char Line;\r
+ unsigned short Speed;\r
+ char *ptr_str;\r
+};\r
+\r
+void prvLCDTaskLine1( void *pvParameters );\r
+void prvLCDTaskLine2( void *pvParameters );\r
+\r
+\r
+/* RS Register Select pin */\r
+#define RS_PIN PORTJ.PODR.BIT.B1\r
+/* Display Enable pin */ \r
+#define EN_PIN PORTJ.PODR.BIT.B3\r
+/* Data bus port */\r
+#define DATA_PORT PORTH.PODR.BYTE\r
+/* Bit mask from entire port */ \r
+#define DATA_PORT_MASK 0x0F\r
+/* Number of bits data needs to shift */\r
+#define DATA_PORT_SHIFT 0\r
+\r
+\r
+#define DATA_WR 1\r
+#define CTRL_WR 0\r
+\r
+/* Set to ensure base delay of 1microS minimum */\r
+//#define DELAY_TIMING 0x2F\r
+#define DELAY_TIMING 50\r
+/* number of lines on the LCD display */\r
+#define NUMB_CHARS_PER_LINE 8\r
+/* Maximum charactors per line of LCD display. */ \r
+#define MAXIMUM_LINES 2 \r
+\r
+#define LCD_LINE1 0\r
+#define LCD_LINE2 16\r
+\r
+/**********************************************************************************/\r
+/* LCD commands - use LCD_write function to write these commands to the LCD. */\r
+/**********************************************************************************/\r
+/* Clear LCD display and home cursor */\r
+#define LCD_CLEAR 0x01\r
+/* move cursor to line 1 */\r
+#define LCD_HOME_L1 0x80\r
+/* move cursor to line 2 */ \r
+#define LCD_HOME_L2 0xC0\r
+/* Cursor auto decrement after R/W */ \r
+#define CURSOR_MODE_DEC 0x04\r
+/* Cursor auto increment after R/W */\r
+#define CURSOR_MODE_INC 0x06\r
+/* Setup, 4 bits,2 lines, 5X7 */\r
+#define FUNCTION_SET 0x28\r
+/* Display ON with Cursor */\r
+#define LCD_CURSOR_ON 0x0E\r
+/* Display ON with Cursor off */\r
+#define LCD_CURSOR_OFF 0x0C\r
+/* Display on with blinking cursor */\r
+#define LCD_CURSOR_BLINK 0x0D\r
+/*Move Cursor Left One Position */\r
+#define LCD_CURSOR_LEFT 0x10\r
+/* Move Cursor Right One Position */\r
+#define LCD_CURSOR_RIGHT 0x14\r
+\r
+#define LCD_DISPLAY_ON 0x04\r
+#define LCD_TWO_LINE 0x08\r
+\r
+#endif
\ No newline at end of file
+++ /dev/null
-/*------------------------------------------------------------------------/\r
-/ EZ-LCD - Generic control module for HD44780 LCDC - R0.01c\r
-/-------------------------------------------------------------------------/\r
-/\r
-/ Copyright (C) 2010, ChaN, all right reserved.\r
-/\r
-/ * This software is a free software and there is NO WARRANTY.\r
-/ * No restriction on use. You can use, modify and redistribute it for\r
-/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.\r
-/ * Redistributions of source code must retain the above copyright notice.\r
-/\r
-/-------------------------------------------------------------------------/\r
-/ Nov 12,'10 R0.01c First release.\r
-/------------------------------------------------------------------------*/\r
-#include <machine.h>\r
-#include "hd44780.h"\r
-\r
-/*-------------------------------------------------------------------------*/\r
-/* Platform dependent macros and functions needed to be modified */\r
-/*-------------------------------------------------------------------------*/\r
-\r
-/* Bus controls */\r
-#include "iodefine.h" /* Device specific include file */\r
-#include "rskrx210def.h"\r
-\r
-#define IF_BUS 4 /* Data bus width (4 or 8) */\r
-#define IF_INIT() {} /* Initialize control port */\r
-#define E1_HIGH() LCD_EN = 1 /* Set E(E1) high */\r
-#define E1_LOW() LCD_EN = 0 /* Set E(E1) low */\r
-#define E2_HIGH() /* Set E2 high (dual controller only) */\r
-#define E2_LOW() /* Set E2 low (dual controller only) */\r
-#define RS_HIGH() LCD_RS = 1 /* Set RS high */\r
-#define RS_LOW() LCD_RS = 0 /* Set RS low */\r
-#define OUT_DATA(d) LCD_DATA = (d & 0x0F)//LCD_DATA = ((LCD_DATA & 0xF0) | (d & 0x0F)) /* Output a byte d on the data bus (higher 4 bits of d in 4-bit mode) */\r
-#define IF_DLY60() {nop();nop();nop(); } /* Delay >=60ns (can be blanked for most uC) */\r
-#define IF_DLY450() {unsigned long x; for(x=0; x<22; x++){nop();}} /* Delay >=450ns@3V, >=250ns@5V */\r
-#define DELAY_US(n) {unsigned long x; for(x=0; x<(n*50); x++){nop();}} /* Delay n microseconds */\r
-\r
-/* Characteristics of LCD module */\r
-#define LCD_ETIME_1 1530 /* Execution time of Clear Display command [us] */\r
-#define LCD_ETIME_2 43 /* Execution time of other command and data write [us] */\r
-#define LCD_DLF 2.0 /* Delay factor (>=2.0) */\r
-\r
-\r
-\r
-/*-------------------------------------------------------------------------*/\r
-\r
-\r
-#if _LCD_ROWS >= 2 || _LCD_COLS > 8\r
- #define LCD_IF_2ROW 8 /* 2-row cfg. */\r
- #if _LCD_ROWS == 1\r
- #define LCD_IF_SPLIT 1 /* Half split row */\r
- #else\r
- #define LCD_IF_SPLIT 0 /* Direct row */\r
- #endif\r
-#else\r
- #define LCD_IF_2ROW 0 /* 1-row cfg. */\r
-#endif\r
-\r
-#if _LCD_ROWS == 4 && _LCD_COLS <= 20\r
- #define LCD_IF_ALTROW 1 /* Alternate row layout */\r
-#else\r
- #define LCD_IF_ALTROW 0 /* Incremental row layout */\r
-#endif\r
-\r
-#if _LCD_ROWS == 4 && _LCD_COLS > 20\r
- #define LCD_IF_DUAL 1 /* Dual controller */\r
-#else\r
- #define LCD_IF_DUAL 0 /* Single controller */\r
-#endif\r
-\r
-#define LCD_DT1 ((uint16_t)(LCD_ETIME_1 * LCD_DLF))\r
-#define LCD_DT2 ((uint16_t)(LCD_ETIME_2 * LCD_DLF))\r
-\r
-\r
-\r
-static\r
-uint8_t Row, Column; /* Current cursor position */\r
-#if _USE_CURSOR\r
-static\r
-uint8_t Csr; /* Current cursor state */\r
-#endif\r
-\r
-\r
-\r
-\r
-/*----------------------------------------------*/\r
-/* Write a byte to the LCD controller */\r
-/*----------------------------------------------*/\r
-\r
-static\r
-void lcd_write (\r
- uint8_t reg, /* b0:command(0)/data(1), b2..1:E1(2)/E2(1)/both(0)(don't care on single controller), b3:write high nibble only(don't care on 8-bit bus) */\r
- uint8_t dat /* Byte to be written */\r
-)\r
-{\r
- if (reg & 1) /* Select register */\r
- RS_HIGH();\r
- else\r
- RS_LOW();\r
- IF_DLY60();\r
-\r
-#if IF_BUS == 4\r
- if (!(reg & 8)) {\r
- OUT_DATA(dat);\r
-#if LCD_IF_DUAL\r
- if (!(reg & 2)) E1_HIGH();\r
- if (!(reg & 4)) E2_HIGH();\r
- IF_DLY450();\r
- E1_LOW();\r
- E2_LOW();\r
-#else\r
- E1_HIGH();\r
- IF_DLY450();\r
- E1_LOW();\r
-#endif\r
- IF_DLY450();\r
- dat <<= 4;\r
- }\r
-#endif\r
-\r
- OUT_DATA(dat);\r
-#if LCD_IF_DUAL\r
- if (!(reg & 2)) E1_HIGH();\r
- if (!(reg & 4)) E2_HIGH();\r
- IF_DLY450();\r
- E1_LOW();\r
- E2_LOW();\r
-#else\r
- E1_HIGH();\r
- IF_DLY450();\r
- E1_LOW();\r
-#endif\r
-\r
- DELAY_US(LCD_DT2); /* Always use timer */\r
-}\r
-\r
-\r
-\r
-/*-----------------------------------------------------------------------*/\r
-/* Initialize LCD module */\r
-/*-----------------------------------------------------------------------*/\r
-\r
-void lcd_init (void)\r
-{\r
- uint8_t d;\r
- \r
- E1_HIGH();\r
- DELAY_US(40000);\r
- E1_LOW();\r
-\r
-// IF_INIT();\r
-\r
-// DELAY_US(40000);\r
- lcd_write(8, 0x30);\r
- DELAY_US(4100);\r
- lcd_write(8, 0x30);\r
- DELAY_US(100);\r
- lcd_write(8, 0x30);\r
-\r
- d = (IF_BUS == 4 ? 0x20 : 0x30) | LCD_IF_2ROW;\r
- lcd_write(8, d);\r
-#if IF_BUS == 4\r
- lcd_write(0, d);\r
-#endif\r
- lcd_write(0, 0x08);\r
- lcd_write(0, 0x01);\r
- DELAY_US(LCD_DT1);\r
- lcd_write(0, 0x06);\r
- lcd_write(0, 0x0C);\r
-\r
- Row = Column = 0;\r
-#if _USE_CURSOR\r
- Csr = 0;\r
-#endif\r
-}\r
-\r
-\r
-\r
-/*-----------------------------------------------------------------------*/\r
-/* Set cursor position */\r
-/*-----------------------------------------------------------------------*/\r
-\r
-void lcd_locate (\r
- uint8_t row, /* Cursor row position (0.._LCD_ROWS-1) */\r
- uint8_t col /* Cursor column position (0.._LCD_COLS-1) */\r
-)\r
-{\r
- Row = row; Column = col;\r
-\r
- if (row < _LCD_ROWS && col < _LCD_COLS) {\r
- if (_LCD_COLS >= 2 && (row & 1)) col += 0x40;\r
- if (LCD_IF_SPLIT && col >= _LCD_COLS / 2) col += 0x40 - _LCD_COLS / 2;\r
- if (LCD_IF_ALTROW && (row & 2)) col += _LCD_COLS;\r
- col |= 0x80;\r
- } else {\r
- col = 0x0C;\r
- }\r
-\r
-#if LCD_IF_DUAL\r
- if (_USE_CURSOR && !(row &= 2)) row |= 4;\r
- lcd_write(row, col);\r
-#if _USE_CURSOR\r
- if (col != 0x0C) lcd_write(row, Csr | 0x0C);\r
- row ^= 6;\r
- lcd_write(row, 0x0C);\r
-#endif\r
-#else\r
- lcd_write(0, col);\r
-#if _USE_CURSOR\r
- if (col != 0x0C) lcd_write(0, Csr | 0x0C);\r
-#endif\r
-#endif\r
-}\r
-\r
-\r
-\r
-/*-----------------------------------------------------------------------*/\r
-/* Put a character */\r
-/*-----------------------------------------------------------------------*/\r
-\r
-void lcd_putc (\r
- uint8_t chr\r
-)\r
-{\r
- if (chr == '\f') { /* Clear Screen and Return Home */\r
- lcd_write(0, 0x01);\r
- DELAY_US(LCD_DT1);\r
- lcd_locate(0, 0);\r
- return;\r
- }\r
-\r
- if (Row >= _LCD_ROWS) return;\r
-\r
- if (chr == '\r') { /* Cursor return */\r
- lcd_locate(Row, 0);\r
- return;\r
- }\r
- if (chr == '\n') { /* Next row */\r
- lcd_locate(Row + 1, 0);\r
- return;\r
- }\r
- if (chr == '\b') { /* Cursor back */\r
- if (Column)\r
- lcd_locate(Row, Column - 1);\r
- return;\r
- }\r
-\r
- if (Column >= _LCD_COLS) return;\r
-\r
- lcd_write((LCD_IF_DUAL && Row >= 2) ? 3 : 5, chr);\r
- Column++;\r
-\r
- if (LCD_IF_SPLIT && Column == _LCD_COLS / 2)\r
- lcd_write(0, 0x40);\r
-\r
- if (Column >= _LCD_COLS)\r
- lcd_locate(Row + 1, 0);\r
-}\r
-\r
-\r
-\r
-/*-----------------------------------------------------------------------*/\r
-/* Set cursor form */\r
-/*-----------------------------------------------------------------------*/\r
-\r
-#if _USE_CURSOR\r
-void lcd_cursor (\r
- uint8_t stat /* 0:off, 1:blinking block, 2:under-line */\r
-)\r
-{\r
- Csr = stat & 3;\r
- lcd_locate(Row, Column);\r
-}\r
-#endif\r
-\r
-\r
-\r
-/*-----------------------------------------------------------------------*/\r
-/* Register user character pattern */\r
-/*-----------------------------------------------------------------------*/\r
-\r
-#if _USE_CGRAM\r
-void lcd_setcg (\r
- uint8_t chr, /* Character code to be registered (0..7) */\r
- uint8_t n, /* Number of characters to register */\r
- const uint8_t* p /* Pointer to the character pattern (8 * n bytes) */\r
-)\r
-{\r
- lcd_write(0, 0x40 | chr * 8);\r
- n *= 8;\r
- do\r
- lcd_write(1, *p++);\r
- while (--n);\r
-\r
- lcd_locate(Row, Column);\r
-}\r
-#endif\r
-\r
-\r
-\r
-/*-----------------------------------------------------------------------*/\r
-/* Put a fuel indicator */\r
-/*-----------------------------------------------------------------------*/\r
-\r
-#if _USE_FUEL && _USE_CGRAM\r
-void lcd_put_fuel (\r
- int8_t val, /* Fuel level (-1:plugged, 0:empty cell, ..., 5:full cell) */\r
- uint8_t chr /* User character to use */\r
-)\r
-{\r
- static const uint8_t plg[8] = {10,10,31,31,14,4,7,0};\r
- uint8_t gfx[8], d, *p;\r
- int8_t i;\r
-\r
-\r
- if (val >= 0) { /* Cell (0..5) */\r
- p = &gfx[8];\r
- *(--p) = 0; *(--p) = 0x1F;\r
- for (i = 1; i <= 5; i++) {\r
- d = 0x1F;\r
- if (val < i) d = (i == 5) ? 0x1B : 0x11;\r
- *(--p) = d;\r
- }\r
- *(--p) = 0x0E;\r
- } else { /* Plug (-1) */\r
- p = (uint8_t*)plg;\r
- }\r
- lcd_setcg(chr, 1, p);\r
- lcd_putc(chr);\r
-}\r
-\r
-\r
-#endif\r
-\r
-\r
-\r
-/*-----------------------------------------------------------------------*/\r
-/* Draw bargraph */\r
-/*-----------------------------------------------------------------------*/\r
-\r
-#if _USE_BAR && _USE_CGRAM\r
-void lcd_put_bar (\r
- uint16_t val, /* Bar length (0 to _MAX_BAR represents bar length from left end) */\r
- uint8_t width, /* Display area (number of chars from cursor position) */\r
- uint8_t chr /* User character code (2 chars used from this) */\r
-)\r
-{\r
- static const uint8_t ptn[] = {\r
- 0xE0, 0xE0, 0xE0, 0xC0, 0xC0, 0xC0, 0x80, 0,\r
- 0xF0, 0xE0, 0xE0, 0xE0, 0xC0, 0xC0, 0xC0, 0,\r
- 0xF0, 0xF0, 0xE0, 0xE0, 0xE0, 0xC0, 0xC0, 0\r
- };\r
- const uint8_t *pp;\r
- uint16_t n, m, s, gi;\r
- uint8_t gfx[16];\r
-\r
-\r
- for (n = 0; n < 16; n++) /* Register common pattern (space/fill) */\r
- gfx[n] = n < 7 ? 0 : 0xFF;\r
- lcd_setcg(_BASE_GRAPH, 2, gfx);\r
-\r
- /* Draw edge pattern into gfx[] */\r
- val = (unsigned long)val * (width * 18) / (_MAX_BAR + 1);\r
- pp = &ptn[(val % 3) * 8]; /* Get edge pattern */\r
- s = val / 3 % 6; /* Bit shift */\r
- for (n = 0; n < 7; n++) { /* Draw edge pattern into the pattern buffer */\r
- m = (*pp++ | 0xFF00) >> s;\r
- gfx[n] = m;\r
- gfx[n + 8] = m >> 6;\r
- }\r
-\r
- /* Put graphic pattern into the LCD module */\r
- gi = val / 18; /* Indicator start position */\r
- for (n = 1; n <= width; n++) { /* Draw each location in the bargraph */\r
- if (n == gi) { /* When edge pattern is exist at the location */\r
- m = chr + 1; /* A edge pattern */\r
- } else {\r
- if (n == gi + 1) {\r
- lcd_setcg(chr, 2, gfx); /* Register edge pattern */\r
- m = chr;\r
- } else {\r
- m = (n >= gi) ? _BASE_GRAPH : _BASE_GRAPH + 1; /* A space or fill */\r
- }\r
- }\r
- lcd_putc(m); /* Put the character into the LCD */\r
- }\r
-}\r
-#endif\r
-\r
-\r
-\r
-/*-----------------------------------------------------------------------*/\r
-/* Draw point indicator */\r
-/*-----------------------------------------------------------------------*/\r
-\r
-#if _USE_POINT && _USE_CGRAM\r
-void lcd_put_point (\r
- uint16_t val, /* Dot position (0 to _MAX_POINT represents left end to write end) */\r
- uint8_t width, /* Display area (number of chars from cursor position) */\r
- uint8_t chr /* User character code (2 chars used from this) */\r
-)\r
-{\r
- static const uint8_t ptn[] = {\r
- 0x06, 0x0C, 0x0C, 0x0C, 0x18, 0x18, 0x18, 0,\r
- 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x18, 0x18, 0,\r
- 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x18, 0\r
- };\r
- const uint8_t *pp;\r
- uint16_t n, m, s, gi;\r
- uint8_t gfx[16];\r
-\r
-\r
- for (n = 0; n < 16; n++) /* Register common pattern (space) */\r
- gfx[n] = n < 7 ? 0 : 0xFF;\r
- lcd_setcg(_BASE_GRAPH, 1, gfx);\r
-\r
- /* Draw edge pattern into gfx[] */\r
- val = (uint32_t)val * (width * 18 - 12) / (_MAX_BAR + 1);\r
- pp = &ptn[(val % 3) * 8]; /* Get edge pattern */\r
- s = val / 3 % 6; /* Bit shift */\r
- for (n = 0; n < 7; n++) { /* Draw edge pattern into the pattern buffer */\r
- m = *pp++; m <<= 6; m >>= s;\r
- gfx[n] = m;\r
- gfx[n + 8] = m >> 6;\r
- }\r
- lcd_setcg(chr, 2, gfx); /* Register dot pattern */\r
-\r
- /* Put graphic pattern into the LCD module */\r
- gi = val / 18; /* Indicator start position */\r
- for (n = 0; n < width; n++) { /* Draw each location in the bargraph */\r
- if (n == gi) { /* When edge pattern is exist at the location */\r
- m = chr + 1; /* A edge pattern */\r
- } else {\r
- if (n == gi + 1)\r
- m = chr;\r
- else\r
- m = _BASE_GRAPH; /* A space */\r
- }\r
- lcd_putc(m); /* Put the character into the LCD */\r
- }\r
-}\r
-#endif\r
-\r
-\r
+++ /dev/null
-/*-----------------------------------------------------------------------*/\r
-/* EZ-LCD - Generic control module include/configuration file */\r
-/*-----------------------------------------------------------------------*/\r
-\r
-#ifndef _EZ_LCD\r
-#define _EZ_LCD\r
-\r
-/*--------------------------------------------------*/\r
-/* Configuration Options */\r
-/*--------------------------------------------------*/\r
-\r
-#define _LCD_ROWS 2 /* Number of Rows (1,2 or 4) */\r
-#define _LCD_COLS 8 /* Number of Columns (8..40) */\r
-\r
-#define _USE_CURSOR 0 /* 1:Enable lcd_cursor function */\r
-#define _USE_CGRAM 0 /* 1:Enable lcd_setcg function */\r
-\r
-#define _USE_FUEL 0 /* 1:Enable lcd_put_fuel function (_USE_CGRAM must be 1) */\r
-\r
-#define _USE_BAR 0 /* 1:Enable lcd_put_bar function (_USE_CGRAM must be 1) */\r
-#define _MAX_BAR 255 /* Maximum value for lcd_put_bar function */\r
-\r
-#define _USE_POINT 0 /* 1:Enable lcd_put_point function (_USE_CGRAM must be 1) */\r
-#define _MAX_POINT 255 /* Maximum value for lcd_put_point function */\r
-\r
-#define _BASE_GRAPH 0 /* Common user character used by lcd_put_bar/lcd_put_point function (2 chars from this) */\r
-\r
-\r
-\r
-/*--------------------------------------------------*/\r
-/* API declareations */\r
-/*--------------------------------------------------*/\r
-\r
-#include <stdint.h>\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-void lcd_init (void);\r
-void lcd_locate (uint8_t, uint8_t);\r
-void lcd_putc (uint8_t);\r
-void lcd_cursor (uint8_t);\r
-void lcd_setcg (uint8_t, uint8_t, const uint8_t*);\r
-void lcd_put_fuel (int8_t, uint8_t);\r
-void lcd_put_bar (uint16_t, uint8_t, uint8_t);\r
-void lcd_put_point (uint16_t, uint8_t, uint8_t);\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#define CSR_OFF 0\r
-#define CSR_BLOCK 1\r
-#define CSR_UNDER 2\r
-\r
-\r
-#endif /* #ifndef _EZLCD */\r
+++ /dev/null
-/***********************************************************************************\r
-Filename: lcd.c\r
-DESCRIPTION LCD Module utility functions.\r
- Written for KS0066u compatible LCD Module.\r
- (8 characters by 2 lines)\r
-\r
-Copyright : 2006 Renesas Technology Europe Ltd.\r
-Copyright : 2006 Renesas Technology Corporation.\r
-All Rights Reserved\r
-\r
-***********************************************************************************/\r
-\r
-/***********************************************************************************\r
-Revision History\r
-DD.MM.YYYY OSO-UID Description\r
-26.07.2006 RTE-MBA First Release\r
-***********************************************************************************/\r
-\r
-/**********************************************************************************\r
-System Includes\r
-***********************************************************************************/\r
-#include <machine.h>\r
-\r
-/**********************************************************************************\r
-User Includes\r
-***********************************************************************************/\r
-/* iodefine.h provides a structure to access all of the device registers. */\r
-#include "iodefine.h"\r
-/* rsk1664def.h provides common defines for widely used items. */\r
-#include "rskrx210def.h"\r
-#include "lcd.h"\r
-\r
-/* Kernel includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-#include "semphr.h"\r
-\r
-\r
-/**********************************************************************************\r
-Global variables\r
-***********************************************************************************/\r
-xQueueHandle SwitchQueue;\r
-xSemaphoreHandle LCD_Mutex;\r
-\r
-char datastring[]=\r
-"........Rx210 Highlights....1.56 DMips/MHz....DSP functions....1.62V-5.5V operation....200 uA/MHz....Up to 512 kBytes Flash....up to 64 kbytes SRAM....EE Dataflash with 100k w/e....1.3 uA in Real Time Clock Mode....Powerful Motor control timer....4 x 16-bit timers....4 x 8-bit timers....Full Real Time Clock calendar with calibration and alarm functions....Up to 16 channels 1 uS 12-bit ADC, with Dual group programmable SCAN, 3 sample and holds, sample accumulate function....DMA controller....Data Transfer Controller....Up to 9 serial Channels....Up to 6 USARTs ( with Simple I2C / SPI )....USART ( with unique Frame based protocol support )....Multimaster IIC....RSPI....Temperature Sensor....Event Link Controller....Comparators....Safety features include CRC....March X....Dual watchdog Timers with window and independent oscillator....ADC self test....I/O Pin Test....Supported with E1 on chip debugger and RSK210 evaluation system....Rx210 Highlights........";\r
-\r
-\r
-\r
-struct _LCD_Params Line1 = \r
-{\r
- LCD_LINE1, 215, datastring \r
-};\r
-\r
-struct _LCD_Params Line2 = \r
-{\r
- LCD_LINE2, 350, datastring \r
-};\r
-\r
-\r
-\r
-/**********************************************************************************\r
-User Program Code\r
-***********************************************************************************/\r
-\r
-/*****************************************************************************\r
-Name: InitDisplay \r
-Parameters: none \r
-Returns: none\r
-Description: Intializes the LCD display. \r
-*****************************************************************************/\r
-void InitialiseDisplay( void )\r
-{\r
- /* Power Up Delay for LCD Module */\r
- EN_PIN = SET_BIT_HIGH;\r
- DisplayDelay(7000);\r
- EN_PIN = SET_BIT_LOW;\r
- \r
- /* Display initialises in 8 bit mode - so send one write (seen as 8 bit)\r
- to set to 4 bit mode. */\r
-\r
- /* Function Set */\r
- LCD_nibble_write(CTRL_WR,0x03);\r
- LCD_nibble_write(CTRL_WR,0x03);\r
- DisplayDelay(39);\r
- \r
- /* Configure display */\r
- LCD_nibble_write(CTRL_WR,0x03);\r
- LCD_nibble_write(CTRL_WR,0x02);\r
- LCD_nibble_write(CTRL_WR,(LCD_DISPLAY_ON | LCD_TWO_LINE ));\r
- LCD_nibble_write(CTRL_WR,(LCD_DISPLAY_ON | LCD_TWO_LINE ));\r
- DisplayDelay(39);\r
-\r
- /* Display ON/OFF control */\r
- LCD_write(CTRL_WR,LCD_CURSOR_OFF);\r
- DisplayDelay(39);\r
-\r
- /* Display Clear */\r
- LCD_write(CTRL_WR,LCD_CLEAR);\r
- DisplayDelay(1530);\r
-\r
- /* Entry Mode Set */\r
- LCD_write(CTRL_WR,0x06);\r
- LCD_write(CTRL_WR,LCD_HOME_L1);\r
-}\r
-/**********************************************************************************\r
-End of function InitialiseDisplay\r
-***********************************************************************************/ \r
-\r
-/*****************************************************************************\r
-Name: DisplayString \r
-Parameters: position Line number of display\r
- string Pointer to data to be written to display.\r
- Last character should be null.\r
-Returns: none\r
-\r
-Description: This function controls LCD writes to line 1 or 2 of the LCD.\r
- You need to use the defines LCD_LINE1 and LCD_LINE2 in order\r
- to specify the starting position.\r
- For example, to start at the 2nd position on line 1...\r
- DisplayString(LCD_LINE1 + 1, "Hello")\r
-*****************************************************************************/\r
-void DisplayString(unsigned char position, char * string)\r
-{\r
- static unsigned char next_pos = 0xFF;\r
-\r
- /* Set line position if needed. We don't want to if we don't need \r
- to because LCD control operations take longer than LCD data\r
- operations. */\r
- if( next_pos != position)\r
- {\r
- if(position < LCD_LINE2)\r
- {\r
- /* Display on Line 1 */\r
- LCD_write(CTRL_WR, (unsigned char)(LCD_HOME_L1 + position) );\r
- }\r
- else\r
- {\r
- /* Display on Line 2 */\r
- LCD_write(CTRL_WR, (unsigned char)(LCD_HOME_L2 + position - LCD_LINE2) );\r
- }\r
- /* set position index to known value */\r
- next_pos = position; \r
- }\r
-\r
- do\r
- {\r
- LCD_write(DATA_WR,*string++);\r
- /* increment position index */\r
- next_pos++; \r
- }\r
- while(*string);\r
-}\r
-/**********************************************************************************\r
-End of function DisplayString\r
-***********************************************************************************/ \r
-\r
-/*****************************************************************************\r
-Name: LCD_write\r
-Parameters: value - the value to write\r
- data_or_ctrl - To write value as DATA or CONTROL\r
- 1 = DATA\r
- 0 = CONTROL\r
-Returns: none\r
-\r
-Description: Writes data to display. Sends command to display. \r
-*****************************************************************************/\r
-void LCD_write(unsigned char data_or_ctrl, unsigned char value)\r
-{\r
- /* Write upper nibble first */\r
- LCD_nibble_write(data_or_ctrl, (value & 0xF0) >> 4);\r
-\r
- /* Write lower nibble second */\r
- LCD_nibble_write(data_or_ctrl, (value & 0x0F));\r
-}\r
-/**********************************************************************************\r
-End of function LCD_write\r
-***********************************************************************************/ \r
-\r
-/*****************************************************************************\r
-Name: LCD_nibble_write\r
-Parameters: value - the value to write\r
- data_or_ctrl - To write value as DATA or CONTROL\r
- 1 = DATA\r
- 0 = CONTROL\r
-Returns: none\r
-\r
-Description: Writes data to display. Sends command to display. \r
-*****************************************************************************/\r
-void LCD_nibble_write(unsigned char data_or_ctrl, unsigned char value)\r
-{\r
- unsigned char ucStore;\r
- if (data_or_ctrl == DATA_WR)\r
- {\r
- RS_PIN = SET_BIT_HIGH;\r
- }\r
- else\r
- {\r
- RS_PIN = SET_BIT_LOW;\r
- }\r
- /* There must be 40ns between RS write and EN write */\r
- DisplayDelay(1);\r
- /* EN enable chip (HIGH) */\r
- EN_PIN = SET_BIT_HIGH;\r
- /* Tiny delay */ \r
- DisplayDelay(1);\r
- /* Clear port bits used */ \r
- /* Set upper lower 4 bits of nibble on port pins. */\r
- ucStore = DATA_PORT;\r
- ucStore &= ~DATA_PORT_MASK;\r
- /* OR in data */ \r
- ucStore |= ((value << DATA_PORT_SHIFT) & DATA_PORT_MASK );\r
- /* Write lower 4 bits of nibble */\r
- DATA_PORT = ucStore;\r
-\r
- /* write delay while En High */\r
- DisplayDelay(20);\r
- /* Latch data by dropping EN */ \r
- EN_PIN = SET_BIT_LOW;\r
- /* Data hold delay */ \r
- DisplayDelay(20); \r
-\r
- if(data_or_ctrl == CTRL_WR)\r
- {\r
- /* Extra delay needed for control writes */\r
- DisplayDelay(40); \r
- } \r
-}\r
-/**********************************************************************************\r
-End of function LCD_nibble_write\r
-***********************************************************************************/ \r
-\r
-/*****************************************************************************\r
-Name: DisplayDelay \r
-Parameters: units - Approximately in microseconds \r
-Returns: none \r
-\r
-Description: Delay routine for LCD display.\r
-*****************************************************************************/\r
-void DisplayDelay(unsigned long int units)\r
-{\r
- unsigned long counter = units * DELAY_TIMING;\r
- while(counter--)\r
- {\r
- nop(); // ~ 10ns\r
- }\r
-}\r
-/**********************************************************************************\r
-End of function DisplayDelay\r
-***********************************************************************************/ \r
-\r
-\r
-void prvLCDTaskLine1( void *pvParameters )\r
-{\r
- #define RIGHT_TO_LEFT 0\r
- #define LEFT_TO_RIGHT 1\r
- \r
- struct _LCD_Params *Local_Params = (struct _LCD_Params*)pvParameters;\r
- \r
- char str_lcd[9];\r
- unsigned short pos = 0;\r
- unsigned char Direction = RIGHT_TO_LEFT;\r
- \r
- for(;;)\r
- {\r
- vTaskDelay( Local_Params->Speed / portTICK_RATE_MS ); \r
-\r
- strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);\r
- \r
- xSemaphoreTake( LCD_Mutex, portMAX_DELAY );\r
- DisplayString(Local_Params->Line, str_lcd);\r
- xSemaphoreGive( LCD_Mutex );\r
- \r
- if(Direction == RIGHT_TO_LEFT)\r
- {\r
- pos++;\r
- if( pos == strlen(datastring) - 7)\r
- {\r
- Direction = LEFT_TO_RIGHT;\r
- pos--; \r
- }\r
- }\r
- else\r
- {\r
- pos--;\r
- if( pos == 0 )\r
- {\r
- Direction = RIGHT_TO_LEFT; \r
- }\r
- } \r
- }\r
-}\r
-\r
-void prvLCDTaskLine2( void *pvParameters )\r
-{\r
- #define RIGHT_TO_LEFT 0\r
- #define LEFT_TO_RIGHT 1\r
- #define RUNNING 0\r
- #define STOPPED 1\r
-\r
- \r
- struct _LCD_Params *Local_Params = (struct _LCD_Params*)pvParameters;\r
- \r
- char str_lcd[9];\r
- unsigned short pos = 0;\r
- unsigned char Direction = RIGHT_TO_LEFT;\r
- unsigned char Status = RUNNING;\r
- \r
- unsigned char QueueData;\r
- portTickType Delay = ( Local_Params->Speed / portTICK_RATE_MS );\r
- \r
- for(;;)\r
- {\r
-// vTaskDelay( Local_Params->Speed / portTICK_RATE_MS ); \r
-\r
- if( xQueueReceive (SwitchQueue, &QueueData, Delay) != pdPASS )\r
- {\r
- strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);\r
- \r
- xSemaphoreTake( LCD_Mutex, portMAX_DELAY );\r
- DisplayString(Local_Params->Line, str_lcd);\r
- xSemaphoreGive( LCD_Mutex );\r
- \r
- if(Direction == RIGHT_TO_LEFT)\r
- {\r
- pos++;\r
- if( pos == strlen(datastring) - 7)\r
- {\r
- Direction = LEFT_TO_RIGHT;\r
- pos--; \r
- }\r
- }\r
- else\r
- {\r
- pos--;\r
- if( pos == 0 )\r
- {\r
- Direction = RIGHT_TO_LEFT; \r
- }\r
- } \r
- }\r
- else\r
- {\r
- if(QueueData == 0x02) // stop/start\r
- {\r
- if(Delay != portMAX_DELAY)\r
- {\r
- Delay = portMAX_DELAY;\r
- Status = STOPPED;\r
- }\r
- else\r
- {\r
- Delay = ( Local_Params->Speed / portTICK_RATE_MS );\r
- Status = RUNNING;\r
- } \r
- }\r
- \r
- if(QueueData == 0x01) // RIGHT or shift back\r
- {\r
- if(Status == STOPPED)\r
- {\r
- if(pos != 0)\r
- {\r
- pos--;\r
- \r
- strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);\r
- \r
- xSemaphoreTake( LCD_Mutex, portMAX_DELAY );\r
- DisplayString(Local_Params->Line, str_lcd);\r
- xSemaphoreGive( LCD_Mutex );\r
- }\r
- }\r
- }\r
- \r
- if(QueueData == 0x03) // LEFT or shift forward\r
- {\r
- if(Status == STOPPED)\r
- {\r
- if(pos != strlen(datastring) - 7)\r
- {\r
- pos++;\r
- strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);\r
- \r
- xSemaphoreTake( LCD_Mutex, portMAX_DELAY );\r
- DisplayString(Local_Params->Line, str_lcd);\r
- xSemaphoreGive( LCD_Mutex );\r
- }\r
- }\r
- }\r
- }\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-#ifndef LCD_H\r
-#define LCD_H\r
-/***********************************************************************************\r
-\r
-FILE NAME lcd.h\r
-\r
-DESCRIPTION Driver for KS0066u LCD Module Controller (8 characters by 2 lines )\r
- on the Renesas RSK boards - header file\r
-\r
-Copyright : 2006 Renesas Technology Europe Ltd.\r
-Copyright : 2006 Renesas Technology Corporation.\r
-All Rights Reserved\r
-***********************************************************************************/\r
-\r
-/***********************************************************************************\r
-Revision History\r
-DD.MM.YYYY OSO-UID Description\r
-26.07.2006 RTE-MBA First Release\r
-***********************************************************************************/\r
-void InitialiseDisplay( void );\r
-void DisplayString(unsigned char position, char * string);\r
-void LCD_write(unsigned char data_or_ctrl, unsigned char value);\r
-void LCD_nibble_write(unsigned char data_or_ctrl, unsigned char value);\r
-void DisplayDelay(unsigned long int units);\r
-\r
-\r
-#define SET_BIT_HIGH (1) \r
-#define SET_BIT_LOW (0) \r
-#define SET_BYTE_HIGH (0xFF) \r
-#define SET_BYTE_LOW (0x00) \r
-\r
-struct _LCD_Params {\r
- unsigned char Line;\r
- unsigned short Speed;\r
- char *ptr_str;\r
-};\r
-\r
-void prvLCDTaskLine1( void *pvParameters );\r
-void prvLCDTaskLine2( void *pvParameters );\r
-\r
-\r
-/* RS Register Select pin */\r
-#define RS_PIN PORTJ.PODR.BIT.B1\r
-/* Display Enable pin */ \r
-#define EN_PIN PORTJ.PODR.BIT.B3\r
-/* Data bus port */\r
-#define DATA_PORT PORTH.PODR.BYTE\r
-/* Bit mask from entire port */ \r
-#define DATA_PORT_MASK 0x0F\r
-/* Number of bits data needs to shift */\r
-#define DATA_PORT_SHIFT 0\r
-\r
-\r
-#define DATA_WR 1\r
-#define CTRL_WR 0\r
-\r
-/* Set to ensure base delay of 1microS minimum */\r
-//#define DELAY_TIMING 0x2F\r
-#define DELAY_TIMING 50\r
-/* number of lines on the LCD display */\r
-#define NUMB_CHARS_PER_LINE 8\r
-/* Maximum charactors per line of LCD display. */ \r
-#define MAXIMUM_LINES 2 \r
-\r
-#define LCD_LINE1 0\r
-#define LCD_LINE2 16\r
-\r
-/**********************************************************************************/\r
-/* LCD commands - use LCD_write function to write these commands to the LCD. */\r
-/**********************************************************************************/\r
-/* Clear LCD display and home cursor */\r
-#define LCD_CLEAR 0x01\r
-/* move cursor to line 1 */\r
-#define LCD_HOME_L1 0x80\r
-/* move cursor to line 2 */ \r
-#define LCD_HOME_L2 0xC0\r
-/* Cursor auto decrement after R/W */ \r
-#define CURSOR_MODE_DEC 0x04\r
-/* Cursor auto increment after R/W */\r
-#define CURSOR_MODE_INC 0x06\r
-/* Setup, 4 bits,2 lines, 5X7 */\r
-#define FUNCTION_SET 0x28\r
-/* Display ON with Cursor */\r
-#define LCD_CURSOR_ON 0x0E\r
-/* Display ON with Cursor off */\r
-#define LCD_CURSOR_OFF 0x0C\r
-/* Display on with blinking cursor */\r
-#define LCD_CURSOR_BLINK 0x0D\r
-/*Move Cursor Left One Position */\r
-#define LCD_CURSOR_LEFT 0x10\r
-/* Move Cursor Right One Position */\r
-#define LCD_CURSOR_RIGHT 0x14\r
-\r
-#define LCD_DISPLAY_ON 0x04\r
-#define LCD_TWO_LINE 0x08\r
-\r
-#endif
\ No newline at end of file