/schemata/prenos/letadlo/SW/vysilac/zaloha/03/!MAIN.C |
---|
0,0 → 1,33 |
#include "E:\@Dokumenty\pic\test_lcd_873\main.h" |
#DEFINE LCD_RS PIN_B1 // rizeni registru LCD displeje |
#DEFINE LCD_E PIN_B2 // enable LCD displeje |
#DEFINE LCD_DATA_LSB PIN_B4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou) |
#INCLUDE "MYLCD.C" |
void main() { |
setup_adc_ports(NO_ANALOGS); |
setup_adc(ADC_CLOCK_DIV_2); |
setup_spi(FALSE); |
setup_counters(RTCC_INTERNAL,RTCC_DIV_2); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DISABLED,0,1); |
lcd_init(); |
printf(lcd_putc,"\fStart 1 ..."); |
while(true) |
{ |
output_high(PIN_C1); |
output_low(PIN_C2); |
delay_ms(500); |
output_low(PIN_C1); |
output_high(PIN_C2); |
delay_ms(500); |
} |
} |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/KOPIE-~1.C |
---|
0,0 → 1,177 |
#include "E:\@Dokumenty\pic\vysilac\main.h" |
#DEFINE LCD_RS PIN_B1 // rizeni registru LCD displeje |
#DEFINE LCD_E PIN_B2 // enable LCD displeje |
#DEFINE LCD_DATA_LSB PIN_B4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou) |
#INCLUDE "MYLCD.C" |
#DEFINE VYSILAC PIN_C3 |
#DEFINE OSA_X 0 // adresa A/D prevodniku pro osu X |
#DEFINE OSA_Y 1 // adresa A/D prevodniku pro osu Y |
#DEFINE IMPULS 250 // sirka impulsu pro false |-| |
#DEFINE TTL1 PIN_b4 |
#DEFINE TTL2 PIN_b3 |
int stredX, stredY, x, y; |
void odeslat (int8 kodeslani) |
{ |
int i; |
for (i=0;i<=7;i++) |
{ |
if (1==bit_test(kodeslani,i)) |
{ |
output_high(VYSILAC); |
delay_us(2*IMPULS); // X pri 1: |--|___ |
output_low(VYSILAC); |
delay_us(3*IMPULS); |
} |
else |
{ |
output_high(VYSILAC); |
delay_us(IMPULS); // X pri 0: |-|__|-|_ |
output_low(VYSILAC); |
delay_us(2*IMPULS); |
output_high(VYSILAC); |
delay_us(IMPULS); |
output_low(VYSILAC); |
delay_us(IMPULS); |
}; |
} |
} |
void synchronizace() |
{ |
int8 sinchro; |
sinchro=0b00001111; |
odeslat (sinchro); // synchronizace: |--|___|--|___|--|___|--|___|-|__|-|_|-|__|-|_|-|__|-|_|-|__|-|_ |
} |
void odesli (int8 X, int8 Y) |
{ |
odeslat(X+ (X << 4)); |
odeslat(Y+ (Y << 4)); |
} |
void kalibrace() |
{ |
int8 min_x; |
int8 max_x; |
int8 min_y; |
int8 max_y; |
int8 sred_x; |
int8 sred_y; |
int8 adc; |
min_x=max_x=min_y=max_y=sred_x=sred_y=128; |
printf(lcd_putc,"Paku dejte do prostred a stisknete tlacitko"); |
znovu: |
if (TTL1 || TTL2) |
{ |
set_adc_channel(OSA_X); |
delay_us(10); |
sred_x=read_adc(); |
set_adc_channel(OSA_y); |
delay_us(10); |
sred_y=read_adc(); |
}; |
//else goto znovu; |
printf(lcd_putc,"\f"); |
printf(lcd_putc,"Pak "); |
set_adc_channel(OSA_X); |
delay_us(10); |
adc=read_adc(); |
if (max_x < adc )max_x=adc; |
if (min_x > adc )min_x=adc; |
set_adc_channel(OSA_y); |
delay_us(10); |
adc=read_adc(); |
if (max_y < adc )max_y=adc; |
if (min_y > adc )min_y=adc; |
if (TTL1 || TTL2) return; |
} |
void main() |
{ |
int c=0; |
setup_adc_ports(RA0_RA1_RA3_ANALOG); |
setup_adc(ADC_CLOCK_DIV_2); |
setup_spi(FALSE); |
setup_counters(RTCC_INTERNAL,RTCC_DIV_2); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DISABLED,0,1); |
lcd_init(); |
/* while (c<=16) |
{ |
lcd_gotoxy(c,1); |
printf(lcd_putc,"_"); |
delay_ms(50); |
printf(lcd_putc,"\f"); |
c++; |
} |
printf(lcd_putc,"\fAhoj!"); |
delay_ms(1500);*/ |
printf(lcd_putc,"\f"); |
while(true) |
{ |
set_adc_channel(OSA_X); |
lcd_gotoxy(1,1); |
x=read_adc() >> 4; |
printf(lcd_putc,"X: %D ", x); |
set_adc_channel(OSA_Y); |
lcd_gotoxy(1,2); |
y=read_adc() >> 4; |
printf(lcd_putc,"Y: %D ", y); |
/* output_high(PIN_C1); |
output_low(PIN_C2); |
delay_ms(100); |
output_low(PIN_C1); |
output_high(PIN_C2); |
delay_ms(100);*/ |
lcd_gotoxy(7,2); |
printf(lcd_putc,"vysilam"); |
output_high(PIN_C4); |
output_high(PIN_C6); |
delay_ms(1); |
output_low(PIN_C4); |
synchronizace(); |
odesli(x,y); |
output_low(PIN_C6); |
} |
} |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/MAIN.BAK |
---|
0,0 → 1,146 |
// Vysilac |
#include "main.h" |
#include "..\common.h" |
#DEFINE LCD_RS PIN_B1 // rizeni registru LCD displeje |
#DEFINE LCD_E PIN_B2 // enable LCD displeje |
#DEFINE LCD_DATA_LSB PIN_B4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou) |
#INCLUDE "MYLCD.C" |
#DEFINE VYSILAC PIN_C3 |
#DEFINE AD_OSA_X 0 // adresa A/D prevodniku pro osu X |
#DEFINE AD_OSA_Y 1 // adresa A/D prevodniku pro osu Y |
#DEFINE TTL1 PIN_B4 |
#DEFINE TTL2 PIN_B3 |
// Odesle nulu nebo jednicku podle nejnizsiho bitu predanych dat |
// Nula je posloupnost LH a jednicka je HL |
// |
void odeslat_bit(int8 data) |
{ |
output_bit(VYSILAC,bit_test(data,0)); |
delay_us(IMPULS); |
output_bit(VYSILAC,!bit_test(data,0)); |
delay_us(IMPULS); |
} |
// Odelse ramec o 4 bitech |
// Datovy ramec zacina 11, synchronizacni ramec zacina 10 |
// |
void odeslat_nibble(int1 datovy, int8 data) |
{ |
int i; |
delay_ms(3); // klidovy stav na lince |
odeslat_bit(1); // start bit |
odeslat_bit(datovy); |
for (i=5; --i!=0; ) // datove bity |
{ |
odeslat_bit(data); |
} |
output_low(VYSILAC); // klidovy stav |
} |
void odeslat_paket(int8 kanal, data) |
{ |
int8 suma; |
suma = kanal+data; |
odeslat_nibble(0,0b1111); // Synchronizace |
odeslat_nibble(1,kanal); // Identifikace osy |
odeslat_nibble(1,data); // Hodnota osy |
odeslat_nibble(1,suma); // Kontrolni soucet |
delay_ms(10); // cas pro prijimac aby mohl zpracovat data |
// mozno nahradit vysilanim jednicek |
} |
int stredX, stredY, x, y; |
void kalibrace() |
{ |
int8 min_x; |
int8 max_x; |
int8 min_y; |
int8 max_y; |
int8 sred_x; |
int8 sred_y; |
int8 adc; |
min_x=max_x=min_y=max_y=sred_x=sred_y=128; |
printf(lcd_putc,"Paku dejte do prostred a stisknete tlacitko"); |
znovu: |
if (TTL1 || TTL2) |
{ |
set_adc_channel(AD_OSA_X); |
delay_us(10); |
sred_x=read_adc(); |
set_adc_channel(AD_OSA_Y); |
delay_us(10); |
sred_y=read_adc(); |
}; |
//else goto znovu; |
printf(lcd_putc,"\f"); |
printf(lcd_putc,"Pak "); |
set_adc_channel(AD_OSA_X); |
delay_us(10); |
adc=read_adc(); |
if (max_x < adc )max_x=adc; |
if (min_x > adc )min_x=adc; |
set_adc_channel(AD_OSA_Y); |
delay_us(10); |
adc=read_adc(); |
if (max_y < adc )max_y=adc; |
if (min_y > adc )min_y=adc; |
if (TTL1 || TTL2) return; |
} |
void main() |
{ |
setup_adc_ports(RA0_RA1_RA3_ANALOG); |
setup_adc(ADC_CLOCK_DIV_2); |
setup_spi(FALSE); |
setup_counters(RTCC_INTERNAL,RTCC_DIV_2); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DISABLED,0,1); |
lcd_init(); |
printf(lcd_putc,"\fAhoj!"); |
delay_ms(300); |
while(true) |
{ |
set_adc_channel(AD_OSA_X); |
lcd_gotoxy(1,1); |
x=read_adc() >> 4; |
printf(lcd_putc,"X: %D ", x); |
set_adc_channel(AD_OSA_Y); |
lcd_gotoxy(1,2); |
y=read_adc() >> 4; |
printf(lcd_putc,"Y: %D ", y); |
odeslat_paket(OSA_X,x); |
odeslat_paket(OSA_Y,y); |
} |
} |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/MAIN.C |
---|
0,0 → 1,147 |
// Vysilac |
#include "main.h" |
#include "..\common.h" |
#DEFINE LCD_RS PIN_B1 // rizeni registru LCD displeje |
#DEFINE LCD_E PIN_B2 // enable LCD displeje |
#DEFINE LCD_DATA_LSB PIN_B4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou) |
#INCLUDE "MYLCD.C" |
#DEFINE VYSILAC PIN_C3 |
#DEFINE AD_OSA_X 0 // adresa A/D prevodniku pro osu X |
#DEFINE AD_OSA_Y 1 // adresa A/D prevodniku pro osu Y |
#DEFINE TTL1 PIN_B4 |
#DEFINE TTL2 PIN_B3 |
// Odesle nulu nebo jednicku podle nejnizsiho bitu predanych dat |
// Nula je posloupnost LH a jednicka je HL |
// |
void odeslat_bit(int8 data) |
{ |
output_bit(VYSILAC,bit_test(data,0)); |
delay_us(IMPULS); |
output_bit(VYSILAC,!bit_test(data,0)); |
delay_us(IMPULS); |
} |
// Odelse ramec o 4 bitech |
// Datovy ramec zacina 11, synchronizacni ramec zacina 10 |
// |
void odeslat_nibble(int1 datovy, int8 data) |
{ |
int i; |
delay_ms(3); // klidovy stav na lince |
odeslat_bit(1); // start bit |
odeslat_bit(datovy); |
for (i=5; --i!=0; ) // datove bity |
{ |
odeslat_bit(data); |
data>>=1; |
} |
output_low(VYSILAC); // klidovy stav |
} |
void odeslat_paket(int8 kanal, data) |
{ |
int8 suma; |
suma = kanal+data; |
odeslat_nibble(0,0b1111); // Synchronizace |
odeslat_nibble(1,kanal); // Identifikace osy |
odeslat_nibble(1,data); // Hodnota osy |
odeslat_nibble(1,suma); // Kontrolni soucet |
delay_ms(10); // cas pro prijimac aby mohl zpracovat data |
// mozno nahradit vysilanim jednicek |
} |
int stredX, stredY, x, y; |
void kalibrace() |
{ |
int8 min_x; |
int8 max_x; |
int8 min_y; |
int8 max_y; |
int8 sred_x; |
int8 sred_y; |
int8 adc; |
min_x=max_x=min_y=max_y=sred_x=sred_y=128; |
printf(lcd_putc,"Paku dejte do prostred a stisknete tlacitko"); |
znovu: |
if (TTL1 || TTL2) |
{ |
set_adc_channel(AD_OSA_X); |
delay_us(10); |
sred_x=read_adc(); |
set_adc_channel(AD_OSA_Y); |
delay_us(10); |
sred_y=read_adc(); |
}; |
//else goto znovu; |
printf(lcd_putc,"\f"); |
printf(lcd_putc,"Pak "); |
set_adc_channel(AD_OSA_X); |
delay_us(10); |
adc=read_adc(); |
if (max_x < adc )max_x=adc; |
if (min_x > adc )min_x=adc; |
set_adc_channel(AD_OSA_Y); |
delay_us(10); |
adc=read_adc(); |
if (max_y < adc )max_y=adc; |
if (min_y > adc )min_y=adc; |
if (TTL1 || TTL2) return; |
} |
void main() |
{ |
setup_adc_ports(RA0_RA1_RA3_ANALOG); |
setup_adc(ADC_CLOCK_DIV_2); |
setup_spi(FALSE); |
setup_counters(RTCC_INTERNAL,RTCC_DIV_2); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DISABLED,0,1); |
lcd_init(); |
printf(lcd_putc,"\fAhoj!"); |
delay_ms(300); |
while(true) |
{ |
set_adc_channel(AD_OSA_X); |
lcd_gotoxy(1,1); |
x=read_adc() >> 4; |
printf(lcd_putc,"X: %D ", x); |
set_adc_channel(AD_OSA_Y); |
lcd_gotoxy(1,2); |
y=read_adc() >> 4; |
printf(lcd_putc,"Y: %D ", y); |
odeslat_paket(OSA_X,x); |
odeslat_paket(OSA_Y,y); |
} |
} |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/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/vysilac/zaloha/03/MAIN.ERR |
---|
0,0 → 1,0 |
No Errors |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/MAIN.H |
---|
0,0 → 1,4 |
#include <16F873.h> |
#use delay(clock=4000000) |
#fuses XT,PUT,NOWDT |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/MAIN.HEX |
---|
0,0 → 1,74 |
:1000000000308A00842900000A108A100A11820731 |
:1000100028340C34013406340A108A100A1182077D |
:100020000C34413468346F346A3421340034303055 |
:100030008400000803192B280130A100A001A00BA7 |
:100040001F28A10B1E284A30A000A00B2528000065 |
:100050000000800B1C28003406080F39B400330E52 |
:10006000A000F030A0052008F03934048600061501 |
:1000700083160611000083120611831606118312DF |
:100080000034B108031D46288610472886148316BD |
:1000900086108312B20E3208B3002C20B20E320842 |
:1000A000B3002C200D30A000A00B542800341430D5 |
:1000B000B00017200F308316860583128610831632 |
:1000C000861083120611831606118312AA012A08CC |
:1000D000023C031C73280230B00017200330B30029 |
:1000E0002C20AA0A67280D30A000A00B752802302A |
:1000F000B3002C200D30A000A00B7C28AA012A08F8 |
:10010000023C031C8F282A080420AB00B1012B08F5 |
:10011000B20041200230B0001720AA0A7F288A11BD |
:10012000C52901302D02AF002E08023C031D9A287C |
:100130004030AF072F088038B000B1013008B2005E |
:10014000412000342C08A0000C3020020319B528EF |
:100150000A3020020319BD280D3020020319C328DC |
:10016000083020020319C828CD28B1010130B2009F |
:1001700041200230B0001720D9280130AD000230F4 |
:10018000AE009120D9280130AD00AE009120D928D1 |
:10019000B1011030B2004120D9282C081F3C031CAB |
:1001A000D3280730AC050130B1002C08B200412043 |
:1001B000D92800342D08A1012C020318E2282C08AC |
:1001C000A000EE28A0010830AE00AC0DA00D2D0857 |
:1001D00020020318A000A10DAE0BE52800342A0868 |
:1001E000A000AA1BF7282B1D01292030FC28A009FC |
:1001F000A00A2008AA002D30A100AC00A2202B1DCF |
:10020000AB152A08AC006430AD00DA202008AA0043 |
:1002100021083030031D13292B18AB15AB191929F0 |
:100220002B1A20301529AB112B12A1072108AC0085 |
:10023000A2202A08AC000A30AD00DA202008AA006B |
:1002400021083030031D2829AB192C292B1A203006 |
:10025000A1072108AC00A2203030AA072A08AC0070 |
:10026000A220003430183629871137298715A511A7 |
:1002700025088316870053308312A000A00B3E2967 |
:10028000301C4429871145298715A5112508831697 |
:10029000870053308312A000A00B4C290034033098 |
:1002A000B00017200130B00032212D08B0003221FB |
:1002B0000530AF00AF03031963292E08B0003221C7 |
:1002C0000310AE0C5A29A511250883168700831246 |
:1002D000871100342B082A07AC00AD010F30AE00A7 |
:1002E0004F210130AD002A08AE004F210130AD0092 |
:1002F0002B08AE004F210130AD002C08AE004F217D |
:100300000A30B0001720003484011F308305073005 |
:1003100083169F00FF308312A500043083169F00D0 |
:1003200083121F08383901389F009412A51225083E |
:1003300083168700831225162508831687008312EB |
:10034000A5112508831687000030831294008316B8 |
:1003500094008312A001A01DB529073081018130CE |
:1003600084000008C0390F388000640081308400A8 |
:100370000008C0392004800090010030A1009200E4 |
:1003800000308316920083125728AA012A080C20F5 |
:10039000AA0AAC00A22006302A02031DC629023098 |
:1003A000AA009630B0001720AA0BD1290030A10076 |
:1003B0001F08C73921049F000130AD00AE00912015 |
:1003C0001F151F19E1291E081E0EA8000F30A805D1 |
:1003D0005830AC00A2203A30AC00A2202030AC0053 |
:1003E000A2202808AA001830AB00EF200630AA008F |
:1003F0002030AC00A220AA0BF8290830A1001F0869 |
:10040000C73921049F000130AD000230AE009120B9 |
:100410001F151F19092A1E081E0EA9000F30A90555 |
:100420005930AC00A2203A30AC00A2202030AC0001 |
:10043000A2202908AA001830AB00EF200630AA003D |
:100440002030AC00A220AA0B202A0130AA002808E4 |
:10045000AB006A210230AA002908AB006A21D62924 |
:02046000630037 |
:02400E00F13F80 |
:00000001FF |
;PIC16F873 |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/MAIN.LST |
---|
0,0 → 1,993 |
CCS PCW C Compiler, Version 3.110, 15448 |
Filename: d:\@kaklik\programy\pic_c\prenos\letadlo\vysilac\main.LST |
ROM used: 561 (14%) |
Largest free fragment is 2048 |
RAM used: 11 (6%) at main() level |
22 (11%) worst case |
Stack: 5 locations |
* |
0000: MOVLW 00 |
0001: MOVWF 0A |
0002: GOTO 184 |
0003: NOP |
.................... // Vysilac |
.................... |
.................... #include "main.h" |
.................... #include <16F873.h> |
.................... //////// Standard Header file for the PIC16F873 device //////////////// |
.................... #device PIC16F873 |
.................... #list |
.................... |
.................... #use delay(clock=4000000) |
* |
0017: MOVLW 30 |
0018: MOVWF 04 |
0019: MOVF 00,W |
001A: BTFSC 03.2 |
001B: GOTO 02B |
001C: MOVLW 01 |
001D: MOVWF 21 |
001E: CLRF 20 |
001F: DECFSZ 20,F |
0020: GOTO 01F |
0021: DECFSZ 21,F |
0022: GOTO 01E |
0023: MOVLW 4A |
0024: MOVWF 20 |
0025: DECFSZ 20,F |
0026: GOTO 025 |
0027: NOP |
0028: NOP |
0029: DECFSZ 00,F |
002A: GOTO 01C |
002B: RETLW 00 |
.................... #fuses XT,PUT,NOWDT |
.................... |
.................... |
.................... #include "..\common.h" |
.................... #DEFINE OSA_X 1 // adresy os |
.................... #DEFINE OSA_Y 2 |
.................... #DEFINE TLs 3 |
.................... #DEFINE IMPULS 250 // sirka impulsu |
.................... |
.................... |
.................... #DEFINE LCD_RS PIN_B1 // rizeni registru LCD displeje |
.................... #DEFINE LCD_E PIN_B2 // enable LCD displeje |
.................... #DEFINE LCD_DATA_LSB PIN_B4 // 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 |
* |
002C: MOVF 06,W |
002D: ANDLW 0F |
002E: MOVWF 34 |
002F: SWAPF 33,W |
0030: MOVWF 20 |
0031: MOVLW F0 |
0032: ANDWF 20,F |
0033: MOVF 20,W |
0034: ANDLW F0 |
0035: IORWF 34,W |
0036: MOVWF 06 |
.................... output_bit(LCD_E,1); // vzestupna hrana |
0037: BSF 06.2 |
0038: BSF 03.5 |
0039: BCF 06.2 |
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat |
003A: NOP |
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us) |
003B: BCF 03.5 |
003C: BCF 06.2 |
003D: BSF 03.5 |
003E: BCF 06.2 |
003F: BCF 03.5 |
0040: 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 |
0041: MOVF 31,F |
0042: BTFSS 03.2 |
0043: GOTO 046 |
0044: BCF 06.1 |
0045: GOTO 047 |
0046: BSF 06.1 |
0047: BSF 03.5 |
0048: BCF 06.1 |
.................... swap(n); |
0049: BCF 03.5 |
004A: SWAPF 32,F |
.................... lcd_send_nibble(n); // posli horni pulku bajtu |
004B: MOVF 32,W |
004C: MOVWF 33 |
004D: CALL 02C |
.................... swap(n); |
004E: SWAPF 32,F |
.................... lcd_send_nibble(n); // posli spodni pulku bajtu |
004F: MOVF 32,W |
0050: MOVWF 33 |
0051: CALL 02C |
.................... delay_us(40); // minimalni doba na provedeni prikazu |
0052: MOVLW 0D |
0053: MOVWF 20 |
0054: DECFSZ 20,F |
0055: GOTO 054 |
0056: 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 |
0057: MOVLW 14 |
0058: MOVWF 30 |
0059: CALL 017 |
.................... |
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD |
005A: MOVLW 0F |
005B: BSF 03.5 |
005C: ANDWF 06,F |
.................... |
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav |
005D: BCF 03.5 |
005E: BCF 06.1 |
005F: BSF 03.5 |
0060: BCF 06.1 |
.................... output_bit(LCD_E,0); // nastav jako vystup a nastav klidovy stav |
0061: BCF 03.5 |
0062: BCF 06.2 |
0063: BSF 03.5 |
0064: BCF 06.2 |
.................... |
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice |
0065: BCF 03.5 |
0066: CLRF 2A |
0067: MOVF 2A,W |
0068: SUBLW 02 |
0069: BTFSS 03.0 |
006A: GOTO 073 |
.................... { |
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel |
006B: MOVLW 02 |
006C: MOVWF 30 |
006D: CALL 017 |
.................... lcd_send_nibble(3); // rezim 8 bitu |
006E: MOVLW 03 |
006F: MOVWF 33 |
0070: CALL 02C |
.................... } |
0071: INCF 2A,F |
0072: GOTO 067 |
.................... |
.................... delay_us(40); // cas na zpracovani |
0073: MOVLW 0D |
0074: MOVWF 20 |
0075: DECFSZ 20,F |
0076: GOTO 075 |
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu) |
0077: MOVLW 02 |
0078: MOVWF 33 |
0079: CALL 02C |
.................... delay_us(40); // cas na zpracovani |
007A: MOVLW 0D |
007B: MOVWF 20 |
007C: DECFSZ 20,F |
007D: GOTO 07C |
.................... |
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod) |
007E: CLRF 2A |
007F: MOVF 2A,W |
0080: SUBLW 02 |
0081: BTFSS 03.0 |
0082: GOTO 08F |
.................... { |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
0083: MOVF 2A,W |
0084: CALL 004 |
0085: MOVWF 2B |
0086: CLRF 31 |
0087: MOVF 2B,W |
0088: MOVWF 32 |
0089: CALL 041 |
.................... delay_ms(2); |
008A: MOVLW 02 |
008B: MOVWF 30 |
008C: CALL 017 |
.................... } |
008D: INCF 2A,F |
008E: GOTO 07F |
008F: BCF 0A.3 |
0090: GOTO 1C5 (RETURN) |
.................... } |
.................... |
.................... |
.................... // Proved presun kurzoru |
.................... // |
.................... // Pozice 1.1 je domu |
.................... // |
.................... void lcd_gotoxy( BYTE x, BYTE y) |
.................... { |
.................... |
.................... BYTE Adr; |
.................... |
.................... Adr=x-1; |
0091: MOVLW 01 |
0092: SUBWF 2D,W |
0093: MOVWF 2F |
.................... if(y==2) |
0094: MOVF 2E,W |
0095: SUBLW 02 |
0096: BTFSS 03.2 |
0097: GOTO 09A |
.................... Adr+=LCD_LINE_2; |
0098: MOVLW 40 |
0099: ADDWF 2F,F |
.................... |
.................... lcd_send_byte(0,0x80|Adr); |
009A: MOVF 2F,W |
009B: IORLW 80 |
009C: MOVWF 30 |
009D: CLRF 31 |
009E: MOVF 30,W |
009F: MOVWF 32 |
00A0: CALL 041 |
00A1: RETLW 00 |
.................... } |
.................... |
.................... |
.................... // Zapis znaku na displej, zpracovani ridicich znaku |
.................... // |
.................... void lcd_putc( char c) |
.................... { |
.................... |
.................... switch (c) |
00A2: MOVF 2C,W |
00A3: MOVWF 20 |
00A4: MOVLW 0C |
00A5: SUBWF 20,W |
00A6: BTFSC 03.2 |
00A7: GOTO 0B5 |
00A8: MOVLW 0A |
00A9: SUBWF 20,W |
00AA: BTFSC 03.2 |
00AB: GOTO 0BD |
00AC: MOVLW 0D |
00AD: SUBWF 20,W |
00AE: BTFSC 03.2 |
00AF: GOTO 0C3 |
00B0: MOVLW 08 |
00B1: SUBWF 20,W |
00B2: BTFSC 03.2 |
00B3: GOTO 0C8 |
00B4: GOTO 0CD |
.................... { |
.................... case '\f' : lcd_send_byte(0,1); // smaz displej |
00B5: CLRF 31 |
00B6: MOVLW 01 |
00B7: MOVWF 32 |
00B8: CALL 041 |
.................... delay_ms(2); |
00B9: MOVLW 02 |
00BA: MOVWF 30 |
00BB: CALL 017 |
.................... break; |
00BC: GOTO 0D9 |
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky |
00BD: MOVLW 01 |
00BE: MOVWF 2D |
00BF: MOVLW 02 |
00C0: MOVWF 2E |
00C1: CALL 091 |
00C2: GOTO 0D9 |
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home |
00C3: MOVLW 01 |
00C4: MOVWF 2D |
00C5: MOVWF 2E |
00C6: CALL 091 |
00C7: GOTO 0D9 |
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet |
00C8: CLRF 31 |
00C9: MOVLW 10 |
00CA: MOVWF 32 |
00CB: CALL 041 |
00CC: GOTO 0D9 |
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F |
00CD: MOVF 2C,W |
00CE: SUBLW 1F |
00CF: BTFSS 03.0 |
00D0: GOTO 0D3 |
00D1: MOVLW 07 |
00D2: ANDWF 2C,F |
.................... lcd_send_byte(1,c); break; // zapis znak |
00D3: MOVLW 01 |
00D4: MOVWF 31 |
00D5: MOVF 2C,W |
00D6: MOVWF 32 |
00D7: CALL 041 |
00D8: GOTO 0D9 |
.................... } |
00D9: 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 VYSILAC PIN_C3 |
.................... #DEFINE AD_OSA_X 0 // adresa A/D prevodniku pro osu X |
.................... #DEFINE AD_OSA_Y 1 // adresa A/D prevodniku pro osu Y |
.................... #DEFINE TTL1 PIN_B4 |
.................... #DEFINE TTL2 PIN_B3 |
.................... |
.................... |
.................... // Odesle nulu nebo jednicku podle nejnizsiho bitu predanych dat |
.................... // Nula je posloupnost LH a jednicka je HL |
.................... // |
.................... void odeslat_bit(int8 data) |
.................... { |
.................... output_bit(VYSILAC,bit_test(data,0)); |
* |
0132: BTFSC 30.0 |
0133: GOTO 136 |
0134: BCF 07.3 |
0135: GOTO 137 |
0136: BSF 07.3 |
0137: BCF 25.3 |
0138: MOVF 25,W |
0139: BSF 03.5 |
013A: MOVWF 07 |
.................... delay_us(IMPULS); |
013B: MOVLW 53 |
013C: BCF 03.5 |
013D: MOVWF 20 |
013E: DECFSZ 20,F |
013F: GOTO 13E |
.................... output_bit(VYSILAC,!bit_test(data,0)); |
0140: BTFSS 30.0 |
0141: GOTO 144 |
0142: BCF 07.3 |
0143: GOTO 145 |
0144: BSF 07.3 |
0145: BCF 25.3 |
0146: MOVF 25,W |
0147: BSF 03.5 |
0148: MOVWF 07 |
.................... delay_us(IMPULS); |
0149: MOVLW 53 |
014A: BCF 03.5 |
014B: MOVWF 20 |
014C: DECFSZ 20,F |
014D: GOTO 14C |
014E: RETLW 00 |
.................... } |
.................... |
.................... |
.................... // Odelse ramec o 4 bitech |
.................... // Datovy ramec zacina 11, synchronizacni ramec zacina 10 |
.................... // |
.................... void odeslat_nibble(int1 datovy, int8 data) |
.................... { |
.................... int i; |
.................... |
.................... delay_ms(3); // klidovy stav na lince |
014F: MOVLW 03 |
0150: MOVWF 30 |
0151: CALL 017 |
.................... |
.................... odeslat_bit(1); // start bit |
0152: MOVLW 01 |
0153: MOVWF 30 |
0154: CALL 132 |
.................... odeslat_bit(datovy); |
0155: MOVF 2D,W |
0156: MOVWF 30 |
0157: CALL 132 |
.................... |
.................... for (i=5; --i!=0; ) // datove bity |
0158: MOVLW 05 |
0159: MOVWF 2F |
015A: DECF 2F,F |
015B: BTFSC 03.2 |
015C: GOTO 163 |
.................... { |
.................... odeslat_bit(data); |
015D: MOVF 2E,W |
015E: MOVWF 30 |
015F: CALL 132 |
.................... data>>=1; |
0160: BCF 03.0 |
0161: RRF 2E,F |
.................... } |
0162: GOTO 15A |
.................... |
.................... output_low(VYSILAC); // klidovy stav |
0163: BCF 25.3 |
0164: MOVF 25,W |
0165: BSF 03.5 |
0166: MOVWF 07 |
0167: BCF 03.5 |
0168: BCF 07.3 |
0169: RETLW 00 |
.................... } |
.................... |
.................... |
.................... void odeslat_paket(int8 kanal, data) |
.................... { |
.................... int8 suma; |
.................... |
.................... suma = kanal+data; |
016A: MOVF 2B,W |
016B: ADDWF 2A,W |
016C: MOVWF 2C |
.................... odeslat_nibble(0,0b1111); // Synchronizace |
016D: CLRF 2D |
016E: MOVLW 0F |
016F: MOVWF 2E |
0170: CALL 14F |
.................... odeslat_nibble(1,kanal); // Identifikace osy |
0171: MOVLW 01 |
0172: MOVWF 2D |
0173: MOVF 2A,W |
0174: MOVWF 2E |
0175: CALL 14F |
.................... odeslat_nibble(1,data); // Hodnota osy |
0176: MOVLW 01 |
0177: MOVWF 2D |
0178: MOVF 2B,W |
0179: MOVWF 2E |
017A: CALL 14F |
.................... odeslat_nibble(1,suma); // Kontrolni soucet |
017B: MOVLW 01 |
017C: MOVWF 2D |
017D: MOVF 2C,W |
017E: MOVWF 2E |
017F: CALL 14F |
.................... |
.................... delay_ms(10); // cas pro prijimac aby mohl zpracovat data |
0180: MOVLW 0A |
0181: MOVWF 30 |
0182: CALL 017 |
0183: RETLW 00 |
.................... // mozno nahradit vysilanim jednicek |
.................... } |
.................... |
.................... |
.................... int stredX, stredY, x, y; |
.................... |
.................... void kalibrace() |
.................... { |
.................... int8 min_x; |
.................... int8 max_x; |
.................... int8 min_y; |
.................... int8 max_y; |
.................... int8 sred_x; |
.................... int8 sred_y; |
.................... int8 adc; |
.................... min_x=max_x=min_y=max_y=sred_x=sred_y=128; |
.................... |
.................... printf(lcd_putc,"Paku dejte do prostred a stisknete tlacitko"); |
.................... znovu: |
.................... if (TTL1 || TTL2) |
.................... { |
.................... set_adc_channel(AD_OSA_X); |
.................... delay_us(10); |
.................... sred_x=read_adc(); |
.................... set_adc_channel(AD_OSA_Y); |
.................... delay_us(10); |
.................... sred_y=read_adc(); |
.................... }; |
.................... |
.................... //else goto znovu; |
.................... |
.................... printf(lcd_putc,"\f"); |
.................... printf(lcd_putc,"Pak "); |
.................... |
.................... set_adc_channel(AD_OSA_X); |
.................... delay_us(10); |
.................... |
.................... adc=read_adc(); |
.................... |
.................... if (max_x < adc )max_x=adc; |
.................... if (min_x > adc )min_x=adc; |
.................... |
.................... set_adc_channel(AD_OSA_Y); |
.................... delay_us(10); |
.................... |
.................... adc=read_adc(); |
.................... |
.................... if (max_y < adc )max_y=adc; |
.................... if (min_y > adc )min_y=adc; |
.................... |
.................... if (TTL1 || TTL2) return; |
.................... } |
.................... |
.................... |
.................... void main() |
.................... { |
0184: CLRF 04 |
0185: MOVLW 1F |
0186: ANDWF 03,F |
0187: MOVLW 07 |
0188: BSF 03.5 |
0189: MOVWF 1F |
018A: MOVLW FF |
018B: BCF 03.5 |
018C: MOVWF 25 |
.................... |
.................... setup_adc_ports(RA0_RA1_RA3_ANALOG); |
018D: MOVLW 04 |
018E: BSF 03.5 |
018F: MOVWF 1F |
.................... setup_adc(ADC_CLOCK_DIV_2); |
0190: BCF 03.5 |
0191: MOVF 1F,W |
0192: ANDLW 38 |
0193: IORLW 01 |
0194: MOVWF 1F |
.................... setup_spi(FALSE); |
0195: BCF 14.5 |
0196: BCF 25.5 |
0197: MOVF 25,W |
0198: BSF 03.5 |
0199: MOVWF 07 |
019A: BCF 03.5 |
019B: BSF 25.4 |
019C: MOVF 25,W |
019D: BSF 03.5 |
019E: MOVWF 07 |
019F: BCF 03.5 |
01A0: BCF 25.3 |
01A1: MOVF 25,W |
01A2: BSF 03.5 |
01A3: MOVWF 07 |
01A4: MOVLW 00 |
01A5: BCF 03.5 |
01A6: MOVWF 14 |
01A7: BSF 03.5 |
01A8: MOVWF 14 |
.................... setup_counters(RTCC_INTERNAL,RTCC_DIV_2); |
01A9: BCF 03.5 |
01AA: CLRF 20 |
01AB: BTFSS 20.3 |
01AC: GOTO 1B5 |
01AD: MOVLW 07 |
01AE: CLRF 01 |
01AF: MOVLW 81 |
01B0: MOVWF 04 |
01B1: MOVF 00,W |
01B2: ANDLW C0 |
01B3: IORLW 0F |
01B4: MOVWF 00 |
01B5: CLRWDT |
01B6: MOVLW 81 |
01B7: MOVWF 04 |
01B8: MOVF 00,W |
01B9: ANDLW C0 |
01BA: IORWF 20,W |
01BB: MOVWF 00 |
.................... setup_timer_1(T1_DISABLED); |
01BC: CLRF 10 |
.................... setup_timer_2(T2_DISABLED,0,1); |
01BD: MOVLW 00 |
01BE: MOVWF 21 |
01BF: MOVWF 12 |
01C0: MOVLW 00 |
01C1: BSF 03.5 |
01C2: MOVWF 12 |
.................... |
.................... lcd_init(); |
01C3: BCF 03.5 |
01C4: GOTO 057 |
.................... printf(lcd_putc,"\fAhoj!"); |
* |
000C: BCF 0A.0 |
000D: BCF 0A.1 |
000E: BCF 0A.2 |
000F: ADDWF 02,F |
0010: RETLW 0C |
0011: RETLW 41 |
0012: RETLW 68 |
0013: RETLW 6F |
0014: RETLW 6A |
0015: RETLW 21 |
0016: RETLW 00 |
* |
01C5: CLRF 2A |
01C6: MOVF 2A,W |
01C7: CALL 00C |
01C8: INCF 2A,F |
01C9: MOVWF 2C |
01CA: CALL 0A2 |
01CB: MOVLW 06 |
01CC: SUBWF 2A,W |
01CD: BTFSS 03.2 |
01CE: GOTO 1C6 |
.................... delay_ms(300); |
01CF: MOVLW 02 |
01D0: MOVWF 2A |
01D1: MOVLW 96 |
01D2: MOVWF 30 |
01D3: CALL 017 |
01D4: DECFSZ 2A,F |
01D5: GOTO 1D1 |
.................... |
.................... while(true) |
.................... { |
.................... set_adc_channel(AD_OSA_X); |
01D6: MOVLW 00 |
01D7: MOVWF 21 |
01D8: MOVF 1F,W |
01D9: ANDLW C7 |
01DA: IORWF 21,W |
01DB: MOVWF 1F |
.................... lcd_gotoxy(1,1); |
01DC: MOVLW 01 |
01DD: MOVWF 2D |
01DE: MOVWF 2E |
01DF: CALL 091 |
.................... x=read_adc() >> 4; |
01E0: BSF 1F.2 |
01E1: BTFSC 1F.2 |
01E2: GOTO 1E1 |
01E3: MOVF 1E,W |
01E4: SWAPF 1E,W |
01E5: MOVWF 28 |
01E6: MOVLW 0F |
01E7: ANDWF 28,F |
.................... printf(lcd_putc,"X: %D ", x); |
* |
00EF: MOVF 2A,W |
00F0: MOVWF 20 |
00F1: BTFSC 2A.7 |
00F2: GOTO 0F7 |
00F3: BTFSS 2B.2 |
00F4: GOTO 101 |
00F5: MOVLW 20 |
00F6: GOTO 0FC |
00F7: COMF 20,F |
00F8: INCF 20,F |
00F9: MOVF 20,W |
00FA: MOVWF 2A |
00FB: MOVLW 2D |
00FC: MOVWF 21 |
00FD: MOVWF 2C |
00FE: CALL 0A2 |
00FF: BTFSS 2B.2 |
0100: BSF 2B.3 |
0101: MOVF 2A,W |
0102: MOVWF 2C |
0103: MOVLW 64 |
0104: MOVWF 2D |
0105: CALL 0DA |
0106: MOVF 20,W |
0107: MOVWF 2A |
0108: MOVF 21,W |
0109: MOVLW 30 |
010A: BTFSS 03.2 |
010B: GOTO 113 |
010C: BTFSC 2B.0 |
010D: BSF 2B.3 |
010E: BTFSC 2B.3 |
010F: GOTO 119 |
0110: BTFSC 2B.4 |
0111: MOVLW 20 |
0112: GOTO 115 |
0113: BCF 2B.3 |
0114: BCF 2B.4 |
0115: ADDWF 21,F |
0116: MOVF 21,W |
0117: MOVWF 2C |
0118: CALL 0A2 |
0119: MOVF 2A,W |
011A: MOVWF 2C |
011B: MOVLW 0A |
011C: MOVWF 2D |
011D: CALL 0DA |
011E: MOVF 20,W |
011F: MOVWF 2A |
0120: MOVF 21,W |
0121: MOVLW 30 |
0122: BTFSS 03.2 |
0123: GOTO 128 |
0124: BTFSC 2B.3 |
0125: GOTO 12C |
0126: BTFSC 2B.4 |
0127: MOVLW 20 |
0128: ADDWF 21,F |
0129: MOVF 21,W |
012A: MOVWF 2C |
012B: CALL 0A2 |
012C: MOVLW 30 |
012D: ADDWF 2A,F |
012E: MOVF 2A,W |
012F: MOVWF 2C |
0130: CALL 0A2 |
0131: RETLW 00 |
* |
01E8: MOVLW 58 |
01E9: MOVWF 2C |
01EA: CALL 0A2 |
01EB: MOVLW 3A |
01EC: MOVWF 2C |
01ED: CALL 0A2 |
01EE: MOVLW 20 |
01EF: MOVWF 2C |
01F0: CALL 0A2 |
01F1: MOVF 28,W |
01F2: MOVWF 2A |
01F3: MOVLW 18 |
01F4: MOVWF 2B |
01F5: CALL 0EF |
01F6: MOVLW 06 |
01F7: MOVWF 2A |
01F8: MOVLW 20 |
01F9: MOVWF 2C |
01FA: CALL 0A2 |
01FB: DECFSZ 2A,F |
01FC: GOTO 1F8 |
.................... set_adc_channel(AD_OSA_Y); |
01FD: MOVLW 08 |
01FE: MOVWF 21 |
01FF: MOVF 1F,W |
0200: ANDLW C7 |
0201: IORWF 21,W |
0202: MOVWF 1F |
.................... lcd_gotoxy(1,2); |
0203: MOVLW 01 |
0204: MOVWF 2D |
0205: MOVLW 02 |
0206: MOVWF 2E |
0207: CALL 091 |
.................... y=read_adc() >> 4; |
0208: BSF 1F.2 |
0209: BTFSC 1F.2 |
020A: GOTO 209 |
020B: MOVF 1E,W |
020C: SWAPF 1E,W |
020D: MOVWF 29 |
020E: MOVLW 0F |
020F: ANDWF 29,F |
.................... printf(lcd_putc,"Y: %D ", y); |
0210: MOVLW 59 |
0211: MOVWF 2C |
0212: CALL 0A2 |
0213: MOVLW 3A |
0214: MOVWF 2C |
0215: CALL 0A2 |
0216: MOVLW 20 |
0217: MOVWF 2C |
0218: CALL 0A2 |
0219: MOVF 29,W |
021A: MOVWF 2A |
021B: MOVLW 18 |
021C: MOVWF 2B |
021D: CALL 0EF |
021E: MOVLW 06 |
021F: MOVWF 2A |
0220: MOVLW 20 |
0221: MOVWF 2C |
0222: CALL 0A2 |
0223: DECFSZ 2A,F |
0224: GOTO 220 |
.................... |
.................... odeslat_paket(OSA_X,x); |
0225: MOVLW 01 |
0226: MOVWF 2A |
0227: MOVF 28,W |
0228: MOVWF 2B |
0229: CALL 16A |
.................... odeslat_paket(OSA_Y,y); |
022A: MOVLW 02 |
022B: MOVWF 2A |
022C: MOVF 29,W |
022D: MOVWF 2B |
022E: CALL 16A |
.................... |
.................... } |
022F: GOTO 1D6 |
.................... |
.................... } |
.................... |
0230: SLEEP |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/MAIN.PJT |
---|
0,0 → 1,32 |
[PROJECT] |
Target=main.HEX |
Development_Mode= |
Processor=0x873F |
ToolSuite=CCS |
[Directories] |
Include=E:\@Dokumenty\pic\lcd; |
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/vysilac/zaloha/03/MAIN.STA |
---|
0,0 → 1,43 |
ROM used: 561 (14%) |
2048 (50%) including unused fragments |
1 Average locations per line |
5 Average locations per statement |
RAM used: 11 (6%) at main() level |
22 (11%) worst case |
Lines Stmts % Files |
----- ----- --- ----- |
148 69 60 d:\@kaklik\programy\pic_c\prenos\letadlo\vysilac\main.c |
5 0 0 d:\@kaklik\programy\pic_c\prenos\letadlo\vysilac\main.h |
225 0 0 C:\PROGRAM FILES\PICC\devices\16F873.h |
5 0 0 d:\@kaklik\programy\pic_c\prenos\letadlo\common.h |
272 46 25 d:\@kaklik\programy\pic_c\prenos\letadlo\vysilac\MYLCD.C |
----- ----- |
1310 230 Total |
Page ROM % RAM Functions: |
---- --- --- --- ---------- |
0 21 4 1 delay_ms |
0 8 1 0 @const28 |
0 21 4 3 lcd_send_nibble |
0 22 4 2 lcd_send_byte |
0 58 10 2 lcd_init |
0 17 3 4 lcd_gotoxy |
0 56 10 1 lcd_putc |
0 29 5 1 odeslat_bit |
0 27 5 3 odeslat_nibble |
0 26 5 3 odeslat_paket |
0 173 31 1 main |
0 11 2 0 @const10148 |
0 21 4 3 @DIV88 |
0 67 12 2 @PRINTF_D_253 |
Segment Used Free |
--------- ---- ---- |
0000-0003 4 0 |
0004-07FF 557 1487 |
0800-0FFF 0 2048 |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/MAIN.SYM |
---|
0,0 → 1,77 |
015-016 CCP_1 |
015 CCP_1_LOW |
016 CCP_1_HIGH |
01B-01C CCP_2 |
01B CCP_2_LOW |
01C CCP_2_HIGH |
020 @SCRATCH |
021 @SCRATCH |
021 _RETURN_ |
022 @SCRATCH |
023 @SCRATCH |
024 @SCRATCH |
025 @TRIS_C |
026 stredX |
027 stredY |
028 x |
029 y |
02A lcd_init.i |
02A odeslat_paket.kanal |
02A @PRINTF_D_253.P1 |
02A main.@SCRATCH |
02B odeslat_paket.Data |
02B @PRINTF_D_253.P1 |
02B lcd_init.@SCRATCH |
02C lcd_putc.c |
02C odeslat_paket.suma |
02C @DIV88.P1 |
02D lcd_gotoxy.x |
02D odeslat_nibble.datovy |
02D @DIV88.P1 |
02E lcd_gotoxy.y |
02E odeslat_nibble.Data |
02E @DIV88.@SCRATCH |
02F lcd_gotoxy.Adr |
02F odeslat_nibble.i |
030 delay_ms.P1 |
030 odeslat_bit.Data |
030 lcd_gotoxy.@SCRATCH |
031 lcd_send_byte.Adr |
032 lcd_send_byte.n |
033 lcd_send_nibble.n |
034 lcd_send_nibble.@SCRATCH |
035 lcd_send_nibble.@SCRATCH |
delay_us.P1 |
-002 LCD_INIT_STRING |
lcd_putc2.Data |
kalibrace.min_x |
kalibrace.max_x |
kalibrace.min_y |
kalibrace.max_y |
kalibrace.sred_x |
kalibrace.sred_y |
kalibrace.adc |
0017 delay_ms |
0004 @const28 |
002C lcd_send_nibble |
0041 lcd_send_byte |
0057 lcd_init |
0091 lcd_gotoxy |
00A2 lcd_putc |
0132 odeslat_bit |
014F odeslat_nibble |
016A odeslat_paket |
0184 main |
000C @const10148 |
01A7 @const10156 |
00DA @DIV88 |
00EF @PRINTF_D_253 |
0135 znovu |
Project Files: |
d:\@kaklik\programy\pic_c\prenos\letadlo\vysilac\main.c |
d:\@kaklik\programy\pic_c\prenos\letadlo\vysilac\main.h |
C:\PROGRAM FILES\PICC\devices\16F873.h |
d:\@kaklik\programy\pic_c\prenos\letadlo\common.h |
d:\@kaklik\programy\pic_c\prenos\letadlo\vysilac\MYLCD.C |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/MAIN.TRE |
---|
0,0 → 1,396 |
ÀÄmain |
ÀÄmain 0/173 Ram=1 |
ÃÄ??0?? |
ÃÄlcd_init 0/58 Ram=2 |
³ ÃÄdelay_ms 0/21 Ram=1 |
³ ÃÄdelay_ms 0/21 Ram=1 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄ@const28 0/8 Ram=0 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄdelay_ms 0/21 Ram=1 |
ÃÄ@const10148 0/11 Ram=0 |
ÃÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄ@PRINTF_D_253 0/67 Ram=2 |
³ ÃÄlcd_putc 0/56 Ram=1 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄ@DIV88 0/21 Ram=3 |
³ ÃÄlcd_putc 0/56 Ram=1 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄ@DIV88 0/21 Ram=3 |
³ ÃÄlcd_putc 0/56 Ram=1 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄ@PRINTF_D_253 0/67 Ram=2 |
³ ÃÄlcd_putc 0/56 Ram=1 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄ@DIV88 0/21 Ram=3 |
³ ÃÄlcd_putc 0/56 Ram=1 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄ@DIV88 0/21 Ram=3 |
³ ÃÄlcd_putc 0/56 Ram=1 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄlcd_putc 0/56 Ram=1 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 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/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_gotoxy 0/17 Ram=4 |
³ ³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÃÄlcd_send_byte 0/22 Ram=2 |
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_byte 0/22 Ram=2 |
³ ÃÄlcd_send_nibble 0/21 Ram=3 |
³ ÀÄlcd_send_nibble 0/21 Ram=3 |
ÃÄodeslat_paket 0/26 Ram=3 |
³ ÃÄodeslat_nibble 0/27 Ram=3 |
³ ³ ÃÄdelay_ms 0/21 Ram=1 |
³ ³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ³ ÀÄodeslat_bit 0/29 Ram=1 |
³ ÃÄodeslat_nibble 0/27 Ram=3 |
³ ³ ÃÄdelay_ms 0/21 Ram=1 |
³ ³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ³ ÀÄodeslat_bit 0/29 Ram=1 |
³ ÃÄodeslat_nibble 0/27 Ram=3 |
³ ³ ÃÄdelay_ms 0/21 Ram=1 |
³ ³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ³ ÀÄodeslat_bit 0/29 Ram=1 |
³ ÃÄodeslat_nibble 0/27 Ram=3 |
³ ³ ÃÄdelay_ms 0/21 Ram=1 |
³ ³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ³ ÀÄodeslat_bit 0/29 Ram=1 |
³ ÀÄdelay_ms 0/21 Ram=1 |
ÀÄodeslat_paket 0/26 Ram=3 |
ÃÄodeslat_nibble 0/27 Ram=3 |
³ ÃÄdelay_ms 0/21 Ram=1 |
³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ÀÄodeslat_bit 0/29 Ram=1 |
ÃÄodeslat_nibble 0/27 Ram=3 |
³ ÃÄdelay_ms 0/21 Ram=1 |
³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ÀÄodeslat_bit 0/29 Ram=1 |
ÃÄodeslat_nibble 0/27 Ram=3 |
³ ÃÄdelay_ms 0/21 Ram=1 |
³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ÀÄodeslat_bit 0/29 Ram=1 |
ÃÄodeslat_nibble 0/27 Ram=3 |
³ ÃÄdelay_ms 0/21 Ram=1 |
³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ÃÄodeslat_bit 0/29 Ram=1 |
³ ÀÄodeslat_bit 0/29 Ram=1 |
ÀÄdelay_ms 0/21 Ram=1 |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/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/vysilac/zaloha/03/PRG.BAT |
---|
0,0 → 1,8 |
:start |
call picpgr stop |
call picpgr erase pic16f873 |
call picpgr program main.hex hex pic16f873 |
call picpgr run |
pause |
call picpgr stop |
rem goto start |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/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/vysilac/zaloha/03/RUN.BAT |
---|
0,0 → 1,5 |
call picpgr run |
pause |
call picpgr stop |
pause |
run.bat |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/VC.MNU |
---|
0,0 → 1,4 |
R: Run |
picpgr run |
S: Stop |
picpgr stop |
/schemata/prenos/letadlo/SW/vysilac/zaloha/03/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 |