Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Svoje jméno a příjmení a školu
- * Trololo
- * + dnešní datum
- *
- * knihovna funkcí pro práci s LCDhd44780 kompatibilní
- *
- * DB7:DB0 :: PORTD
- * RS:: PORTE<0>
- * RW:: PORTE<1>
- * EN:: PORTE<2>
- *
- * PIC16F887A, fosc = 3.2768 MHz
- */
- #include "init.h" // included by C-Wiz
- #include <htc.h>
- // definice řídících příkazů LCD
- #define LCD_CLEAR_DISPLAY 0b00000001
- #define LCD_RETURN_HOME 0b00000010
- //left-to-right, dont shift
- #define LCD_MODE_SET 0b00000110
- //display on, no cursor, no cursor blink
- #define LCD_DISPLAY_CONTROL 0b00001100
- #define LCD_SHIFTS 0b00010000
- //8-bit bus, 2-line display, small dots
- #define LCD_FUNCTION_SET 0b00111000
- #define LCD_SET_CGRAM_ADDR 0b01000000
- #define LCD_SET_DDRAM_ADDR 0b10000000
- #define LCD_KOEF_W8 0.8
- #define LCD_2ND_ROW 0x40
- #define LCD_PORT PORTD
- #define LCD_RS RE0
- #define LCD_RW RE1
- #define LCD_EN RE2
- //podprogram pro cekani v us
- void lcd_wait_us(unsigned short int count) {
- count = count >> 2;
- do {
- asm("nop");
- } while(--count);
- }
- //podprogram pro cekani v ms
- void lcd_wait_ms(unsigned char count) {
- do {
- lcd_wait_us(1000);
- } while(--count);
- }
- //inicializace displaye
- void lcd_init(void) {
- //CLD_POWER = ON
- lcd_wait_ms((unsigned char) (30 * LCD_KOEF_W8));
- //lcd_cmd(CLD_FUNCTION_SET);
- //lcd_cmd(CLD_DISPLAY_CONTROL);
- //lcd_cmd(CLD_DISPLAY_CLEAR);
- //lcd_cmd(CLD_ENTRY_MODE_SET);
- }
- void main(void)
- {
- init(); // Function call inserted by C-Wiz
- while (1){
- //TODO Auto-generated main function
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement