#include <stdint.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
Defines | |
#define | CLR_CS() CS_PORT &= ~(1<<CS) |
Clear CS - activate LCD. | |
#define | SET_CS() CS_PORT |= (1<<CS) |
set CS - deactivate LCD | |
#define | STARTBYTE 0x1F |
#define | LCD_WAIT_LONG _delay_ms(2) |
delay-loop for slower instructions CLEARDISP and RETHOME | |
#define | LCD_WAIT_SHORT _delay_us(50) |
delay-loop for normal LCD instructions | |
#define | STARTUPDELAY() _delay_ms(20) |
20ms delay at startup required max. delay is limited to 262.14[ms]/F_CPU[MHz] (cp. util/delay.h) so this delay is added if higher F_CPU values are used. | |
#define | lcd_puts_P(__s) lcd_puts_p(PSTR(__s)) |
#define | LCD_BUSYWAIT() while(lcd_get_status() & LCD_BF) |
Wait for busy-flag being cleared. | |
Functions | |
void | lcd_init (void) |
void | lcd_put_cmd (uint8_t cmd) |
Send a single command to display controller. | |
void | lcd_put_data (uint8_t data) |
Send a single data byte to display controller. | |
void | lcd_puts (char *lcds) |
void | lcd_puts_p (const char *progmem_s) |
void | lcd_gotoxy (uint8_t col, uint8_t row) |
uint8_t | lcd_get_status (void) |
No error checking/handling implemented at all Author: J. Gerlach - gerlach_joerg(at)web.de
#define lcd_puts_P | ( | __s | ) | lcd_puts_p(PSTR(__s)) |
Macro to send stringliteral from flash
Just simplifying macro
#define STARTBYTE 0x1F |
the startby contains 1s in the 5 lower bits
resets internal communication of the ks0073
uint8_t lcd_get_status | ( | void | ) |
read instruction register from LCD
read LCD busy state from MSB, lower bits are current cursor address
void lcd_gotoxy | ( | uint8_t | col, | |
uint8_t | row | |||
) |
set cursor (x,y) position on display
set adress in DDRAM, position is 0-based (of course). the lcd_puts..() functions can then be used to write text to display
void lcd_init | ( | void | ) |
Init-sequence, taken from dip204-6 datasheet from Electronic Assembly
Set 8-bit mode, 4 rows, clear all icons and display. Takes a while due to the 20ms startup delay
void lcd_puts | ( | char * | lcds | ) |
Writes a 0-terminated string to LCD,
special characters are ignored (yet)
void lcd_puts_p | ( | const char * | progmem_s | ) |
Writes a 0-terminated constant string from flash to LCD,
to send literals use lcd_puts_P() instead; special characters are ignored (yet)