Verzia tlače už nie je podporovaná a môže obsahovať chyby pri vykresľovaní. Prosím aktualizujte záložky vo svojom prehliadači a použite predvolenú funkciu pre tlač v prehliadači.
// DEM16216 LCD controller command set (do not modify these)
#include <avr/io.h>
#include <util/delay.h>
//#define LCD_DELAY asm volatile ("nop")
#define LCD_DELAY _delay_us(5)
#define SETBIT(VAR,BIT) (VAR|=(1<<BIT))
#define CLEARBIT(VAR,BIT) (VAR&=~(1<<BIT))
#define CHECKBIT(VAR,BIT) (VAR&(1<<BIT))
#define LCD_CLR 0 // DB0: clear display
#define LCD_HOME 1 // DB1: return to home position
#define LCD_ENTRY_MODE 2 // DB2: set entry mode
#define LCD_ENTRY_INC 1 // DB1: increment
#define LCD_ENTRY_SHIFT 0 // DB2: shift
#define LCD_ON_CTRL 3 // DB3: turn lcd/cursor on
#define LCD_ON_DISPLAY 2 // DB2: turn display on
#define LCD_ON_CURSOR 1 // DB1: turn cursor on
#define LCD_ON_BLINK 0 // DB0: blinking cursor
#define LCD_MOVE 4 // DB4: move cursor/display
#define LCD_MOVE_DISP 3 // DB3: move display (0-> move cursor)
#define LCD_MOVE_RIGHT 2 // DB2: move right (0-> left)
#define LCD_FUNCTION 5 // DB5: function set
#define LCD_FUNCTION_8BIT 4 // DB4: set 8BIT mode (0->4BIT mode)
#define LCD_FUNCTION_2LINES 3 // DB3: two lines (0->one line)
#define LCD_FUNCTION_10DOTS 2 // DB2: 5x10 font (0->5x7 font)
#define LCD_CGRAM 6 // DB6: set CG RAM address
#define LCD_DDRAM 7 // DB7: set DD RAM address
// ________________________________________________________
#define LCD_BUSY 7 // DB7: LCD is busy
// port and pins you will use for control lines
#define LCD_CTRL_PORT PORTB
#define LCD_CTRL_DDR DDRB
#define LCD_CTRL_RS 3
#define LCD_CTRL_RW 4
#define LCD_CTRL_E 5
// port you will use for data lines
#define LCD_DATA_PORT PORTC
#define LCD_DATA_PIN PINC
#define LCD_DATA_DDR DDRC
#define LCD_DATA_D7 3
#define LCD_DATA_D6 2
#define LCD_DATA_D5 1
#define LCD_DATA_D4 0
// define pin which control backlight
#define LCD_CTRL_LIGHT 4
// access mode you will use (default is 8bit unless 4bit is selected)
#define LCD_DATA_4BIT
// LCD display geometry
// change these definitions to adapt settings
#define LCD_LINES 2 // visible lines
#define LCD_LINE_LENGTH 16 // line length (in characters)
// cursor position to DDRAM mapping
#define LCD_LINE0_DDRAMADDR 0x00
#define LCD_LINE1_DDRAMADDR 0x40
// **************************************************
extern unsigned char lcdBusy(void); // waits until LCD is not busy
extern void lcdControlWrite(unsigned char c_data); // writes a control command to the LCD
extern unsigned char lcdControlRead(void); // read the control status from the LCD
extern void lcdDataWrite(unsigned char w_data) ; // writes a data byte to the LCD screen at the current position
extern unsigned char lcdDataRead(void); // reads the data byte on the LCD screen at the current position
extern void lcdInit4(void);
extern unsigned char ReadButtons();
extern void lcdStringWrite(char* String);