Subversion Repositories svnkaklik

Compare Revisions

No changes between revisions

Ignore whitespace Rev 5 → Rev 6

/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.BAK
0,0 → 1,163
#include "main.h"
#include "..\common.h"
 
#DEFINE LCD_RS PIN_B1 // rizeni registru LCD displeje
#DEFINE LCD_E PIN_B0 // enable LCD displeje
#DEFINE LCD_DATA_LSB PIN_B2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
#INCLUDE "MYLCD.C"
#DEFINE PRIJIMAC PIN_A3 // pin na ktery je pripojen prijimac
#DEFINE SERVO_X PIN_A0 // pin na ktery je pripojeno servo
#DEFINE SERVO_Y PIN_A1
 
int8 bit,x,y;
int counter; // pocitadlo 1 a 0 v detektoru
int x_old=0,y_old;
 
void servo(int uhel, int souradnice)
{
if (X==souradnice) output_high(SERVO_X); else output_high(SERVO_Y);
 
delay_us(62.5*uhel);
 
if (SERVO_X==souradnice) output_low(SERVO_X); else output_low(SERVO_Y);
// delay_ms(10);
}
 
int8 prijmout(int8* bit)
{
// || |
// |--|_____ 1
// |
// |-|__|-|_ 0
 
while (!input(PRIJIMAC)) ; // cekej na jednicku
delay_us(IMPULS/4); // presvec se, jestli je stale 1 po 1/4 impulsu
if (!input(PRIJIMAC)) return(false); // vrat chybu, kdyz neni stale 1
delay_us(3*IMPULS); // pockej na rozhodovaci misto
if (input(PRIJIMAC)) *bit=0; else *bit=1; // dekoduj 1 nebo 0
delay_us(IMPULS); // pockej na konec znaku
 
output_bit(PIN_A0, *bit); // kontrolni vystup
 
return(true); // vrat, ze se cteni povedlo
}
 
int8 read_nibble(int8* value)
{
int8 n; // citac
int8 bit; // pomocna promenna
 
*value=0;
for (n=1; n<=4; n++) // prijmi 4 bity
{
*value >>= 1; // posun jiz prectene do leva
if (0==prijmout(&bit)) return(false); // prijmi bit; pri chybe cteni vrat chybu
*value |= bit << 3; // pridej bit do nibblu
};
return(true); // vrat 1, jako ,ze je vse O.K.
}
 
/*void dekodovat(void)
{
int8 osa, hodnota, kontrola;
 
counter=4;
 
decoder:
 
counter=0; // vynuluj citac
do // vyhledej synchronizacni jednicky
{
if (!prijmout(&bit)) goto decoder; // prijmi bit; pri chybe zacni znovu
if (1==bit) counter++; else goto decoder; // kdyz je bit 1, tak zvys citac; jinak zacni znovu
} while(counter<4); // pockej na 4 jednicky
 
if (!read_nibble(&osa)) goto decoder; // nacti identifikator osy
 
if (!read_nibble(&hodnota)) goto decoder; // nacti 1. nibble; pri chybe zacni znovu
if (!read_nibble(&kontrola)) goto decoder; // nacti 2. nibble; pri chybe zacni znovu
if (hodnota != kontrola) goto decoder; // zacni znovu, pokud jsou ruzne nibble
 
switch (osa) // rozeskoc se podle adresy osy
{
case OSA_X:
{
x=hodnota;
break;
};
case OSA_Y:
{
y=hodnota;
break;
};
case TLs:
{
break;
};
};
}
*/
void main()
{
lcd_init(); // zinicializuj LCD display
 
while (true)
{
int8 osa, hodnota, kontrola;
 
counter=4;
 
decoder:
 
servo(x_old,SERVO_X);
servo(y_old,SERVO_Y);
 
counter=0; // vynuluj citac
do // vyhledej synchronizacni jednicky
{
if (!prijmout(&bit)) goto decoder; // prijmi bit; pri chybe zacni znovu
if (1==bit) counter++; else goto decoder; // kdyz je bit 1, tak zvys citac; jinak zacni znovu
} while(counter<4); // pockej na 4 jednicky
 
if (!read_nibble(&osa)) goto decoder; // nacti identifikator osy
 
if (!read_nibble(&hodnota)) goto decoder; // nacti 1. nibble; pri chybe zacni znovu
if (!read_nibble(&kontrola)) goto decoder; // nacti 2. nibble; pri chybe zacni znovu
if (hodnota != kontrola) goto decoder; // zacni znovu, pokud jsou ruzne nibble
 
switch (osa) // rozeskoc se podle adresy osy
{
case OSA_X:
{
x=hodnota;
x_old=x;
break;
};
case OSA_Y:
{
y=hodnota;
y_old=y
break;
};
case TLs:
{
break;
};
};
 
 
lcd_gotoxy(1,1); // vytiskni X a Y
printf(lcd_putc,"X: %U ", x);
lcd_gotoxy(1,2);
printf(lcd_putc,"Y: %U ", y);
}
}
 
 
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.C
0,0 → 1,164
#include "main.h"
#include "..\common.h"
 
#DEFINE LCD_RS PIN_B1 // rizeni registru LCD displeje
#DEFINE LCD_E PIN_B0 // enable LCD displeje
#DEFINE LCD_DATA_LSB PIN_B2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
#INCLUDE "MYLCD.C"
#DEFINE PRIJIMAC PIN_A3 // pin na ktery je pripojen prijimac
#DEFINE SERVO_X PIN_A0 // pin na ktery je pripojeno servo
#DEFINE SERVO_Y PIN_A1
 
int8 bit,x,y;
int counter; // pocitadlo 1 a 0 v detektoru
int x_old=0,y_old;
 
void servo(int uhel, int souradnice)
{
if (X==souradnice) output_high(SERVO_X); else output_high(SERVO_Y);
 
delay_us(62.5*uhel);
 
if (SERVO_X==souradnice) output_low(SERVO_X); else output_low(SERVO_Y);
// delay_ms(10);
}
 
int8 prijmout(int8* bit)
{
// || |
// |--|_____ 1
// |
// |-|__|-|_ 0
 
while (!input(PRIJIMAC)) ; // cekej na jednicku
delay_us(IMPULS/4); // presvec se, jestli je stale 1 po 1/4 impulsu
if (!input(PRIJIMAC)) return(false); // vrat chybu, kdyz neni stale 1
delay_us(3*IMPULS); // pockej na rozhodovaci misto
if (input(PRIJIMAC)) *bit=0; else *bit=1; // dekoduj 1 nebo 0
delay_us(IMPULS); // pockej na konec znaku
 
output_bit(PIN_A0, *bit); // kontrolni vystup
 
return(true); // vrat, ze se cteni povedlo
}
 
int8 read_nibble(int8* value)
{
int8 n; // citac
int8 bit; // pomocna promenna
 
*value=0;
for (n=1; n<=4; n++) // prijmi 4 bity
{
*value >>= 1; // posun jiz prectene do leva
if (0==prijmout(&bit)) return(false); // prijmi bit; pri chybe cteni vrat chybu
*value |= bit << 3; // pridej bit do nibblu
};
return(true); // vrat 1, jako ,ze je vse O.K.
}
 
/*void dekodovat(void)
{
int8 osa, hodnota, kontrola;
 
counter=4;
 
decoder:
 
counter=0; // vynuluj citac
do // vyhledej synchronizacni jednicky
{
if (!prijmout(&bit)) goto decoder; // prijmi bit; pri chybe zacni znovu
if (1==bit) counter++; else goto decoder; // kdyz je bit 1, tak zvys citac; jinak zacni znovu
} while(counter<4); // pockej na 4 jednicky
 
if (!read_nibble(&osa)) goto decoder; // nacti identifikator osy
 
if (!read_nibble(&hodnota)) goto decoder; // nacti 1. nibble; pri chybe zacni znovu
if (!read_nibble(&kontrola)) goto decoder; // nacti 2. nibble; pri chybe zacni znovu
if (hodnota != kontrola) goto decoder; // zacni znovu, pokud jsou ruzne nibble
 
switch (osa) // rozeskoc se podle adresy osy
{
case OSA_X:
{
x=hodnota;
break;
};
case OSA_Y:
{
y=hodnota;
break;
};
case TLs:
{
break;
};
};
}
*/
void main()
{
lcd_init(); // zinicializuj LCD display
 
while (true)
{
int8 osa, hodnota, kontrola;
 
counter=4;
 
decoder:
 
servo(x_old,SERVO_X);
servo(y_old,SERVO_Y);
 
counter=0; // vynuluj citac
do // vyhledej synchronizacni jednicky
{
if (!prijmout(&bit)) goto decoder; // prijmi bit; pri chybe zacni znovu
if (1==bit) counter++; else goto decoder; // kdyz je bit 1, tak zvys citac; jinak zacni znovu
} while(counter<4); // pockej na 4 jednicky
 
if (!read_nibble(&osa)) goto decoder; // nacti identifikator osy
 
if (!read_nibble(&hodnota)) goto decoder; // nacti 1. nibble; pri chybe zacni znovu
if (!read_nibble(&kontrola)) goto decoder; // nacti 2. nibble; pri chybe zacni znovu
if (hodnota != kontrola) goto decoder; // zacni znovu, pokud jsou ruzne nibble
 
switch (osa) // rozeskoc se podle adresy osy
{
case OSA_X:
{
x=hodnota;
x_old=x;
break;
};
case OSA_Y:
{
y=hodnota;
y_old=y;
break;
};
case TLs:
{
break;
};
};
 
 
lcd_gotoxy(1,1); // vytiskni X a Y
printf(lcd_putc,"X: %U ", x);
lcd_gotoxy(1,2);
printf(lcd_putc,"Y: %U ", y);
}
}
 
 
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.COD
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.ERR
0,0 → 1,0
No Errors
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.H
0,0 → 1,4
#include <16F84.h>
#use delay(clock=4000000)
#fuses XT,NOWDT,PUT
 
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.HEX
0,0 → 1,95
:1000000000308A00512A00000A108A100A11820763
:1000100028340C34013406341A30840000080319E3
:10002000202801308D008C018C0B14288D0B132897
:100030004A308C008C0B1A2800000000800B11281D
:1000400000340608C339A100200D8C008C0DFC3053
:100050008C050C083C392104860006148316061012
:1000600000008312061083160610831200349E08C7
:10007000031D3C2886103D288614831686108312A3
:100080009F0E1F08A00021209F0E1F08A000212006
:100090000D308C008C0B4A28003414309A000C2050
:1000A000C33083168605831286108316861083124A
:1000B000061083160610831297011708023C031CD2
:1000C000692802309A000C200330A0002120970AF2
:1000D0005D280D308C008C0B6B280230A000212095
:1000E0000D308C008C0B722897011708023C031C02
:1000F00085281708042098009E0118089F003720C3
:1001000002309A000C20970A7528562A8E308C00EF
:100110001A088D0019088E008F018D08031D9A287A
:100120000E088D008E0108308C028D08031D9A2860
:100130008C01A22803108D1BA1288E0D8D0D8C0320
:100140009A288D1300003A29190803191529A100CE
:100150001D0803191529A107031CAF28B6287F30F5
:10016000A102031C152903191529BA288130A107FA
:100170000318152921088C008D018E018F011A08A2
:10018000A500A5171B08A4001C08A3001830A10097
:10019000A201231CE32820088F07031CD5288E0A00
:1001A000031DD5288D0A0319A2171F088E07031CEB
:1001B000DC288D0A0319A2171E089B009B171B0839
:1001C0008D070318A217A20D8D0C8E0C8F0CA50C99
:1001D000A40CA30C0310A10BC82801308C07031832
:1001E00015298D1BFA28A50D8F0D8E0D8D0D8C03F5
:1001F00003191529A51F0B298F0A031D0B298E0A28
:10020000031D0B298D0A031D0B298D0C8E0C8F0CE1
:100210008C0A031915291A08A2001E08A206A21F9B
:1002200013298D1719298D1319298C018D018E0120
:100230008F01000049291D308400FC308005800CAE
:10024000800C00080319282926290000800B252985
:10025000542918080F02031D322983160510831232
:100260000514362983168510831285149A01170800
:10027000990086289C019B017A309A00843099006D
:100280000F08A0000E089F000D089E000C089D009E
:10029000A4280C0899000D089A000E089B000F086E
:1002A0009C000C089D001B291808283C031D5D2993
:1002B0008316051083120510612983168510831299
:1002C00085100034831685158312851D622914302C
:1002D0008C008C0B69290000831685158312851903
:1002E000742900308D009829F9308C008C0B762908
:1002F00000000000831685158312851D83291A08C6
:100300008400800187291A0884000130800053305E
:100310008C008C0B89291A0884008008031D9229FF
:1003200005109329051483160510013083128D00E2
:100330000034170884008001013098001808043C3C
:10034000031CBE29170884000310000C8C008000D9
:1003500019309A0062218D08031DB12900308D00EB
:10036000C02917088400190D8C008C0D8C0DF830F5
:100370008C050C0800048000980A9E2901308D002D
:10038000003401301A029C001B08023C031DCA29DC
:1003900040309C071C0880389D009E011D089F006E
:1003A0003720003419088C000C300C020319E529A1
:1003B0000A300C020319ED290D300C020319F32940
:1003C00008300C020319F829FD299E0101309F0015
:1003D000372002309A000C20092A01309A0002309E
:1003E0009B00C121092A01309A009B00C121092AE2
:1003F0009E0110309F003720092A19081F3C031C5A
:10040000032A0730990501309E0019089F00372004
:10041000092A00341A088D0119020318122A190832
:100420008C001E2A8C0108309B00990D8C0D1A0837
:100430000C0203188C008D0D9B0B152A00340D083F
:100440001708990064309A000A220C0897000D08DA
:100450003030031D322A181898159819382A181A9E
:100460002030342A981118128D070D089900D221D6
:10047000170899000A309A000A220C0897000D0804
:100480003030031D472A98194B2A181A20308D073F
:100490000D089900D2213030970717089900D22112
:1004A000003484011F30830592014D2804309100EF
:1004B0001208970028309800292113089700293046
:1004C0009800292191010E309A0062218D08031DA8
:1004D0006A2A582A0E0B6E2A910A6F2A582A110886
:1004E000033C0318632A1430970099218D08031DDB
:1004F0007A2A582A1530970099218D08031D812AE0
:10050000582A1630970099218D08031D882A582AE9
:100510001608150203198D2A582A1408FD3E0318DF
:100520009E2A033ED32A15088F000F0892009E2AA8
:1005300015089000100893009E2A9E2A01309A0008
:100540009B00C12158309900D2213A309900D22124
:1005500020309900D2210F089700183098001F22F0
:100560000630970020309900D221970BB22A013033
:100570009A0002309B00C12159309900D2213A30B3
:100580009900D22120309900D2211008970018300C
:1005900098001F220630970020309900D221970B37
:1005A000CC2A562A63000A108A140A118207932A59
:0405B000982A9D2ABE
:02400E00F13F80
:00000001FF
;PIC16F84
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.LST
0,0 → 1,1033
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\prenos\letadlo\prijimac\main.LST
 
ROM used: 730 (71%)
Largest free fragment is 294
RAM used: 9 (13%) at main() level
26 (38%) worst case
Stack: 5 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 251
0003: NOP
.................... #include "main.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #use delay(clock=4000000)
*
000C: MOVLW 1A
000D: MOVWF 04
000E: MOVF 00,W
000F: BTFSC 03.2
0010: GOTO 020
0011: MOVLW 01
0012: MOVWF 0D
0013: CLRF 0C
0014: DECFSZ 0C,F
0015: GOTO 014
0016: DECFSZ 0D,F
0017: GOTO 013
0018: MOVLW 4A
0019: MOVWF 0C
001A: DECFSZ 0C,F
001B: GOTO 01A
001C: NOP
001D: NOP
001E: DECFSZ 00,F
001F: GOTO 011
0020: RETLW 00
*
011B: MOVLW 1D
011C: MOVWF 04
011D: MOVLW FC
011E: ANDWF 00,F
011F: RRF 00,F
0120: RRF 00,F
0121: MOVF 00,W
0122: BTFSC 03.2
0123: GOTO 128
0124: GOTO 126
0125: NOP
0126: DECFSZ 00,F
0127: GOTO 125
0128: GOTO 154 (RETURN)
.................... #fuses XT,NOWDT,PUT
....................
....................
.................... #include "..\common.h"
.................... #DEFINE OSA_X 0 // adresy os
.................... #DEFINE OSA_Y 1
.................... #DEFINE TLs 2
.................... #DEFINE IMPULS 250 // sirka impulsu
....................
....................
.................... #DEFINE LCD_RS PIN_B1 // rizeni registru LCD displeje
.................... #DEFINE LCD_E PIN_B0 // enable LCD displeje
.................... #DEFINE LCD_DATA_LSB PIN_B2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
.................... #INCLUDE "MYLCD.C"
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
.................... // (c)miho 2002
.................... //
.................... // Historie:
.................... //
.................... // 0.0 Uvodni verze se snadnou definici portu LCD 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_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:
.................... //
.................... // #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)
....................
....................
....................
....................
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje
....................
....................
....................
....................
.................... // 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 dataoveho 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
....................
....................
.................... // 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)
.................... };
*
0004: BCF 0A.0
0005: BCF 0A.1
0006: BCF 0A.2
0007: ADDWF 02,F
0008: RETLW 28
0009: RETLW 0C
000A: RETLW 01
000B: RETLW 06
....................
....................
.................... // Odesle nibble do displeje (posle data a klikne signalem e)
.................... //
.................... void lcd_send_nibble( BYTE n )
.................... {
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
*
0021: MOVF 06,W
0022: ANDLW C3
0023: MOVWF 21
0024: RLF 20,W
0025: MOVWF 0C
0026: RLF 0C,F
0027: MOVLW FC
0028: ANDWF 0C,F
0029: MOVF 0C,W
002A: ANDLW 3C
002B: IORWF 21,W
002C: MOVWF 06
.................... output_bit(LCD_E,1); // vzestupna hrana
002D: BSF 06.0
002E: BSF 03.5
002F: BCF 06.0
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
0030: NOP
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
0031: BCF 03.5
0032: BCF 06.0
0033: BSF 03.5
0034: BCF 06.0
0035: BCF 03.5
0036: 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
0037: MOVF 1E,F
0038: BTFSS 03.2
0039: GOTO 03C
003A: BCF 06.1
003B: GOTO 03D
003C: BSF 06.1
003D: BSF 03.5
003E: BCF 06.1
.................... swap(n);
003F: BCF 03.5
0040: SWAPF 1F,F
.................... lcd_send_nibble(n); // posli horni pulku bajtu
0041: MOVF 1F,W
0042: MOVWF 20
0043: CALL 021
.................... swap(n);
0044: SWAPF 1F,F
.................... lcd_send_nibble(n); // posli spodni pulku bajtu
0045: MOVF 1F,W
0046: MOVWF 20
0047: CALL 021
.................... delay_us(40); // minimalni doba na provedeni prikazu
0048: MOVLW 0D
0049: MOVWF 0C
004A: DECFSZ 0C,F
004B: GOTO 04A
004C: 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
004D: MOVLW 14
004E: MOVWF 1A
004F: CALL 00C
....................
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
0050: MOVLW C3
0051: BSF 03.5
0052: ANDWF 06,F
....................
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
0053: BCF 03.5
0054: BCF 06.1
0055: BSF 03.5
0056: BCF 06.1
.................... output_bit(LCD_E,0); // nastav jako vystup a nastav klidovy stav
0057: BCF 03.5
0058: BCF 06.0
0059: BSF 03.5
005A: BCF 06.0
....................
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
005B: BCF 03.5
005C: CLRF 17
005D: MOVF 17,W
005E: SUBLW 02
005F: BTFSS 03.0
0060: GOTO 069
.................... {
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
0061: MOVLW 02
0062: MOVWF 1A
0063: CALL 00C
.................... lcd_send_nibble(3); // rezim 8 bitu
0064: MOVLW 03
0065: MOVWF 20
0066: CALL 021
.................... }
0067: INCF 17,F
0068: GOTO 05D
....................
.................... delay_us(40); // cas na zpracovani
0069: MOVLW 0D
006A: MOVWF 0C
006B: DECFSZ 0C,F
006C: GOTO 06B
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
006D: MOVLW 02
006E: MOVWF 20
006F: CALL 021
.................... delay_us(40); // cas na zpracovani
0070: MOVLW 0D
0071: MOVWF 0C
0072: DECFSZ 0C,F
0073: GOTO 072
....................
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
0074: CLRF 17
0075: MOVF 17,W
0076: SUBLW 02
0077: BTFSS 03.0
0078: GOTO 085
.................... {
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
0079: MOVF 17,W
007A: CALL 004
007B: MOVWF 18
007C: CLRF 1E
007D: MOVF 18,W
007E: MOVWF 1F
007F: CALL 037
.................... delay_ms(2);
0080: MOVLW 02
0081: MOVWF 1A
0082: CALL 00C
.................... }
0083: INCF 17,F
0084: GOTO 075
0085: GOTO 256 (RETURN)
.................... }
....................
....................
.................... // Proved presun kurzoru
.................... //
.................... // Pozice 1.1 je domu
.................... //
.................... void lcd_gotoxy( BYTE x, BYTE y)
.................... {
....................
.................... BYTE Adr;
....................
.................... Adr=x-1;
*
01C1: MOVLW 01
01C2: SUBWF 1A,W
01C3: MOVWF 1C
.................... if(y==2)
01C4: MOVF 1B,W
01C5: SUBLW 02
01C6: BTFSS 03.2
01C7: GOTO 1CA
.................... Adr+=LCD_LINE_2;
01C8: MOVLW 40
01C9: ADDWF 1C,F
....................
.................... lcd_send_byte(0,0x80|Adr);
01CA: MOVF 1C,W
01CB: IORLW 80
01CC: MOVWF 1D
01CD: CLRF 1E
01CE: MOVF 1D,W
01CF: MOVWF 1F
01D0: CALL 037
01D1: RETLW 00
.................... }
....................
....................
.................... // Zapis znaku na displej, zpracovani ridicich znaku
.................... //
.................... void lcd_putc( char c)
.................... {
....................
.................... switch (c)
01D2: MOVF 19,W
01D3: MOVWF 0C
01D4: MOVLW 0C
01D5: SUBWF 0C,W
01D6: BTFSC 03.2
01D7: GOTO 1E5
01D8: MOVLW 0A
01D9: SUBWF 0C,W
01DA: BTFSC 03.2
01DB: GOTO 1ED
01DC: MOVLW 0D
01DD: SUBWF 0C,W
01DE: BTFSC 03.2
01DF: GOTO 1F3
01E0: MOVLW 08
01E1: SUBWF 0C,W
01E2: BTFSC 03.2
01E3: GOTO 1F8
01E4: GOTO 1FD
.................... {
.................... case '\f' : lcd_send_byte(0,1); // smaz displej
01E5: CLRF 1E
01E6: MOVLW 01
01E7: MOVWF 1F
01E8: CALL 037
.................... delay_ms(2);
01E9: MOVLW 02
01EA: MOVWF 1A
01EB: CALL 00C
.................... break;
01EC: GOTO 209
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
01ED: MOVLW 01
01EE: MOVWF 1A
01EF: MOVLW 02
01F0: MOVWF 1B
01F1: CALL 1C1
01F2: GOTO 209
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home
01F3: MOVLW 01
01F4: MOVWF 1A
01F5: MOVWF 1B
01F6: CALL 1C1
01F7: GOTO 209
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
01F8: CLRF 1E
01F9: MOVLW 10
01FA: MOVWF 1F
01FB: CALL 037
01FC: GOTO 209
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
01FD: MOVF 19,W
01FE: SUBLW 1F
01FF: BTFSS 03.0
0200: GOTO 203
0201: MOVLW 07
0202: ANDWF 19,F
.................... lcd_send_byte(1,c); break; // zapis znak
0203: MOVLW 01
0204: MOVWF 1E
0205: MOVF 19,W
0206: MOVWF 1F
0207: CALL 037
0208: GOTO 209
.................... }
0209: RETLW 00
.................... }
....................
....................
.................... // 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_);
.................... }
....................
....................
.................... // 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_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);
.................... //}
....................
.................... #DEFINE PRIJIMAC PIN_A3 // pin na ktery je pripojen prijimac
.................... #DEFINE SERVO_X PIN_A0 // pin na ktery je pripojeno servo
.................... #DEFINE SERVO_Y PIN_A1
....................
.................... int8 bit,x,y;
.................... int counter; // pocitadlo 1 a 0 v detektoru
.................... int x_old=0,y_old;
....................
.................... void servo(int uhel, int souradnice)
.................... {
....................
....................
.................... if (X==souradnice) output_high(SERVO_X); else output_high(SERVO_Y);
*
0129: MOVF 18,W
012A: SUBWF 0F,W
012B: BTFSS 03.2
012C: GOTO 132
012D: BSF 03.5
012E: BCF 05.0
012F: BCF 03.5
0130: BSF 05.0
0131: GOTO 136
0132: BSF 03.5
0133: BCF 05.1
0134: BCF 03.5
0135: BSF 05.1
....................
.................... delay_us(62.5*uhel);
0136: CLRF 1A
0137: MOVF 17,W
0138: MOVWF 19
0139: GOTO 086
013A: CLRF 1C
013B: CLRF 1B
013C: MOVLW 7A
013D: MOVWF 1A
013E: MOVLW 84
013F: MOVWF 19
0140: MOVF 0F,W
0141: MOVWF 20
0142: MOVF 0E,W
0143: MOVWF 1F
0144: MOVF 0D,W
0145: MOVWF 1E
0146: MOVF 0C,W
0147: MOVWF 1D
0148: GOTO 0A4
0149: MOVF 0C,W
014A: MOVWF 19
014B: MOVF 0D,W
014C: MOVWF 1A
014D: MOVF 0E,W
014E: MOVWF 1B
014F: MOVF 0F,W
0150: MOVWF 1C
0151: MOVF 0C,W
0152: MOVWF 1D
0153: GOTO 11B
....................
.................... if (SERVO_X==souradnice) output_low(SERVO_X); else output_low(SERVO_Y);
0154: MOVF 18,W
0155: SUBLW 28
0156: BTFSS 03.2
0157: GOTO 15D
0158: BSF 03.5
0159: BCF 05.0
015A: BCF 03.5
015B: BCF 05.0
015C: GOTO 161
015D: BSF 03.5
015E: BCF 05.1
015F: BCF 03.5
0160: BCF 05.1
0161: RETLW 00
.................... // delay_ms(10);
....................
....................
.................... }
....................
.................... int8 prijmout(int8* bit)
.................... {
.................... // || |
.................... // |--|_____ 1
.................... // |
.................... // |-|__|-|_ 0
....................
.................... while (!input(PRIJIMAC)) ; // cekej na jednicku
0162: BSF 03.5
0163: BSF 05.3
0164: BCF 03.5
0165: BTFSS 05.3
0166: GOTO 162
.................... delay_us(IMPULS/4); // presvec se, jestli je stale 1 po 1/4 impulsu
0167: MOVLW 14
0168: MOVWF 0C
0169: DECFSZ 0C,F
016A: GOTO 169
016B: NOP
.................... if (!input(PRIJIMAC)) return(false); // vrat chybu, kdyz neni stale 1
016C: BSF 03.5
016D: BSF 05.3
016E: BCF 03.5
016F: BTFSC 05.3
0170: GOTO 174
0171: MOVLW 00
0172: MOVWF 0D
0173: GOTO 198
.................... delay_us(3*IMPULS); // pockej na rozhodovaci misto
0174: MOVLW F9
0175: MOVWF 0C
0176: DECFSZ 0C,F
0177: GOTO 176
0178: NOP
0179: NOP
.................... if (input(PRIJIMAC)) *bit=0; else *bit=1; // dekoduj 1 nebo 0
017A: BSF 03.5
017B: BSF 05.3
017C: BCF 03.5
017D: BTFSS 05.3
017E: GOTO 183
017F: MOVF 1A,W
0180: MOVWF 04
0181: CLRF 00
0182: GOTO 187
0183: MOVF 1A,W
0184: MOVWF 04
0185: MOVLW 01
0186: MOVWF 00
.................... delay_us(IMPULS); // pockej na konec znaku
0187: MOVLW 53
0188: MOVWF 0C
0189: DECFSZ 0C,F
018A: GOTO 189
....................
.................... output_bit(PIN_A0, *bit); // kontrolni vystup
018B: MOVF 1A,W
018C: MOVWF 04
018D: MOVF 00,F
018E: BTFSS 03.2
018F: GOTO 192
0190: BCF 05.0
0191: GOTO 193
0192: BSF 05.0
0193: BSF 03.5
0194: BCF 05.0
....................
.................... return(true); // vrat, ze se cteni povedlo
0195: MOVLW 01
0196: BCF 03.5
0197: MOVWF 0D
0198: RETLW 00
.................... }
....................
.................... int8 read_nibble(int8* value)
.................... {
.................... int8 n; // citac
.................... int8 bit; // pomocna promenna
....................
.................... *value=0;
0199: MOVF 17,W
019A: MOVWF 04
019B: CLRF 00
.................... for (n=1; n<=4; n++) // prijmi 4 bity
019C: MOVLW 01
019D: MOVWF 18
019E: MOVF 18,W
019F: SUBLW 04
01A0: BTFSS 03.0
01A1: GOTO 1BE
.................... {
.................... *value >>= 1; // posun jiz prectene do leva
01A2: MOVF 17,W
01A3: MOVWF 04
01A4: BCF 03.0
01A5: RRF 00,W
01A6: MOVWF 0C
01A7: MOVWF 00
.................... if (0==prijmout(&bit)) return(false); // prijmi bit; pri chybe cteni vrat chybu
01A8: MOVLW 19
01A9: MOVWF 1A
01AA: CALL 162
01AB: MOVF 0D,F
01AC: BTFSS 03.2
01AD: GOTO 1B1
01AE: MOVLW 00
01AF: MOVWF 0D
01B0: GOTO 1C0
.................... *value |= bit << 3; // pridej bit do nibblu
01B1: MOVF 17,W
01B2: MOVWF 04
01B3: RLF 19,W
01B4: MOVWF 0C
01B5: RLF 0C,F
01B6: RLF 0C,F
01B7: MOVLW F8
01B8: ANDWF 0C,F
01B9: MOVF 0C,W
01BA: IORWF 00,W
01BB: MOVWF 00
.................... };
01BC: INCF 18,F
01BD: GOTO 19E
.................... return(true); // vrat 1, jako ,ze je vse O.K.
01BE: MOVLW 01
01BF: MOVWF 0D
01C0: RETLW 00
.................... }
....................
.................... /*void dekodovat(void)
.................... {
.................... int8 osa, hodnota, kontrola;
....................
.................... counter=4;
....................
.................... decoder:
....................
.................... counter=0; // vynuluj citac
.................... do // vyhledej synchronizacni jednicky
.................... {
.................... if (!prijmout(&bit)) goto decoder; // prijmi bit; pri chybe zacni znovu
.................... if (1==bit) counter++; else goto decoder; // kdyz je bit 1, tak zvys citac; jinak zacni znovu
.................... } while(counter<4); // pockej na 4 jednicky
....................
.................... if (!read_nibble(&osa)) goto decoder; // nacti identifikator osy
....................
.................... if (!read_nibble(&hodnota)) goto decoder; // nacti 1. nibble; pri chybe zacni znovu
.................... if (!read_nibble(&kontrola)) goto decoder; // nacti 2. nibble; pri chybe zacni znovu
.................... if (hodnota != kontrola) goto decoder; // zacni znovu, pokud jsou ruzne nibble
....................
.................... switch (osa) // rozeskoc se podle adresy osy
.................... {
.................... case OSA_X:
.................... {
.................... x=hodnota;
.................... break;
.................... };
.................... case OSA_Y:
.................... {
.................... y=hodnota;
.................... break;
.................... };
.................... case TLs:
.................... {
.................... break;
.................... };
.................... };
.................... }
.................... */
.................... void main()
.................... {
*
0251: CLRF 04
0252: MOVLW 1F
0253: ANDWF 03,F
0254: CLRF 12
.................... lcd_init(); // zinicializuj LCD display
0255: GOTO 04D
....................
.................... while (true)
.................... {
.................... int8 osa, hodnota, kontrola;
....................
.................... counter=4;
0256: MOVLW 04
0257: MOVWF 11
....................
.................... decoder:
....................
.................... servo(x_old,SERVO_X);
0258: MOVF 12,W
0259: MOVWF 17
025A: MOVLW 28
025B: MOVWF 18
025C: CALL 129
....................
.................... servo(y_old,SERVO_Y);
025D: MOVF 13,W
025E: MOVWF 17
025F: MOVLW 29
0260: MOVWF 18
0261: CALL 129
....................
.................... counter=0; // vynuluj citac
0262: CLRF 11
.................... do // vyhledej synchronizacni jednicky
.................... {
.................... if (!prijmout(&bit)) goto decoder; // prijmi bit; pri chybe zacni znovu
0263: MOVLW 0E
0264: MOVWF 1A
0265: CALL 162
0266: MOVF 0D,F
0267: BTFSS 03.2
0268: GOTO 26A
0269: GOTO 258
.................... if (1==bit) counter++; else goto decoder; // kdyz je bit 1, tak zvys citac; jinak zacni znovu
026A: DECFSZ 0E,W
026B: GOTO 26E
026C: INCF 11,F
026D: GOTO 26F
026E: GOTO 258
.................... } while(counter<4); // pockej na 4 jednicky
026F: MOVF 11,W
0270: SUBLW 03
0271: BTFSC 03.0
0272: GOTO 263
....................
.................... if (!read_nibble(&osa)) goto decoder; // nacti identifikator osy
0273: MOVLW 14
0274: MOVWF 17
0275: CALL 199
0276: MOVF 0D,F
0277: BTFSS 03.2
0278: GOTO 27A
0279: GOTO 258
....................
.................... if (!read_nibble(&hodnota)) goto decoder; // nacti 1. nibble; pri chybe zacni znovu
027A: MOVLW 15
027B: MOVWF 17
027C: CALL 199
027D: MOVF 0D,F
027E: BTFSS 03.2
027F: GOTO 281
0280: GOTO 258
.................... if (!read_nibble(&kontrola)) goto decoder; // nacti 2. nibble; pri chybe zacni znovu
0281: MOVLW 16
0282: MOVWF 17
0283: CALL 199
0284: MOVF 0D,F
0285: BTFSS 03.2
0286: GOTO 288
0287: GOTO 258
.................... if (hodnota != kontrola) goto decoder; // zacni znovu, pokud jsou ruzne nibble
0288: MOVF 16,W
0289: SUBWF 15,W
028A: BTFSC 03.2
028B: GOTO 28D
028C: GOTO 258
....................
.................... switch (osa) // rozeskoc se podle adresy osy
028D: MOVF 14,W
028E: ADDLW FD
028F: BTFSC 03.0
0290: GOTO 29E
0291: ADDLW 03
0292: GOTO 2D3
.................... {
.................... case OSA_X:
.................... {
....................
.................... x=hodnota;
0293: MOVF 15,W
0294: MOVWF 0F
.................... x_old=x;
0295: MOVF 0F,W
0296: MOVWF 12
....................
.................... break;
0297: GOTO 29E
.................... };
.................... case OSA_Y:
.................... {
.................... y=hodnota;
0298: MOVF 15,W
0299: MOVWF 10
.................... y_old=y;
029A: MOVF 10,W
029B: MOVWF 13
....................
.................... break;
029C: GOTO 29E
.................... };
.................... case TLs:
.................... {
.................... break;
029D: GOTO 29E
.................... };
.................... };
*
02D3: BCF 0A.0
02D4: BSF 0A.1
02D5: BCF 0A.2
02D6: ADDWF 02,F
02D7: GOTO 293
02D8: GOTO 298
02D9: GOTO 29D
....................
....................
.................... lcd_gotoxy(1,1); // vytiskni X a Y
*
029E: MOVLW 01
029F: MOVWF 1A
02A0: MOVWF 1B
02A1: CALL 1C1
.................... printf(lcd_putc,"X: %U ", x);
*
021F: MOVF 0D,W
0220: MOVF 17,W
0221: MOVWF 19
0222: MOVLW 64
0223: MOVWF 1A
0224: CALL 20A
0225: MOVF 0C,W
0226: MOVWF 17
0227: MOVF 0D,W
0228: MOVLW 30
0229: BTFSS 03.2
022A: GOTO 232
022B: BTFSC 18.0
022C: BSF 18.3
022D: BTFSC 18.3
022E: GOTO 238
022F: BTFSC 18.4
0230: MOVLW 20
0231: GOTO 234
0232: BCF 18.3
0233: BCF 18.4
0234: ADDWF 0D,F
0235: MOVF 0D,W
0236: MOVWF 19
0237: CALL 1D2
0238: MOVF 17,W
0239: MOVWF 19
023A: MOVLW 0A
023B: MOVWF 1A
023C: CALL 20A
023D: MOVF 0C,W
023E: MOVWF 17
023F: MOVF 0D,W
0240: MOVLW 30
0241: BTFSS 03.2
0242: GOTO 247
0243: BTFSC 18.3
0244: GOTO 24B
0245: BTFSC 18.4
0246: MOVLW 20
0247: ADDWF 0D,F
0248: MOVF 0D,W
0249: MOVWF 19
024A: CALL 1D2
024B: MOVLW 30
024C: ADDWF 17,F
024D: MOVF 17,W
024E: MOVWF 19
024F: CALL 1D2
0250: RETLW 00
*
02A2: MOVLW 58
02A3: MOVWF 19
02A4: CALL 1D2
02A5: MOVLW 3A
02A6: MOVWF 19
02A7: CALL 1D2
02A8: MOVLW 20
02A9: MOVWF 19
02AA: CALL 1D2
02AB: MOVF 0F,W
02AC: MOVWF 17
02AD: MOVLW 18
02AE: MOVWF 18
02AF: CALL 21F
02B0: MOVLW 06
02B1: MOVWF 17
02B2: MOVLW 20
02B3: MOVWF 19
02B4: CALL 1D2
02B5: DECFSZ 17,F
02B6: GOTO 2B2
.................... lcd_gotoxy(1,2);
02B7: MOVLW 01
02B8: MOVWF 1A
02B9: MOVLW 02
02BA: MOVWF 1B
02BB: CALL 1C1
.................... printf(lcd_putc,"Y: %U ", y);
02BC: MOVLW 59
02BD: MOVWF 19
02BE: CALL 1D2
02BF: MOVLW 3A
02C0: MOVWF 19
02C1: CALL 1D2
02C2: MOVLW 20
02C3: MOVWF 19
02C4: CALL 1D2
02C5: MOVF 10,W
02C6: MOVWF 17
02C7: MOVLW 18
02C8: MOVWF 18
02C9: CALL 21F
02CA: MOVLW 06
02CB: MOVWF 17
02CC: MOVLW 20
02CD: MOVWF 19
02CE: CALL 1D2
02CF: DECFSZ 17,F
02D0: GOTO 2CC
.................... }
02D1: GOTO 256
.................... }
....................
02D2: SLEEP
....................
....................
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.PJT
0,0 → 1,32
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\Devices;C:\Program Files\PICC\Dri;
Library=
LinkerScript=
 
[Target Data]
FileList=main.c;
BuildTool=CCSC
OptionString=-p +FM
AdditionalOptionString=
BuildRequired=1
 
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.c
 
[Windows]
0=0000 main.c 0 0 796 451 3 0
 
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.STA
0,0 → 1,45
 
ROM used: 730 (71%)
294 (29%) including unused fragments
 
1 Average locations per line
6 Average locations per statement
 
RAM used: 9 (13%) at main() level
26 (38%) worst case
 
Lines Stmts % Files
----- ----- --- -----
165 70 60 d:\@kaklik\programy\pic_c\prenos\letadlo\prijimac\main.c
5 0 0 d:\@kaklik\programy\pic_c\prenos\letadlo\prijimac\main.h
111 0 0 C:\Program Files\PICC\Devices\16F84.h
5 0 0 d:\@kaklik\programy\pic_c\prenos\letadlo\common.h
272 46 25 d:\@kaklik\programy\pic_c\prenos\letadlo\prijimac\MYLCD.C
----- -----
1116 232 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 3 1 delay_ms
0 14 2 1 delay_us
0 8 1 0 @const22
0 22 3 3 lcd_send_nibble
0 22 3 2 lcd_send_byte
0 57 8 2 lcd_init
0 17 2 4 lcd_gotoxy
0 56 8 1 lcd_putc
0 57 8 6 servo
0 30 4 2 @ITOF
0 119 16 13 @MULFF
0 55 8 2 prijmout
0 40 5 5 read_nibble
0 130 18 1 main
0 7 1 0 @goto10184
0 21 3 3 @DIV88
0 50 7 2 @PRINTF_U_148
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 726 294
 
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.SYM
0,0 → 1,81
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00E bit
00F x
010 y
011 counter
012 x_old
013 y_old
014 osa
015 hodnota
016 kontrola
017 lcd_init.i
017 servo.uhel
017 read_nibble.value
017 @PRINTF_U_148.P1
017 main.@SCRATCH
018 servo.souradnice
018 read_nibble.n
018 @PRINTF_U_148.P1
018 lcd_init.@SCRATCH
019 lcd_putc.c
019-01A @ITOF.P1
019-01C @MULFF.P2
019 read_nibble.bit
019 @DIV88.P1
019 servo.@SCRATCH
01A delay_ms.P1
01A lcd_gotoxy.x
01A prijmout.bit
01A @DIV88.P1
01A servo.@SCRATCH
01A read_nibble.@SCRATCH
01B lcd_gotoxy.y
01B servo.@SCRATCH
01B prijmout.@SCRATCH
01B read_nibble.@SCRATCH
01B @DIV88.@SCRATCH
01C lcd_gotoxy.Adr
01C servo.@SCRATCH
01D delay_us.P1
01D-020 @MULFF.P2
01D lcd_gotoxy.@SCRATCH
01E lcd_send_byte.Adr
01F lcd_send_byte.n
020 lcd_send_nibble.n
021 lcd_send_nibble.@SCRATCH
021 @MULFF.@SCRATCH
022 lcd_send_nibble.@SCRATCH
022 @MULFF.@SCRATCH
023 @MULFF.@SCRATCH
024 @MULFF.@SCRATCH
025 @MULFF.@SCRATCH
-002 LCD_INIT_STRING
lcd_putc2.Data
 
000C delay_ms
011B delay_us
0004 @const22
0021 lcd_send_nibble
0037 lcd_send_byte
004D lcd_init
01C1 lcd_gotoxy
01D2 lcd_putc
0129 servo
0086 @ITOF
00A4 @MULFF
0162 prijmout
0199 read_nibble
0251 main
02D3 @goto10184
020A @DIV88
021F @PRINTF_U_148
0258 decoder
 
Project Files:
d:\@kaklik\programy\pic_c\prenos\letadlo\prijimac\main.c
d:\@kaklik\programy\pic_c\prenos\letadlo\prijimac\main.h
C:\Program Files\PICC\Devices\16F84.h
d:\@kaklik\programy\pic_c\prenos\letadlo\common.h
d:\@kaklik\programy\pic_c\prenos\letadlo\prijimac\MYLCD.C
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MAIN.TRE
0,0 → 1,309
ÀÄmain
ÀÄmain 0/130 Ram=1
ÃÄ??0??
ÃÄlcd_init 0/57 Ram=2
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÃÄ@const22 0/8 Ram=0
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄdelay_ms 0/21 Ram=1
ÃÄservo 0/57 Ram=6
³ ÃÄ@ITOF 0/30 Ram=2
³ ÃÄ@MULFF 0/119 Ram=13
³ ÀÄdelay_us 0/14 Ram=1
ÃÄservo 0/57 Ram=6
³ ÃÄ@ITOF 0/30 Ram=2
³ ÃÄ@MULFF 0/119 Ram=13
³ ÀÄdelay_us 0/14 Ram=1
ÃÄprijmout 0/55 Ram=2
ÃÄread_nibble 0/40 Ram=5
³ ÀÄprijmout 0/55 Ram=2
ÃÄread_nibble 0/40 Ram=5
³ ÀÄprijmout 0/55 Ram=2
ÃÄread_nibble 0/40 Ram=5
³ ÀÄprijmout 0/55 Ram=2
ÃÄ@goto10184 0/7 Ram=0
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_putc 0/56 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_putc 0/56 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_putc 0/56 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄ@PRINTF_U_148 0/50 Ram=2
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/56 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄdelay_ms 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/56 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄdelay_ms 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_putc 0/56 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_putc 0/56 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_putc 0/56 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_putc 0/56 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_putc 0/56 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄ@PRINTF_U_148 0/50 Ram=2
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/56 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄdelay_ms 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/56 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄdelay_ms 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_putc 0/56 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄdelay_ms 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ³ ÀÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÀÄlcd_putc 0/56 Ram=1
ÃÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄdelay_ms 0/21 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÃÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/22 Ram=3
³ ÀÄlcd_send_nibble 0/22 Ram=3
ÀÄlcd_send_byte 0/22 Ram=2
ÃÄlcd_send_nibble 0/22 Ram=3
ÀÄlcd_send_nibble 0/22 Ram=3
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MYLCD.BAK
0,0 → 1,271
// LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
// (c)miho 2002
//
// Historie:
//
// 0.0 Uvodni verze se snadnou definici portu LCD 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_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:
//
// #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)
 
 
 
 
// Privatni sekce, cist jen v pripade, ze neco nefunguje
 
 
 
 
// 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 dataoveho 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
 
 
// 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 )
{
*LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
output_bit(LCD_E,1); // vzestupna hrana
delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
}
 
 
// 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
swap(n);
lcd_send_nibble(n); // posli horni pulku bajtu
swap(n);
lcd_send_nibble(n); // posli spodni pulku bajtu
delay_us(40); // minimalni doba na provedeni prikazu
}
 
 
// 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
 
*LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
 
output_bit(PIN_B2,0); // nastav jako vystup a nastav klidovy stav
output_bit(PIN_B1,0); // nastav jako vystup a nastav klidovy stav
 
for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
{
delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
lcd_send_nibble(3); // rezim 8 bitu
}
 
delay_us(40); // cas na zpracovani
lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
delay_us(40); // cas na zpracovani
 
for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
{
lcd_send_byte(0,LCD_INIT_STRING[i]);
delay_ms(2);
}
}
 
 
// Proved presun kurzoru
//
// Pozice 1.1 je domu
//
void lcd_gotoxy( BYTE x, BYTE y)
{
 
BYTE Adr;
 
Adr=x-1;
if(y==2)
Adr+=LCD_LINE_2;
 
lcd_send_byte(0,0x80|Adr);
}
 
 
// Zapis znaku na displej, zpracovani ridicich znaku
//
void lcd_putc( char c)
{
 
switch (c)
{
case '\f' : lcd_send_byte(0,1); // smaz displej
delay_ms(2);
break;
case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
case '\r' : lcd_gotoxy(1,1); break; // presun home
case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
lcd_send_byte(1,c); break; // zapis znak
}
}
 
 
// 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_);
}
 
 
// 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_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);
//}
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/MYLCD.C
0,0 → 1,271
// LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
// (c)miho 2002
//
// Historie:
//
// 0.0 Uvodni verze se snadnou definici portu LCD 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_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:
//
// #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)
 
 
 
 
// Privatni sekce, cist jen v pripade, ze neco nefunguje
 
 
 
 
// 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 dataoveho 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
 
 
// 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 )
{
*LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
output_bit(LCD_E,1); // vzestupna hrana
delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
}
 
 
// 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
swap(n);
lcd_send_nibble(n); // posli horni pulku bajtu
swap(n);
lcd_send_nibble(n); // posli spodni pulku bajtu
delay_us(40); // minimalni doba na provedeni prikazu
}
 
 
// 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
 
*LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
 
output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
output_bit(LCD_E,0); // nastav jako vystup a nastav klidovy stav
 
for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
{
delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
lcd_send_nibble(3); // rezim 8 bitu
}
 
delay_us(40); // cas na zpracovani
lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
delay_us(40); // cas na zpracovani
 
for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
{
lcd_send_byte(0,LCD_INIT_STRING[i]);
delay_ms(2);
}
}
 
 
// Proved presun kurzoru
//
// Pozice 1.1 je domu
//
void lcd_gotoxy( BYTE x, BYTE y)
{
 
BYTE Adr;
 
Adr=x-1;
if(y==2)
Adr+=LCD_LINE_2;
 
lcd_send_byte(0,0x80|Adr);
}
 
 
// Zapis znaku na displej, zpracovani ridicich znaku
//
void lcd_putc( char c)
{
 
switch (c)
{
case '\f' : lcd_send_byte(0,1); // smaz displej
delay_ms(2);
break;
case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
case '\r' : lcd_gotoxy(1,1); break; // presun home
case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
lcd_send_byte(1,c); break; // zapis znak
}
}
 
 
// 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_);
}
 
 
// 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_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);
//}
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/PRG.BAT
0,0 → 1,6
call picpgr stop
call picpgr erase pic16c84
call picpgr program main.hex hex pic16c84
call picpgr run
pause
call picpgr stop
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/PRG.PIF
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/RUN.BAT
0,0 → 1,5
call picpgr run
pause
call picpgr stop
pause
run.bat
/schemata/prenos/letadlo/SW/prijimac/zaloha/01/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property