0,0 → 1,675 |
CCS PCM C Compiler, Version 3.245, 27853 16-XII-07 14:06 |
|
Filename: C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.lst |
|
ROM used: 326 words (4%) |
Largest free fragment is 2048 |
RAM used: 7 (4%) at main() level |
15 (9%) worst case |
Stack: 4 locations |
|
* |
0000: MOVLW 00 |
0001: MOVWF 0A |
0002: GOTO 0FC |
0003: NOP |
.................... #include "main.h" |
.................... #include <16F877.h> |
.................... //////// Standard Header file for the PIC16F877 device //////////////// |
.................... #device PIC16F877 |
.................... #list |
.................... |
.................... #device adc=8 |
.................... |
.................... #FUSES NOWDT //No Watch Dog Timer |
.................... #FUSES XT //Crystal osc <= 4mhz |
.................... #FUSES NOPUT //No Power Up Timer |
.................... #FUSES NOPROTECT //Code not protected from reading |
.................... #FUSES NOBROWNOUT //No brownout reset |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
.................... #FUSES NOCPD //No EE protection |
.................... #FUSES NOWRT //Program memory not write protected |
.................... #FUSES NODEBUG //No Debug mode for ICD |
.................... |
.................... #use delay(clock=4000000) |
0026: MOVLW 23 |
0027: MOVWF 04 |
0028: MOVF 00,W |
0029: BTFSC 03.2 |
002A: GOTO 03A |
002B: MOVLW 01 |
002C: MOVWF 78 |
002D: CLRF 77 |
002E: DECFSZ 77,F |
002F: GOTO 02E |
0030: DECFSZ 78,F |
0031: GOTO 02D |
0032: MOVLW 4A |
0033: MOVWF 77 |
0034: DECFSZ 77,F |
0035: GOTO 034 |
0036: NOP |
0037: NOP |
0038: DECFSZ 00,F |
0039: GOTO 02B |
003A: RETLW 00 |
.................... |
.................... |
.................... |
.................... |
.................... #define LCD_RS PIN_C7 // rizeni registru LCD displeje <lcd.c> |
.................... #define LCD_E PIN_B7 // enable LCD displeje <lcd.c> |
.................... #define LCD_D0 PIN_B3 // data LCD <lcd.c> |
.................... #define LCD_D1 PIN_B2 |
.................... #define LCD_D2 PIN_B1 |
.................... #define LCD_D3 PIN_B0 |
.................... |
.................... #include "LCD.C" |
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem |
.................... // (c)miho 2002,2005 |
.................... // |
.................... // Historie: |
.................... // |
.................... // 0.00 Uvodni verze se snadnou definici portu LCD displeje |
.................... // 0.01 Oprava portu (zapomenute stare identifikatory) |
.................... // 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty |
.................... // 0.03 Doplnena procedura lcd_clr pro smazani displeje |
.................... // |
.................... // |
.................... // Funkce: |
.................... // |
.................... // lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni |
.................... // |
.................... // lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky |
.................... // \f = \x0C - nova stranka - smazani displeje |
.................... // \n = \x0A - odradkovani (prechod na druhou radku) |
.................... // \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet |
.................... // \r = \x0D - goto home to position 1,1 |
.................... // \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM |
.................... // \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM |
.................... // Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce) |
.................... // |
.................... // lcd_gotoxy(x,y) presune kurzor na uvedenou adresu |
.................... // nekontroluje parametry |
.................... // |
.................... // lcd_cursor_on zapne kurzor |
.................... // lcd_cursor_off vypne kurzor |
.................... // |
.................... // lcd_clr smaze displej |
.................... // |
.................... // lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho |
.................... // retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM. |
.................... // Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7. |
.................... // Na konci se provede lcd_gotoxy(1,1). |
.................... // Na konci teto knihovny je priklad pouziti definovanych znaku |
.................... // |
.................... // |
.................... // Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port |
.................... // |
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje |
.................... // #define LCD_E PIN_B1 // enable LCD displeje |
.................... // #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou) |
.................... // |
.................... // |
.................... // Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov) |
.................... // |
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje |
.................... // #define LCD_E PIN_B1 // enable LCD displeje |
.................... // #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty |
.................... // #define LCD_D1 PIN_C3 // D1 |
.................... // #define LCD_D2 PIN_C4 // D2 |
.................... // #define LCD_D3 PIN_C5 // D3 |
.................... |
.................... |
.................... |
.................... |
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje |
.................... |
.................... |
.................... |
.................... |
.................... #ifdef LCD_DATA_LSB |
.................... // Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne |
.................... // bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva |
.................... // v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu |
.................... // |
.................... #define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu |
.................... #define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu |
.................... #define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru |
.................... #define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu |
.................... // |
.................... #if LCD_SHIFT>4 // kontrola mezi |
.................... #error LCD data port LSB bit not in range 0..4 |
.................... #endif |
.................... #endif |
.................... |
.................... |
.................... // Definice konstant pro LCD display |
.................... // |
.................... #define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem |
.................... #define LCD_CURSOR_OFF_ 0x0C // zadny kurzor |
.................... #define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky |
.................... |
.................... |
.................... // Definice rezimu LCD displeje |
.................... // |
.................... BYTE const LCD_INIT_STRING[4] = |
.................... { |
.................... 0x28, // intrfejs 4 bity, 2 radky, font 5x7 |
.................... LCD_CURSOR_OFF_, // display on, kurzor off, |
.................... 0x01, // clear displeje |
.................... 0x06 // inkrement pozice kurzoru (posun kurzoru doprava) |
.................... }; |
.................... |
.................... |
.................... // Odesle nibble do displeje (posle data a klikne signalem e) |
.................... // |
.................... void lcd_send_nibble( BYTE n ) |
.................... { |
.................... #ifdef LCD_DATA_LSB |
.................... // data jsou za sebou na 4 bitech jednoho portu |
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej |
.................... #else |
.................... // data jsou na libovolnych 4 bitech libovolnych portu |
.................... output_bit(LCD_D0,bit_test(n,0)); |
003B: BTFSC 29.0 |
003C: GOTO 03F |
003D: BCF 06.3 |
003E: GOTO 040 |
003F: BSF 06.3 |
0040: BSF 03.5 |
0041: BCF 06.3 |
.................... output_bit(LCD_D1,bit_test(n,1)); |
0042: BCF 03.5 |
0043: BTFSC 29.1 |
0044: GOTO 047 |
0045: BCF 06.2 |
0046: GOTO 048 |
0047: BSF 06.2 |
0048: BSF 03.5 |
0049: BCF 06.2 |
.................... output_bit(LCD_D2,bit_test(n,2)); |
004A: BCF 03.5 |
004B: BTFSC 29.2 |
004C: GOTO 04F |
004D: BCF 06.1 |
004E: GOTO 050 |
004F: BSF 06.1 |
0050: BSF 03.5 |
0051: BCF 06.1 |
.................... output_bit(LCD_D3,bit_test(n,3)); |
0052: BCF 03.5 |
0053: BTFSC 29.3 |
0054: GOTO 057 |
0055: BCF 06.0 |
0056: GOTO 058 |
0057: BSF 06.0 |
0058: BSF 03.5 |
0059: BCF 06.0 |
.................... #endif |
.................... output_bit(LCD_E,1); // vzestupna hrana |
005A: BCF 03.5 |
005B: BSF 06.7 |
005C: BSF 03.5 |
005D: BCF 06.7 |
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat |
005E: NOP |
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us) |
005F: BCF 03.5 |
0060: BCF 06.7 |
0061: BSF 03.5 |
0062: BCF 06.7 |
.................... } |
0063: BCF 03.5 |
0064: RETLW 00 |
.................... |
.................... |
.................... // Odesle bajt do registru LCD |
.................... // |
.................... // Pokud je Adr=0 .. instrukcni registr |
.................... // Pokud je Adr=1 .. datovy registr |
.................... // |
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n ) |
.................... { |
.................... output_bit(LCD_RS,Adr); // vyber registr |
0065: MOVF 27,F |
0066: BTFSS 03.2 |
0067: GOTO 06A |
0068: BCF 07.7 |
0069: GOTO 06B |
006A: BSF 07.7 |
006B: BCF 20.7 |
006C: MOVF 20,W |
006D: BSF 03.5 |
006E: MOVWF 07 |
* |
0104: MOVLW FF |
0105: BCF 03.5 |
0106: MOVWF 20 |
.................... swap(n); |
* |
006F: BCF 03.5 |
0070: SWAPF 28,F |
.................... lcd_send_nibble(n); // posli horni pulku bajtu |
0071: MOVF 28,W |
0072: MOVWF 29 |
0073: CALL 03B |
.................... swap(n); |
0074: SWAPF 28,F |
.................... lcd_send_nibble(n); // posli spodni pulku bajtu |
0075: MOVF 28,W |
0076: MOVWF 29 |
0077: CALL 03B |
.................... delay_us(40); // minimalni doba na provedeni prikazu |
0078: MOVLW 0D |
0079: MOVWF 77 |
007A: DECFSZ 77,F |
007B: GOTO 07A |
.................... } |
007C: RETLW 00 |
.................... |
.................... |
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje |
.................... // |
.................... // Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur |
.................... // |
.................... void lcd_init() |
.................... { |
.................... |
.................... int i; // pocitadlo cyklu |
.................... |
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni |
007D: MOVLW 14 |
007E: MOVWF 23 |
007F: CALL 026 |
.................... |
.................... #ifdef LCD_DATA_LSB |
.................... // data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy |
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD |
.................... #endif |
.................... |
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav |
0080: BCF 07.7 |
0081: BCF 20.7 |
0082: MOVF 20,W |
0083: BSF 03.5 |
0084: MOVWF 07 |
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav |
0085: BCF 03.5 |
0086: BCF 06.7 |
0087: BSF 03.5 |
0088: BCF 06.7 |
.................... |
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice |
0089: BCF 03.5 |
008A: CLRF 21 |
008B: MOVF 21,W |
008C: SUBLW 02 |
008D: BTFSS 03.0 |
008E: GOTO 097 |
.................... { |
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel |
008F: MOVLW 02 |
0090: MOVWF 23 |
0091: CALL 026 |
.................... lcd_send_nibble(3); // rezim 8 bitu |
0092: MOVLW 03 |
0093: MOVWF 29 |
0094: CALL 03B |
.................... } |
0095: INCF 21,F |
0096: GOTO 08B |
.................... |
.................... delay_us(40); // cas na zpracovani |
0097: MOVLW 0D |
0098: MOVWF 77 |
0099: DECFSZ 77,F |
009A: GOTO 099 |
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu) |
009B: MOVLW 02 |
009C: MOVWF 29 |
009D: CALL 03B |
.................... delay_us(40); // cas na zpracovani |
009E: MOVLW 0D |
009F: MOVWF 77 |
00A0: DECFSZ 77,F |
00A1: GOTO 0A0 |
.................... |
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod) |
00A2: CLRF 21 |
00A3: MOVF 21,W |
00A4: SUBLW 02 |
00A5: BTFSS 03.0 |
00A6: GOTO 0B3 |
.................... { |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
00A7: MOVF 21,W |
00A8: CALL 004 |
00A9: MOVWF 22 |
00AA: CLRF 27 |
00AB: MOVF 22,W |
00AC: MOVWF 28 |
00AD: CALL 065 |
.................... delay_ms(2); |
00AE: MOVLW 02 |
00AF: MOVWF 23 |
00B0: CALL 026 |
.................... } |
00B1: INCF 21,F |
00B2: GOTO 0A3 |
.................... } |
00B3: BCF 0A.3 |
00B4: BCF 0A.4 |
00B5: GOTO 133 (RETURN) |
.................... |
.................... |
.................... // Proved presun kurzoru |
.................... // |
.................... // Pozice 1.1 je domu |
.................... // |
.................... void lcd_gotoxy( BYTE x, BYTE y) |
.................... { |
.................... |
.................... BYTE Adr; |
.................... |
.................... Adr=x-1; |
00B6: MOVLW 01 |
00B7: SUBWF 23,W |
00B8: MOVWF 25 |
.................... if(y==2) |
00B9: MOVF 24,W |
00BA: SUBLW 02 |
00BB: BTFSS 03.2 |
00BC: GOTO 0BF |
.................... Adr+=LCD_LINE_2; |
00BD: MOVLW 40 |
00BE: ADDWF 25,F |
.................... |
.................... lcd_send_byte(0,0x80|Adr); |
00BF: MOVF 25,W |
00C0: IORLW 80 |
00C1: MOVWF 26 |
00C2: CLRF 27 |
00C3: MOVF 26,W |
00C4: MOVWF 28 |
00C5: CALL 065 |
.................... } |
00C6: RETLW 00 |
.................... |
.................... |
.................... // Zapis znaku na displej, zpracovani ridicich znaku |
.................... // |
.................... void lcd_putc( char c) |
.................... { |
.................... |
.................... switch (c) |
.................... { |
00C7: MOVF 22,W |
00C8: XORLW 0C |
00C9: BTFSC 03.2 |
00CA: GOTO 0D5 |
00CB: XORLW 06 |
00CC: BTFSC 03.2 |
00CD: GOTO 0DD |
00CE: XORLW 07 |
00CF: BTFSC 03.2 |
00D0: GOTO 0E3 |
00D1: XORLW 05 |
00D2: BTFSC 03.2 |
00D3: GOTO 0E8 |
00D4: GOTO 0ED |
.................... case '\f' : lcd_send_byte(0,1); // smaz displej |
00D5: CLRF 27 |
00D6: MOVLW 01 |
00D7: MOVWF 28 |
00D8: CALL 065 |
.................... delay_ms(2); |
00D9: MOVLW 02 |
00DA: MOVWF 23 |
00DB: CALL 026 |
.................... break; |
00DC: GOTO 0F9 |
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky |
00DD: MOVLW 01 |
00DE: MOVWF 23 |
00DF: MOVLW 02 |
00E0: MOVWF 24 |
00E1: CALL 0B6 |
00E2: GOTO 0F9 |
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home |
00E3: MOVLW 01 |
00E4: MOVWF 23 |
00E5: MOVWF 24 |
00E6: CALL 0B6 |
00E7: GOTO 0F9 |
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet |
00E8: CLRF 27 |
00E9: MOVLW 10 |
00EA: MOVWF 28 |
00EB: CALL 065 |
00EC: GOTO 0F9 |
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F |
00ED: MOVF 22,W |
00EE: SUBLW 1F |
00EF: BTFSS 03.0 |
00F0: GOTO 0F3 |
00F1: MOVLW 07 |
00F2: ANDWF 22,F |
.................... lcd_send_byte(1,c); break; // zapis znak |
00F3: MOVLW 01 |
00F4: MOVWF 27 |
00F5: MOVF 22,W |
00F6: MOVWF 28 |
00F7: CALL 065 |
00F8: GOTO 0F9 |
.................... } |
.................... } |
00F9: BCF 0A.3 |
00FA: BCF 0A.4 |
00FB: GOTO 144 (RETURN) |
.................... |
.................... |
.................... // Zapni kurzor |
.................... // |
.................... void lcd_cursor_on() |
.................... { |
.................... lcd_send_byte(0,LCD_CURSOR_ON_); |
.................... } |
.................... |
.................... |
.................... // Vypni kurzor |
.................... // |
.................... void lcd_cursor_off() |
.................... { |
.................... lcd_send_byte(0,LCD_CURSOR_OFF_); |
.................... } |
.................... |
.................... |
.................... // Smaz displej |
.................... // |
.................... void lcd_clr() |
.................... { |
.................... lcd_putc('\f'); |
.................... } |
.................... |
.................... |
.................... // Definice vlastnich fontu |
.................... // |
.................... // Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje |
.................... // Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden |
.................... // priklad pouziti definovanych znaku. |
.................... |
.................... |
.................... // Pomocna procedura pro posilani ridicich dat do radice displeje |
.................... // |
.................... void lcd_putc2(int Data) |
.................... { |
.................... lcd_send_byte(1,Data); |
.................... } |
.................... |
.................... |
.................... // Pomocne definice pro programovani obsahu CGRAM |
.................... // |
.................... #define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2) |
.................... #define lcd_define_def(String) printf(lcd_putc2,String); |
.................... #define lcd_define_end() lcd_send_byte(0,3); delay_ms(2) |
.................... |
.................... |
.................... // Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def |
.................... // |
.................... #define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end(); |
.................... |
.................... |
.................... // Pripravene definice fontu vybranych znaku |
.................... // V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80 |
.................... // |
.................... #define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */ |
.................... #define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */ |
.................... #define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */ |
.................... #define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */ |
.................... #define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */ |
.................... #define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */ |
.................... #define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */ |
.................... #define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */ |
.................... #define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */ |
.................... #define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */ |
.................... #define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */ |
.................... #define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */ |
.................... #define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */ |
.................... #define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */ |
.................... #define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */ |
.................... #define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */ |
.................... #define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */ |
.................... #define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */ |
.................... #define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */ |
.................... #define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */ |
.................... #define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */ |
.................... #define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */ |
.................... #define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */ |
.................... #define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */ |
.................... #define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */ |
.................... #define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */ |
.................... #define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */ |
.................... #define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */ |
.................... #define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */ |
.................... #define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */ |
.................... #define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */ |
.................... #define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */ |
.................... #define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */ |
.................... #define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */ |
.................... #define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */ |
.................... |
.................... |
.................... // Priklad pouziti definovanych znaku |
.................... // |
.................... // |
.................... //void lcd_sample() |
.................... //{ |
.................... // lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0 |
.................... // lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2 |
.................... // // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji |
.................... // // jediny definicni retezec) |
.................... // printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3 |
.................... // delay_ms(1000); |
.................... // lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0 |
.................... // delay_ms(1000); |
.................... //} |
.................... |
.................... |
.................... void main() |
.................... { |
00FC: CLRF 04 |
00FD: MOVLW 1F |
00FE: ANDWF 03,F |
00FF: BSF 03.5 |
0100: BSF 1F.0 |
0101: BSF 1F.1 |
0102: BSF 1F.2 |
0103: BCF 1F.3 |
.................... |
.................... setup_adc_ports(NO_ANALOGS); |
* |
0107: BSF 03.5 |
0108: BSF 1F.0 |
0109: BSF 1F.1 |
010A: BSF 1F.2 |
010B: BCF 1F.3 |
.................... setup_adc(ADC_OFF); |
010C: BCF 03.5 |
010D: BCF 1F.0 |
.................... setup_psp(PSP_DISABLED); |
010E: BSF 03.5 |
010F: BCF 09.4 |
.................... setup_spi(FALSE); |
0110: BCF 03.5 |
0111: BCF 14.5 |
0112: BCF 20.5 |
0113: MOVF 20,W |
0114: BSF 03.5 |
0115: MOVWF 07 |
0116: BCF 03.5 |
0117: BSF 20.4 |
0118: MOVF 20,W |
0119: BSF 03.5 |
011A: MOVWF 07 |
011B: BCF 03.5 |
011C: BCF 20.3 |
011D: MOVF 20,W |
011E: BSF 03.5 |
011F: MOVWF 07 |
0120: MOVLW 00 |
0121: BCF 03.5 |
0122: MOVWF 14 |
0123: BSF 03.5 |
0124: MOVWF 14 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
0125: MOVF 01,W |
0126: ANDLW C7 |
0127: IORLW 08 |
0128: MOVWF 01 |
.................... setup_timer_1(T1_DISABLED); |
0129: BCF 03.5 |
012A: CLRF 10 |
.................... setup_timer_2(T2_DISABLED,0,1); |
012B: MOVLW 00 |
012C: MOVWF 78 |
012D: MOVWF 12 |
012E: MOVLW 00 |
012F: BSF 03.5 |
0130: MOVWF 12 |
.................... |
.................... lcd_init(); |
0131: BCF 03.5 |
0132: GOTO 07D |
.................... |
.................... while(true); |
0133: GOTO 133 |
.................... { |
.................... Delay_ms(100); |
0134: MOVLW 64 |
0135: MOVWF 23 |
0136: CALL 026 |
.................... |
.................... LCD_gotoxy(1,1); |
0137: MOVLW 01 |
0138: MOVWF 23 |
0139: MOVWF 24 |
013A: CALL 0B6 |
.................... printf(lcd_putc,"Ahoj, Display funguje"); |
013B: CLRF 21 |
013C: MOVF 21,W |
013D: CALL 00C |
013E: IORLW 00 |
013F: BTFSC 03.2 |
0140: GOTO 145 |
0141: INCF 21,F |
0142: MOVWF 22 |
0143: GOTO 0C7 |
0144: GOTO 13C |
.................... } |
.................... |
.................... } |
0145: SLEEP |
|
Configuration Fuses: |
Word 1: 3F39 XT NOWDT NOPUT NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG |