/schemata/prenos/letadlo/SW/vysilac/zaloha/01/!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/01/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/01/MAIN.BAK |
---|
0,0 → 1,167 |
#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 |
int stredX, stredY, x, y; |
void odeslat_nibble (int8 kodeslani) |
{ |
int i; |
for (i=0;i<=3;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 odesli (int8 neco,adresa) |
{ |
odeslat_nibble(0b1111); // Synchronizace |
odeslat_nibble(adresa); // Identifikace osy |
odeslat_nibble(neco); // Hodnota osy |
odeslat_nibble(neco); // Zopakovana hodnota osy pro kontrolu |
} |
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() |
{ |
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(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); |
/* 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); |
odesli(x,OSA_X); |
delay_ms(100); |
odesli(y,OSA_Y); |
output_low(PIN_C6); |
} |
} |
/schemata/prenos/letadlo/SW/vysilac/zaloha/01/MAIN.C |
---|
0,0 → 1,165 |
#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 |
int stredX, stredY, x, y; |
void odeslat_nibble (int8 kodeslani) |
{ |
int i; |
for (i=0;i<=3;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 odesli (int8 neco,adresa) |
{ |
odeslat_nibble(0b1111); // Synchronizace |
odeslat_nibble(adresa); // Identifikace osy |
odeslat_nibble(neco); // Hodnota osy |
odeslat_nibble(neco); // Zopakovana hodnota osy pro kontrolu |
} |
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() |
{ |
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"); |
lcd_gotoxy(7,2); |
printf(lcd_putc,"vysilam"); |
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); |
/* output_high(PIN_C1); |
output_low(PIN_C2); |
delay_ms(100); |
output_low(PIN_C1); |
output_high(PIN_C2); |
delay_ms(100);*/ |
output_high(PIN_C4); |
output_high(PIN_C6); |
delay_ms(1); |
output_low(PIN_C4); |
odesli(x,OSA_X); |
delay_ms(10); |
odesli(y,OSA_Y); |
output_low(PIN_C6); |
} |
} |
/schemata/prenos/letadlo/SW/vysilac/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/vysilac/zaloha/01/MAIN.ERR |
---|
0,0 → 1,0 |
No Errors |
/schemata/prenos/letadlo/SW/vysilac/zaloha/01/MAIN.H |
---|
0,0 → 1,4 |
#include <16F873.h> |
#use delay(clock=4000000) |
#fuses XT,PUT,NOWDT |
/schemata/prenos/letadlo/SW/vysilac/zaloha/01/MAIN.HEX |
---|
0,0 → 1,80 |
:1000000000308A00992900000A108A100A1182071C |
:1000100028340C34013406340A108A100A1182077D |
:1000200076347934733469346C3461346D3400342B |
:100030002E308400000803192C280130A100A001F3 |
:10004000A00B2028A10B1F284A30A000A00B2628B7 |
:1000500000000000800B1D28003406080F39B50091 |
:10006000340EA000F030A0052008F03935048600D9 |
:100070000615831606110000831206118316061159 |
:1000800083120034B208031D4728861048288614BE |
:10009000831686108312B30E3308B4002D20B30EDE |
:1000A0003308B4002D200D30A000A00B55280034DB |
:1000B0001430AE0018200F30831686058312861088 |
:1000C0008316861083120611831606118312AB0164 |
:1000D0002B08023C031C74280230AE0018200330A9 |
:1000E000B4002D20AB0A68280D30A000A00B7628A4 |
:1000F0000230B4002D200D30A000A00B7D28AB01F4 |
:100100002B08023C031C90282B080420AC00B201F1 |
:100110002C08B30042200230AE001820AB0A802821 |
:100120008A11DB2901302E02B0002F08023C031D8A |
:100130009B284030B00730088038B100B201310848 |
:10014000B300422000342D08A0000C302002031917 |
:10015000B6280A3020020319BE280D3020020319E8 |
:10016000C428083020020319C928CE28B201013062 |
:10017000B30042200230AE001820DA280130AE0071 |
:100180000230AF009220DA280130AE00AF0092209A |
:10019000DA28B2011030B3004220DA282D081F3CC3 |
:1001A000031CD4280730AD050130B2002D08B30080 |
:1001B0004220DA2800342E08A1012D020318E3287A |
:1001C0002D08A000EF28A0010830AF00AD0DA00D54 |
:1001D0002E0820020318A000A10DAF0BE628003462 |
:1001E0002B08A000AB1BF8282C1D02292030FD286D |
:1001F000A009A00A2008AB002D30A100AD00A3206B |
:100200002C1DAC152B08AD006430AE00DB2020089F |
:10021000AB0021083030031D14292C18AC15AC1983 |
:100220001A292C1A20301629AC112C12A1072108EA |
:10023000AD00A3202B08AD000A30AE00DB20200863 |
:10024000AB0021083030031D2929AC192D292C1AA7 |
:100250002030A1072108AD00A3203030AB072B08C8 |
:10026000AD00A3200034AE012E08033C031C8B29F3 |
:100270002D08A0002E08A100031942290310A00C8C |
:10028000A10B3E29003020180130013C031D6029DC |
:10029000A91129088316870083128715A630A000AC |
:1002A000A00B50290000A91129088316870083128A |
:1002B0008711F930A000A00B5B29000000008929FC |
:1002C000A911290883168700831287155330A000CF |
:1002D000A00B6829A91129088316870083128711AA |
:1002E000A630A000A00B72290000A91129088316CE |
:1002F0008700831287155330A000A00B7D29A91118 |
:10030000290883168700831287115330A000A00BA1 |
:100310008729AE0A342900340F30AD0033212C0870 |
:10032000AD0033212B08AD0033212B08AD00332164 |
:10033000003484011F308305073083169F00FF308F |
:100340008312A900AA01043083169F0083121F089C |
:10035000383901389F009412A912290883168700A2 |
:10036000831229162908831687008312A9112908E8 |
:100370008316870000308312940083169400831242 |
:10038000A001A01DCB290730810181308400000825 |
:10039000C0390F3880006400813084000008C03903 |
:1003A0002004800090010030A100920000308316EC |
:1003B0009200831258280C30AD00A3200730AE0005 |
:1003C0000230AF009220AB012B080C20AB0AAD002D |
:1003D000A32007302B02031DE4290030A1001F08D1 |
:1003E000C73921049F000130AE00AF0092201F15D5 |
:1003F0001F19F8291E081E0EA7000F30A705583038 |
:10040000AD00A3203A30AD00A3202030AD00A320E2 |
:100410002708AB001830AC00F0200630AB002030CD |
:10042000AD00A320AB0B0F2A0830A1001F08C7396D |
:1004300021049F000130AE000230AF0092201F1552 |
:100440001F19202A1E081E0EA8000F30A8055930BB |
:10045000AD00A3203A30AD00A3202030AD00A32092 |
:100460002808AB001830AC00F0200630AB0020307C |
:10047000AD00A320AB0B372A291229088316870069 |
:10048000831207162913290883168700831207177A |
:100490000130AE0018202912290883168700831224 |
:1004A00007122708AB00AC018C210A30AE001820DF |
:1004B0002808AB000130AC008C21291329088316D1 |
:0A04C000870083120713ED29630083 |
:02400E00F13F80 |
:00000001FF |
;PIC16F873 |
/schemata/prenos/letadlo/SW/vysilac/zaloha/01/MAIN.LST |
---|
0,0 → 1,1066 |
CCS PCW C Compiler, Version 3.110, 15448 |
Filename: d:\@kaklik\programy\pic_c\prenos\letadlo\vysilac\main.LST |
ROM used: 613 (15%) |
Largest free fragment is 2048 |
RAM used: 12 (6%) at main() level |
23 (12%) worst case |
Stack: 5 locations |
* |
0000: MOVLW 00 |
0001: MOVWF 0A |
0002: GOTO 199 |
0003: NOP |
.................... #include "main.h" |
.................... #include <16F873.h> |
.................... //////// Standard Header file for the PIC16F873 device //////////////// |
.................... #device PIC16F873 |
.................... #list |
.................... |
.................... #use delay(clock=4000000) |
* |
0018: MOVLW 2E |
0019: MOVWF 04 |
001A: MOVF 00,W |
001B: BTFSC 03.2 |
001C: GOTO 02C |
001D: MOVLW 01 |
001E: MOVWF 21 |
001F: CLRF 20 |
0020: DECFSZ 20,F |
0021: GOTO 020 |
0022: DECFSZ 21,F |
0023: GOTO 01F |
0024: MOVLW 4A |
0025: MOVWF 20 |
0026: DECFSZ 20,F |
0027: GOTO 026 |
0028: NOP |
0029: NOP |
002A: DECFSZ 00,F |
002B: GOTO 01D |
002C: RETLW 00 |
.................... #fuses XT,PUT,NOWDT |
.................... |
.................... |
.................... #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_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 |
* |
002D: MOVF 06,W |
002E: ANDLW 0F |
002F: MOVWF 35 |
0030: SWAPF 34,W |
0031: MOVWF 20 |
0032: MOVLW F0 |
0033: ANDWF 20,F |
0034: MOVF 20,W |
0035: ANDLW F0 |
0036: IORWF 35,W |
0037: MOVWF 06 |
.................... output_bit(LCD_E,1); // vzestupna hrana |
0038: BSF 06.2 |
0039: BSF 03.5 |
003A: BCF 06.2 |
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat |
003B: NOP |
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us) |
003C: BCF 03.5 |
003D: BCF 06.2 |
003E: BSF 03.5 |
003F: BCF 06.2 |
0040: BCF 03.5 |
0041: 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 |
0042: MOVF 32,F |
0043: BTFSS 03.2 |
0044: GOTO 047 |
0045: BCF 06.1 |
0046: GOTO 048 |
0047: BSF 06.1 |
0048: BSF 03.5 |
0049: BCF 06.1 |
.................... swap(n); |
004A: BCF 03.5 |
004B: SWAPF 33,F |
.................... lcd_send_nibble(n); // posli horni pulku bajtu |
004C: MOVF 33,W |
004D: MOVWF 34 |
004E: CALL 02D |
.................... swap(n); |
004F: SWAPF 33,F |
.................... lcd_send_nibble(n); // posli spodni pulku bajtu |
0050: MOVF 33,W |
0051: MOVWF 34 |
0052: CALL 02D |
.................... delay_us(40); // minimalni doba na provedeni prikazu |
0053: MOVLW 0D |
0054: MOVWF 20 |
0055: DECFSZ 20,F |
0056: GOTO 055 |
0057: 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 |
0058: MOVLW 14 |
0059: MOVWF 2E |
005A: CALL 018 |
.................... |
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD |
005B: MOVLW 0F |
005C: BSF 03.5 |
005D: ANDWF 06,F |
.................... |
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav |
005E: BCF 03.5 |
005F: BCF 06.1 |
0060: BSF 03.5 |
0061: BCF 06.1 |
.................... output_bit(LCD_E,0); // nastav jako vystup a nastav klidovy stav |
0062: BCF 03.5 |
0063: BCF 06.2 |
0064: BSF 03.5 |
0065: BCF 06.2 |
.................... |
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice |
0066: BCF 03.5 |
0067: CLRF 2B |
0068: MOVF 2B,W |
0069: SUBLW 02 |
006A: BTFSS 03.0 |
006B: GOTO 074 |
.................... { |
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel |
006C: MOVLW 02 |
006D: MOVWF 2E |
006E: CALL 018 |
.................... lcd_send_nibble(3); // rezim 8 bitu |
006F: MOVLW 03 |
0070: MOVWF 34 |
0071: CALL 02D |
.................... } |
0072: INCF 2B,F |
0073: GOTO 068 |
.................... |
.................... delay_us(40); // cas na zpracovani |
0074: MOVLW 0D |
0075: MOVWF 20 |
0076: DECFSZ 20,F |
0077: GOTO 076 |
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu) |
0078: MOVLW 02 |
0079: MOVWF 34 |
007A: CALL 02D |
.................... delay_us(40); // cas na zpracovani |
007B: MOVLW 0D |
007C: MOVWF 20 |
007D: DECFSZ 20,F |
007E: GOTO 07D |
.................... |
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod) |
007F: CLRF 2B |
0080: MOVF 2B,W |
0081: SUBLW 02 |
0082: BTFSS 03.0 |
0083: GOTO 090 |
.................... { |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
0084: MOVF 2B,W |
0085: CALL 004 |
0086: MOVWF 2C |
0087: CLRF 32 |
0088: MOVF 2C,W |
0089: MOVWF 33 |
008A: CALL 042 |
.................... delay_ms(2); |
008B: MOVLW 02 |
008C: MOVWF 2E |
008D: CALL 018 |
.................... } |
008E: INCF 2B,F |
008F: GOTO 080 |
0090: BCF 0A.3 |
0091: GOTO 1DB (RETURN) |
.................... } |
.................... |
.................... |
.................... // Proved presun kurzoru |
.................... // |
.................... // Pozice 1.1 je domu |
.................... // |
.................... void lcd_gotoxy( BYTE x, BYTE y) |
.................... { |
.................... |
.................... BYTE Adr; |
.................... |
.................... Adr=x-1; |
0092: MOVLW 01 |
0093: SUBWF 2E,W |
0094: MOVWF 30 |
.................... if(y==2) |
0095: MOVF 2F,W |
0096: SUBLW 02 |
0097: BTFSS 03.2 |
0098: GOTO 09B |
.................... Adr+=LCD_LINE_2; |
0099: MOVLW 40 |
009A: ADDWF 30,F |
.................... |
.................... lcd_send_byte(0,0x80|Adr); |
009B: MOVF 30,W |
009C: IORLW 80 |
009D: MOVWF 31 |
009E: CLRF 32 |
009F: MOVF 31,W |
00A0: MOVWF 33 |
00A1: CALL 042 |
00A2: RETLW 00 |
.................... } |
.................... |
.................... |
.................... // Zapis znaku na displej, zpracovani ridicich znaku |
.................... // |
.................... void lcd_putc( char c) |
.................... { |
.................... |
.................... switch (c) |
00A3: MOVF 2D,W |
00A4: MOVWF 20 |
00A5: MOVLW 0C |
00A6: SUBWF 20,W |
00A7: BTFSC 03.2 |
00A8: GOTO 0B6 |
00A9: MOVLW 0A |
00AA: SUBWF 20,W |
00AB: BTFSC 03.2 |
00AC: GOTO 0BE |
00AD: MOVLW 0D |
00AE: SUBWF 20,W |
00AF: BTFSC 03.2 |
00B0: GOTO 0C4 |
00B1: MOVLW 08 |
00B2: SUBWF 20,W |
00B3: BTFSC 03.2 |
00B4: GOTO 0C9 |
00B5: GOTO 0CE |
.................... { |
.................... case '\f' : lcd_send_byte(0,1); // smaz displej |
00B6: CLRF 32 |
00B7: MOVLW 01 |
00B8: MOVWF 33 |
00B9: CALL 042 |
.................... delay_ms(2); |
00BA: MOVLW 02 |
00BB: MOVWF 2E |
00BC: CALL 018 |
.................... break; |
00BD: GOTO 0DA |
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky |
00BE: MOVLW 01 |
00BF: MOVWF 2E |
00C0: MOVLW 02 |
00C1: MOVWF 2F |
00C2: CALL 092 |
00C3: GOTO 0DA |
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home |
00C4: MOVLW 01 |
00C5: MOVWF 2E |
00C6: MOVWF 2F |
00C7: CALL 092 |
00C8: GOTO 0DA |
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet |
00C9: CLRF 32 |
00CA: MOVLW 10 |
00CB: MOVWF 33 |
00CC: CALL 042 |
00CD: GOTO 0DA |
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F |
00CE: MOVF 2D,W |
00CF: SUBLW 1F |
00D0: BTFSS 03.0 |
00D1: GOTO 0D4 |
00D2: MOVLW 07 |
00D3: ANDWF 2D,F |
.................... lcd_send_byte(1,c); break; // zapis znak |
00D4: MOVLW 01 |
00D5: MOVWF 32 |
00D6: MOVF 2D,W |
00D7: MOVWF 33 |
00D8: CALL 042 |
00D9: GOTO 0DA |
.................... } |
00DA: 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 |
.................... |
.................... int stredX, stredY, x, y; |
.................... |
.................... |
.................... void odeslat_nibble (int8 kodeslani) |
.................... { |
.................... int i; |
.................... |
.................... for (i=0;i<=3;i++) |
* |
0133: CLRF 2E |
0134: MOVF 2E,W |
0135: SUBLW 03 |
0136: BTFSS 03.0 |
0137: GOTO 18B |
.................... { |
.................... if (1==bit_test(kodeslani,i)) |
0138: MOVF 2D,W |
0139: MOVWF 20 |
013A: MOVF 2E,W |
013B: MOVWF 21 |
013C: BTFSC 03.2 |
013D: GOTO 142 |
013E: BCF 03.0 |
013F: RRF 20,F |
0140: DECFSZ 21,F |
0141: GOTO 13E |
0142: MOVLW 00 |
0143: BTFSC 20.0 |
0144: MOVLW 01 |
0145: SUBLW 01 |
0146: BTFSS 03.2 |
0147: GOTO 160 |
.................... { |
.................... output_high(VYSILAC); |
0148: BCF 29.3 |
0149: MOVF 29,W |
014A: BSF 03.5 |
014B: MOVWF 07 |
014C: BCF 03.5 |
014D: BSF 07.3 |
.................... delay_us(2*IMPULS); // X pri 1: |--|___ |
014E: MOVLW A6 |
014F: MOVWF 20 |
0150: DECFSZ 20,F |
0151: GOTO 150 |
0152: NOP |
.................... output_low(VYSILAC); |
0153: BCF 29.3 |
0154: MOVF 29,W |
0155: BSF 03.5 |
0156: MOVWF 07 |
0157: BCF 03.5 |
0158: BCF 07.3 |
.................... delay_us(3*IMPULS); |
0159: MOVLW F9 |
015A: MOVWF 20 |
015B: DECFSZ 20,F |
015C: GOTO 15B |
015D: NOP |
015E: NOP |
.................... } |
.................... else |
015F: GOTO 189 |
.................... { |
.................... output_high(VYSILAC); |
0160: BCF 29.3 |
0161: MOVF 29,W |
0162: BSF 03.5 |
0163: MOVWF 07 |
0164: BCF 03.5 |
0165: BSF 07.3 |
.................... delay_us(IMPULS); // X pri 0: |-|__|-|_ |
0166: MOVLW 53 |
0167: MOVWF 20 |
0168: DECFSZ 20,F |
0169: GOTO 168 |
.................... output_low(VYSILAC); |
016A: BCF 29.3 |
016B: MOVF 29,W |
016C: BSF 03.5 |
016D: MOVWF 07 |
016E: BCF 03.5 |
016F: BCF 07.3 |
.................... |
.................... delay_us(2*IMPULS); |
0170: MOVLW A6 |
0171: MOVWF 20 |
0172: DECFSZ 20,F |
0173: GOTO 172 |
0174: NOP |
.................... |
.................... output_high(VYSILAC); |
0175: BCF 29.3 |
0176: MOVF 29,W |
0177: BSF 03.5 |
0178: MOVWF 07 |
0179: BCF 03.5 |
017A: BSF 07.3 |
.................... delay_us(IMPULS); |
017B: MOVLW 53 |
017C: MOVWF 20 |
017D: DECFSZ 20,F |
017E: GOTO 17D |
.................... output_low(VYSILAC); |
017F: BCF 29.3 |
0180: MOVF 29,W |
0181: BSF 03.5 |
0182: MOVWF 07 |
0183: BCF 03.5 |
0184: BCF 07.3 |
.................... delay_us(IMPULS); |
0185: MOVLW 53 |
0186: MOVWF 20 |
0187: DECFSZ 20,F |
0188: GOTO 187 |
.................... }; |
.................... } |
0189: INCF 2E,F |
018A: GOTO 134 |
018B: RETLW 00 |
.................... } |
.................... |
.................... |
.................... void odesli (int8 neco,adresa) |
.................... { |
.................... odeslat_nibble(0b1111); // Synchronizace |
018C: MOVLW 0F |
018D: MOVWF 2D |
018E: CALL 133 |
.................... odeslat_nibble(adresa); // Identifikace osy |
018F: MOVF 2C,W |
0190: MOVWF 2D |
0191: CALL 133 |
.................... odeslat_nibble(neco); // Hodnota osy |
0192: MOVF 2B,W |
0193: MOVWF 2D |
0194: CALL 133 |
.................... odeslat_nibble(neco); // Zopakovana hodnota osy pro kontrolu |
0195: MOVF 2B,W |
0196: MOVWF 2D |
0197: CALL 133 |
0198: RETLW 00 |
.................... |
.................... } |
.................... |
.................... |
.................... 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() |
.................... { |
* |
01A2: CLRF 2A |
.................... int c=0; |
* |
0199: CLRF 04 |
019A: MOVLW 1F |
019B: ANDWF 03,F |
019C: MOVLW 07 |
019D: BSF 03.5 |
019E: MOVWF 1F |
019F: MOVLW FF |
01A0: BCF 03.5 |
01A1: MOVWF 29 |
.................... |
.................... setup_adc_ports(RA0_RA1_RA3_ANALOG); |
* |
01A3: MOVLW 04 |
01A4: BSF 03.5 |
01A5: MOVWF 1F |
.................... setup_adc(ADC_CLOCK_DIV_2); |
01A6: BCF 03.5 |
01A7: MOVF 1F,W |
01A8: ANDLW 38 |
01A9: IORLW 01 |
01AA: MOVWF 1F |
.................... setup_spi(FALSE); |
01AB: BCF 14.5 |
01AC: BCF 29.5 |
01AD: MOVF 29,W |
01AE: BSF 03.5 |
01AF: MOVWF 07 |
01B0: BCF 03.5 |
01B1: BSF 29.4 |
01B2: MOVF 29,W |
01B3: BSF 03.5 |
01B4: MOVWF 07 |
01B5: BCF 03.5 |
01B6: BCF 29.3 |
01B7: MOVF 29,W |
01B8: BSF 03.5 |
01B9: MOVWF 07 |
01BA: MOVLW 00 |
01BB: BCF 03.5 |
01BC: MOVWF 14 |
01BD: BSF 03.5 |
01BE: MOVWF 14 |
.................... setup_counters(RTCC_INTERNAL,RTCC_DIV_2); |
01BF: BCF 03.5 |
01C0: CLRF 20 |
01C1: BTFSS 20.3 |
01C2: GOTO 1CB |
01C3: MOVLW 07 |
01C4: CLRF 01 |
01C5: MOVLW 81 |
01C6: MOVWF 04 |
01C7: MOVF 00,W |
01C8: ANDLW C0 |
01C9: IORLW 0F |
01CA: MOVWF 00 |
01CB: CLRWDT |
01CC: MOVLW 81 |
01CD: MOVWF 04 |
01CE: MOVF 00,W |
01CF: ANDLW C0 |
01D0: IORWF 20,W |
01D1: MOVWF 00 |
.................... setup_timer_1(T1_DISABLED); |
01D2: CLRF 10 |
.................... setup_timer_2(T2_DISABLED,0,1); |
01D3: MOVLW 00 |
01D4: MOVWF 21 |
01D5: MOVWF 12 |
01D6: MOVLW 00 |
01D7: BSF 03.5 |
01D8: MOVWF 12 |
.................... |
.................... lcd_init(); |
01D9: BCF 03.5 |
01DA: GOTO 058 |
.................... |
.................... /* 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"); |
01DB: MOVLW 0C |
01DC: MOVWF 2D |
01DD: CALL 0A3 |
.................... |
.................... lcd_gotoxy(7,2); |
01DE: MOVLW 07 |
01DF: MOVWF 2E |
01E0: MOVLW 02 |
01E1: MOVWF 2F |
01E2: CALL 092 |
.................... printf(lcd_putc,"vysilam"); |
* |
000C: BCF 0A.0 |
000D: BCF 0A.1 |
000E: BCF 0A.2 |
000F: ADDWF 02,F |
0010: RETLW 76 |
0011: RETLW 79 |
0012: RETLW 73 |
0013: RETLW 69 |
0014: RETLW 6C |
0015: RETLW 61 |
0016: RETLW 6D |
0017: RETLW 00 |
* |
01E3: CLRF 2B |
01E4: MOVF 2B,W |
01E5: CALL 00C |
01E6: INCF 2B,F |
01E7: MOVWF 2D |
01E8: CALL 0A3 |
01E9: MOVLW 07 |
01EA: SUBWF 2B,W |
01EB: BTFSS 03.2 |
01EC: GOTO 1E4 |
.................... while(true) |
.................... { |
.................... set_adc_channel(AD_OSA_X); |
01ED: MOVLW 00 |
01EE: MOVWF 21 |
01EF: MOVF 1F,W |
01F0: ANDLW C7 |
01F1: IORWF 21,W |
01F2: MOVWF 1F |
.................... lcd_gotoxy(1,1); |
01F3: MOVLW 01 |
01F4: MOVWF 2E |
01F5: MOVWF 2F |
01F6: CALL 092 |
.................... x=read_adc() >> 4; |
01F7: BSF 1F.2 |
01F8: BTFSC 1F.2 |
01F9: GOTO 1F8 |
01FA: MOVF 1E,W |
01FB: SWAPF 1E,W |
01FC: MOVWF 27 |
01FD: MOVLW 0F |
01FE: ANDWF 27,F |
.................... printf(lcd_putc,"X: %D ", x); |
* |
00F0: MOVF 2B,W |
00F1: MOVWF 20 |
00F2: BTFSC 2B.7 |
00F3: GOTO 0F8 |
00F4: BTFSS 2C.2 |
00F5: GOTO 102 |
00F6: MOVLW 20 |
00F7: GOTO 0FD |
00F8: COMF 20,F |
00F9: INCF 20,F |
00FA: MOVF 20,W |
00FB: MOVWF 2B |
00FC: MOVLW 2D |
00FD: MOVWF 21 |
00FE: MOVWF 2D |
00FF: CALL 0A3 |
0100: BTFSS 2C.2 |
0101: BSF 2C.3 |
0102: MOVF 2B,W |
0103: MOVWF 2D |
0104: MOVLW 64 |
0105: MOVWF 2E |
0106: CALL 0DB |
0107: MOVF 20,W |
0108: MOVWF 2B |
0109: MOVF 21,W |
010A: MOVLW 30 |
010B: BTFSS 03.2 |
010C: GOTO 114 |
010D: BTFSC 2C.0 |
010E: BSF 2C.3 |
010F: BTFSC 2C.3 |
0110: GOTO 11A |
0111: BTFSC 2C.4 |
0112: MOVLW 20 |
0113: GOTO 116 |
0114: BCF 2C.3 |
0115: BCF 2C.4 |
0116: ADDWF 21,F |
0117: MOVF 21,W |
0118: MOVWF 2D |
0119: CALL 0A3 |
011A: MOVF 2B,W |
011B: MOVWF 2D |
011C: MOVLW 0A |
011D: MOVWF 2E |
011E: CALL 0DB |
011F: MOVF 20,W |
0120: MOVWF 2B |
0121: MOVF 21,W |
0122: MOVLW 30 |
0123: BTFSS 03.2 |
0124: GOTO 129 |
0125: BTFSC 2C.3 |
0126: GOTO 12D |
0127: BTFSC 2C.4 |
0128: MOVLW 20 |
0129: ADDWF 21,F |
012A: MOVF 21,W |
012B: MOVWF 2D |
012C: CALL 0A3 |
012D: MOVLW 30 |
012E: ADDWF 2B,F |
012F: MOVF 2B,W |
0130: MOVWF 2D |
0131: CALL 0A3 |
0132: RETLW 00 |
* |
01FF: MOVLW 58 |
0200: MOVWF 2D |
0201: CALL 0A3 |
0202: MOVLW 3A |
0203: MOVWF 2D |
0204: CALL 0A3 |
0205: MOVLW 20 |
0206: MOVWF 2D |
0207: CALL 0A3 |
0208: MOVF 27,W |
0209: MOVWF 2B |
020A: MOVLW 18 |
020B: MOVWF 2C |
020C: CALL 0F0 |
020D: MOVLW 06 |
020E: MOVWF 2B |
020F: MOVLW 20 |
0210: MOVWF 2D |
0211: CALL 0A3 |
0212: DECFSZ 2B,F |
0213: GOTO 20F |
.................... set_adc_channel(AD_OSA_Y); |
0214: MOVLW 08 |
0215: MOVWF 21 |
0216: MOVF 1F,W |
0217: ANDLW C7 |
0218: IORWF 21,W |
0219: MOVWF 1F |
.................... lcd_gotoxy(1,2); |
021A: MOVLW 01 |
021B: MOVWF 2E |
021C: MOVLW 02 |
021D: MOVWF 2F |
021E: CALL 092 |
.................... y=read_adc() >> 4; |
021F: BSF 1F.2 |
0220: BTFSC 1F.2 |
0221: GOTO 220 |
0222: MOVF 1E,W |
0223: SWAPF 1E,W |
0224: MOVWF 28 |
0225: MOVLW 0F |
0226: ANDWF 28,F |
.................... printf(lcd_putc,"Y: %D ", y); |
0227: MOVLW 59 |
0228: MOVWF 2D |
0229: CALL 0A3 |
022A: MOVLW 3A |
022B: MOVWF 2D |
022C: CALL 0A3 |
022D: MOVLW 20 |
022E: MOVWF 2D |
022F: CALL 0A3 |
0230: MOVF 28,W |
0231: MOVWF 2B |
0232: MOVLW 18 |
0233: MOVWF 2C |
0234: CALL 0F0 |
0235: MOVLW 06 |
0236: MOVWF 2B |
0237: MOVLW 20 |
0238: MOVWF 2D |
0239: CALL 0A3 |
023A: DECFSZ 2B,F |
023B: GOTO 237 |
.................... |
.................... /* output_high(PIN_C1); |
.................... output_low(PIN_C2); |
.................... delay_ms(100); |
.................... output_low(PIN_C1); |
.................... output_high(PIN_C2); |
.................... delay_ms(100);*/ |
.................... |
.................... output_high(PIN_C4); |
023C: BCF 29.4 |
023D: MOVF 29,W |
023E: BSF 03.5 |
023F: MOVWF 07 |
0240: BCF 03.5 |
0241: BSF 07.4 |
.................... output_high(PIN_C6); |
0242: BCF 29.6 |
0243: MOVF 29,W |
0244: BSF 03.5 |
0245: MOVWF 07 |
0246: BCF 03.5 |
0247: BSF 07.6 |
.................... delay_ms(1); |
0248: MOVLW 01 |
0249: MOVWF 2E |
024A: CALL 018 |
.................... output_low(PIN_C4); |
024B: BCF 29.4 |
024C: MOVF 29,W |
024D: BSF 03.5 |
024E: MOVWF 07 |
024F: BCF 03.5 |
0250: BCF 07.4 |
.................... |
.................... odesli(x,OSA_X); |
0251: MOVF 27,W |
0252: MOVWF 2B |
0253: CLRF 2C |
0254: CALL 18C |
.................... delay_ms(10); |
0255: MOVLW 0A |
0256: MOVWF 2E |
0257: CALL 018 |
.................... odesli(y,OSA_Y); |
0258: MOVF 28,W |
0259: MOVWF 2B |
025A: MOVLW 01 |
025B: MOVWF 2C |
025C: CALL 18C |
.................... |
.................... output_low(PIN_C6); |
025D: BCF 29.6 |
025E: MOVF 29,W |
025F: BSF 03.5 |
0260: MOVWF 07 |
0261: BCF 03.5 |
0262: BCF 07.6 |
.................... } |
0263: GOTO 1ED |
.................... |
.................... } |
.................... |
0264: SLEEP |
/schemata/prenos/letadlo/SW/vysilac/zaloha/01/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/01/MAIN.STA |
---|
0,0 → 1,42 |
ROM used: 613 (15%) |
2048 (50%) including unused fragments |
1 Average locations per line |
5 Average locations per statement |
RAM used: 12 (6%) at main() level |
23 (12%) worst case |
Lines Stmts % Files |
----- ----- --- ----- |
166 80 63 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 22 d:\@kaklik\programy\pic_c\prenos\letadlo\vysilac\MYLCD.C |
----- ----- |
1346 252 Total |
Page ROM % RAM Functions: |
---- --- --- --- ---------- |
0 21 3 1 delay_ms |
0 8 1 0 @const28 |
0 21 3 3 lcd_send_nibble |
0 22 4 2 lcd_send_byte |
0 58 9 2 lcd_init |
0 17 3 4 lcd_gotoxy |
0 56 9 1 lcd_putc |
0 89 15 2 odeslat_nibble |
0 13 2 2 odesli |
0 204 33 2 main |
0 12 2 0 @const10153 |
0 21 3 3 @DIV88 |
0 67 11 2 @PRINTF_D_253 |
Segment Used Free |
--------- ---- ---- |
0000-0003 4 0 |
0004-07FF 609 1435 |
0800-0FFF 0 2048 |
/schemata/prenos/letadlo/SW/vysilac/zaloha/01/MAIN.SYM |
---|
0,0 → 1,73 |
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 stredX |
026 stredY |
027 x |
028 y |
029 @TRIS_C |
02A main.c |
02B lcd_init.i |
02B odesli.neco |
02B @PRINTF_D_253.P1 |
02B main.@SCRATCH |
02C odesli.adresa |
02C @PRINTF_D_253.P1 |
02C lcd_init.@SCRATCH |
02D lcd_putc.c |
02D odeslat_nibble.kodeslani |
02D @DIV88.P1 |
02E delay_ms.P1 |
02E lcd_gotoxy.x |
02E odeslat_nibble.i |
02E @DIV88.P1 |
02F lcd_gotoxy.y |
02F @DIV88.@SCRATCH |
030 lcd_gotoxy.Adr |
031 lcd_gotoxy.@SCRATCH |
032 lcd_send_byte.Adr |
033 lcd_send_byte.n |
034 lcd_send_nibble.n |
035 lcd_send_nibble.@SCRATCH |
036 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 |
0018 delay_ms |
0004 @const28 |
002D lcd_send_nibble |
0042 lcd_send_byte |
0058 lcd_init |
0092 lcd_gotoxy |
00A3 lcd_putc |
0133 odeslat_nibble |
018C odesli |
0199 main |
000C @const10153 |
00DB @DIV88 |
00F0 @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/01/MAIN.TRE |
---|
0,0 → 1,386 |
ÀÄmain |
ÀÄmain 0/204 Ram=2 |
ÃÄ??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 |
ÃÄ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 |
ÃÄ@const10153 0/12 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 |
ÃÄ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 |
ÃÄdelay_ms 0/21 Ram=1 |
ÃÄodesli 0/13 Ram=2 |
³ ÃÄodeslat_nibble 0/89 Ram=2 |
³ ÃÄodeslat_nibble 0/89 Ram=2 |
³ ÃÄodeslat_nibble 0/89 Ram=2 |
³ ÀÄodeslat_nibble 0/89 Ram=2 |
ÃÄdelay_ms 0/21 Ram=1 |
ÀÄodesli 0/13 Ram=2 |
ÃÄodeslat_nibble 0/89 Ram=2 |
ÃÄodeslat_nibble 0/89 Ram=2 |
ÃÄodeslat_nibble 0/89 Ram=2 |
ÀÄodeslat_nibble 0/89 Ram=2 |
/schemata/prenos/letadlo/SW/vysilac/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/vysilac/zaloha/01/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/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/vysilac/zaloha/01/RUN.BAT |
---|
0,0 → 1,5 |
call picpgr run |
pause |
call picpgr stop |
pause |
run.bat |
/schemata/prenos/letadlo/SW/vysilac/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 |