Subversion Repositories svnkaklik

Compare Revisions

Regard whitespace Rev 6 → Rev 328

/programy/PIC_C/mereni/gmetr/gmetr.BAK
1,4 → 1,4
#include "D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.h"
#include ".\gmetr.h"
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
10,7 → 10,8
void main()
{
signed int16 stred;
signed int16 hodnota;
signed int8 hodnota;
unsigned int8 i, offset;
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_2);
22,28 → 23,43
lcd_init();
Delay_ms(100);
set_adc_channel(1);
 
LCD_gotoxy(1,1);
printf(lcd_putc,"Gmetr 0.1.2 Beta");
LCD_gotoxy(1,2);
printf(lcd_putc,"Kaklik@mlab.cz");
Delay_ms(500);
stred = read_adc();
LCD_clr();
LCD_gotoxy(1,1);
printf(lcd_putc,"Clibration...");
 
stred = 0;
for(i=0;i<=127;i++)
{
Delay_ms(10);
stred = stred + read_adc();
}
stred = stred >> 7;
 
while(true)
{
hodnota = stred - read_adc();
Delay_ms(100);
LCD_gotoxy(1,1);
printf(lcd_putc," ");
if (hodnota<0)
hodnota = read_adc();
Delay_ms(50);
LCD_clr();
LCD_gotoxy(6,1);
printf(lcd_putc," %03ld ",(stred - hodnota));
if (hodnota > stred)
{
LCD_gotoxy(5,2);
printf(lcd_putc," %03ld ",hodnota);
LCD_gotoxy(8-hodnota,1);
printf(lcd_putc,"* ",hodnota);
offset = hodnota - stred;
offset = (offset >> 5) + 8;
}
else
{
LCD_gotoxy(6,2);
printf(lcd_putc," %03ld ",hodnota);
LCD_gotoxy(8-hodnota,1);
printf(lcd_putc," *",hodnota);
offset = stred - hodnota;
offset = offset >> 5;
}
LCD_gotoxy(offset,2);
printf(lcd_putc,"*");
}
}
/programy/PIC_C/mereni/gmetr/gmetr.HEX
1,66 → 1,87
:1000000000308A00342900000A108A100A11820781
:1000100028340C34013406343330840000080319CA
:1000200020280130A100A001A00B1428A10B132847
:100030004A30A000A00B1A2800000000800B1128F5
:10004000003407080F39BA00390EA000F030A005BF
:100050002008F0393A0487000614831606100000C1
:10006000831206108316061083120034B708031D8E
:100070003B2886103C288614831686108312B80EFF
:100080003808B9002120B80E3808B90021200D30F9
:10009000A000A00B492800341430B3000C200F300E
:1000A0008316870583128610831686108312061026
:1000B000831606108312AA012A08023C031C682832
:1000C0000230B3000C200330B9002120AA0A5C28BA
:1000D0000D30A000A00B6A280230B90021200D309D
:1000E000A000A00B7128AA012A08023C031C842846
:1000F0002A080420AB00B7012B08B80036200230D4
:10010000B3000C20AA0A74288A116D290130330229
:10011000B5003408023C031D8F284030B507350870
:100120008038B600B7013608B800362000343208EF
:100130000C3A0319A528063A0319AD28073A031902
:10014000B328053A0319B828BD28B7010130B80013
:1001500036200230B3000C20C9280130B300023031
:10016000B4008620C9280130B300B4008620C92815
:10017000B7011030B8003620C92832081F3C031CD4
:10018000C3280730B2050130B7003208B800362066
:10019000C92800340408B100AB1FD7282D30B200A5
:1001A00097208403AA09AB09AA0A0319AB0A2B0EEC
:1001B000F038AD00AD07E23EAE00323EB0002B0895
:1001C0000F39AE07AE07B007E93EAF00AF07AF0784
:1001D0002A0E0F39AF07B007AF0DB00DB009B00D43
:1001E0002A080F39B007AD0D0730AC000A30B00750
:1001F000AF03031CF728AF07AE03031CFB28AE07B1
:10020000AD03031CFF28AD07AC03031C03292C30EE
:1002100084000730310584073030040203192C298B
:100220000008A000031D1A29311A2A29B1191C2916
:1002300020301D290830B1003030A007AB01040880
:10024000AA002008AC002008B20097202A088400E9
:100250002C08A000840A0C290008A0003030A00758
:100260002008B2009720003484011F3083058316D4
:100270001F149F141F159F11FF308312A5008316B2
:100280001F109F101F119F1183121F139F1383169E
:100290009F1783121F149412A51225088316870036
:1002A000831225162508831687008312A5112508B9
:1002B000831687000030831294008316940001088F
:1002C000C73908388100831290010030A1009200E4
:1002D00000308316920083124C286430B3000C2047
:1002E0000830A1001F08C73921049F000230AA006E
:1002F000FA30B3000C20AA0B78291F151F197E298C
:1003000083161E088312A6001E08A7001F151F19BA
:10031000872983161E0883122602A8002708A90031
:100320001E08031C1E0FA9026430B3000C2001300C
:10033000B300B40086201030AA002030B20097200D
:10034000AA0B9D29A91FCA290530B3000230B400A9
:1003500086202030B20097200A3084002908AB00A4
:100360002808AA00CA202030B20097202030B2000E
:1003700097202808083CAA00AB012908031C290F74
:10038000AB022A08B3000130B40086202A30B20044
:100390009720EF290630B3000230B40086202030C9
:1003A000B20097200A3084002908AB002808AA0070
:1003B000CA202030B20097202030B20097202808B1
:1003C000083CAA00AB012908031C290FAB022A082C
:1003D000B3000130B40086202A30B200972086296D
:0203E0006300B8
:1000000000308A00842900000A108A100A11820731
:1000100028340C34013406340A108A100A1182077D
:1000200047346D34653474347234203430342E34B3
:1000300031342E34323420344234653474346134F3
:1000400000340A108A100A1182074B3461346B3471
:100050006C3469346B3440346D346C3461346234E4
:100060002E3463347A3400340A108A100A1182075D
:1000700043346C34693462347234613474346934B6
:100080006F346E342E342E342E3400340A108A101D
:100090000A1182072A34003436308400000803191C
:1000A00060280130A100A001A00B5428A10B532807
:1000B0004A30A000A00B5A2800000000800B5128F5
:1000C000003407080F39BD003C0EA000F030A00539
:1000D0002008F0393D04870006148316061000003E
:1000E000831206108316061083120034BA08031D0B
:1000F0007B2886107C288614831686108312BB0EFC
:100100003B08BC006120BB0E3B08BC0061200D30E9
:10011000A000A00B892800341430B6004C200F300A
:1001200083168705831286108316861083120610A5
:10013000831606108312AB012B08023C031CA8286F
:100140000230B6004C200330BC006120AB0A9C2872
:100150000D30A000A00BAA280230BC0061200D3099
:10016000A000A00BB128AB012B08023C031CC42843
:100170002B080420AC00BA012C08BB00762002300A
:10018000B6004C20AB0AB4288A11BD2901303602D2
:10019000B8003708023C031DCF284030B8073808A4
:1001A0008038B900BA013908BB0076200034350820
:1001B0000C3A0319E528063A0319ED28073A031902
:1001C000F328053A0319F828FD28BA010130BB00CD
:1001D00076200230B6004C2009290130B6000230EA
:1001E000B700C62009290130B600B700C62009298A
:1001F000BA011030BB007620092935081F3C031CCA
:1002000003290730B5050130BA003508BB00762058
:10021000092900340C30B500D72000340408B4009C
:10022000AE1F1A29B417341EB40AAD09AE09AD0ABF
:100230000319AE0A2E0EF038B000B007E23EB1004E
:10024000323EB3002E080F39B107B107B307E93EBC
:10025000B200B207B2072D0E0F39B207B307B20DC5
:10026000B30DB309B30D2D080F39B307B00D073027
:10027000AF000A30B307B203031C3A29B207B10337
:10028000031C3E29B107B003031C4229B007AF038A
:10029000031C46292F3084000730340534138403AF
:1002A0003405031D5A29341A840A341A5A29203075
:1002B000A00077298407333004020319341700089B
:1002C000A000031D6B29341B6B29341A7F29B41934
:1002D0006B2920307629B41F73292D30A0008403A8
:1002E0003413B4137729B41534123030A007AE019B
:1002F0000408AD002008B500D7202D088400840A2A
:10030000341F5B298A11472A84011F308305831615
:100310001F149F141F159F11FF308312A500831611
:100320001F109F101F119F1183121F139F138316FD
:100330009F1783121F149412A51225088316870095
:10034000831225162508831687008312A511250818
:1003500083168700003083129400831694000108EE
:10036000C73908388100831290010030A100920043
:1003700000308316920083128C286430B6004C2023
:100380000830A1001F08C73921049F000130B600C2
:10039000B700C620AB012B080C2000380319D42964
:1003A000AB0AB500D720CB290130B6000230B70028
:1003B000C620AB012B08212000380319E329AB0A22
:1003C000B500D720DA290230AB00FA30B6004C2055
:1003D000AB0BE5290A210130B600B700C620AB01FE
:1003E0002B08342000380319F929AB0AB500D720AF
:1003F000F029A701A601A90129087F3C031C102AA6
:100400000A30B6004C201F151F19042A83161E0837
:100410008312A6070318A70A1E08A707A90AFC2922
:10042000A70CA60CA70CA60CA70CA60CA70CA60C38
:10043000A70CA60CA70CA60CA70CA60C0130A705B0
:100440001F151F19212A83161E088312A800323097
:10045000B6004C200A210630B6000130B700C62095
:10046000A3012808A000A81BA3032602AB002708AD
:10047000AC002308031C230FAC022030B500D720AA
:100480000B3084002C08AE002B08AD000E29203064
:10049000B500D720A3012808A000A01BA303A1003A
:1004A000A71F552AA31F612A572AA31B782A2708AA
:1004B0002302031C782A031D612A26082102031C3B
:1004C000782AA3012808A81BA303A100260821025B
:1004D000A0002708031C270FA3022008AA002A0E49
:1004E000A000A00C0730A0052008083EAA008C2A16
:1004F000A3012808A81BA3032602A0002308031CAD
:10050000230F842A2708852A2702A3002008AA008F
:10051000AA0EAA0C0730AA052A08B6000230B700B6
:10052000C620AB012B084620003803199B2AAB0AD2
:0A053000B500D720922A202A6300AC
:02400E00393F38
:00000001FF
;PIC16F873
/programy/PIC_C/mereni/gmetr/gmetr.LST
1,19 → 1,19
CCS PCM C Compiler, Version 3.221, 27853 18-VI-05 19:21
CCS PCM C Compiler, Version 3.245, 27853 27-VI-07 00:22
 
Filename: D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.LST
Filename: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.lst
 
ROM used: 497 words (12%)
ROM used: 669 words (16%)
Largest free fragment is 2048
RAM used: 12 (6%) at main() level
28 (15%) worst case
RAM used: 13 (7%) at main() level
31 (16%) worst case
Stack: 5 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 134
0002: GOTO 184
0003: NOP
.................... #include "D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.h"
.................... #include ".\gmetr.h"
.................... #include <16F873.h>
.................... //////// Standard Header file for the PIC16F873 device ////////////////
.................... #device PIC16F873
23,27 → 23,27
.................... #fuses NOWDT,XT, NOPUT, NOPROTECT, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
.................... #use delay(clock=4000000)
*
000C: MOVLW 33
000D: MOVWF 04
000E: MOVF 00,W
000F: BTFSC 03.2
0010: GOTO 020
0011: MOVLW 01
0012: MOVWF 21
0013: CLRF 20
0014: DECFSZ 20,F
0015: GOTO 014
0016: DECFSZ 21,F
0017: GOTO 013
0018: MOVLW 4A
0019: MOVWF 20
001A: DECFSZ 20,F
001B: GOTO 01A
001C: NOP
001D: NOP
001E: DECFSZ 00,F
001F: GOTO 011
0020: RETLW 00
004C: MOVLW 36
004D: MOVWF 04
004E: MOVF 00,W
004F: BTFSC 03.2
0050: GOTO 060
0051: MOVLW 01
0052: MOVWF 21
0053: CLRF 20
0054: DECFSZ 20,F
0055: GOTO 054
0056: DECFSZ 21,F
0057: GOTO 053
0058: MOVLW 4A
0059: MOVWF 20
005A: DECFSZ 20,F
005B: GOTO 05A
005C: NOP
005D: NOP
005E: DECFSZ 00,F
005F: GOTO 051
0060: RETLW 00
....................
....................
....................
156,17 → 156,17
.................... #ifdef LCD_DATA_LSB
.................... // data jsou za sebou na 4 bitech jednoho portu
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
0021: MOVF 07,W
0022: ANDLW 0F
0023: MOVWF 3A
0024: SWAPF 39,W
0025: MOVWF 20
0026: MOVLW F0
0027: ANDWF 20,F
0028: MOVF 20,W
0029: ANDLW F0
002A: IORWF 3A,W
002B: MOVWF 07
0061: MOVF 07,W
0062: ANDLW 0F
0063: MOVWF 3D
0064: SWAPF 3C,W
0065: MOVWF 20
0066: MOVLW F0
0067: ANDWF 20,F
0068: MOVF 20,W
0069: ANDLW F0
006A: IORWF 3D,W
006B: MOVWF 07
.................... #else
.................... // data jsou na libovolnych 4 bitech libovolnych portu
.................... output_bit(LCD_D0,bit_test(n,0));
175,19 → 175,19
.................... output_bit(LCD_D3,bit_test(n,3));
.................... #endif
.................... output_bit(LCD_E,1); // vzestupna hrana
002C: BSF 06.0
002D: BSF 03.5
002E: BCF 06.0
006C: BSF 06.0
006D: BSF 03.5
006E: BCF 06.0
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
002F: NOP
006F: NOP
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
0030: BCF 03.5
0031: BCF 06.0
0032: BSF 03.5
0033: BCF 06.0
0070: BCF 03.5
0071: BCF 06.0
0072: BSF 03.5
0073: BCF 06.0
.................... }
0034: BCF 03.5
0035: RETLW 00
0074: BCF 03.5
0075: RETLW 00
....................
....................
.................... // Odesle bajt do registru LCD
198,34 → 198,34
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n )
.................... {
.................... output_bit(LCD_RS,Adr); // vyber registr
0036: MOVF 37,F
0037: BTFSS 03.2
0038: GOTO 03B
0039: BCF 06.1
003A: GOTO 03C
003B: BSF 06.1
003C: BSF 03.5
003D: BCF 06.1
0076: MOVF 3A,F
0077: BTFSS 03.2
0078: GOTO 07B
0079: BCF 06.1
007A: GOTO 07C
007B: BSF 06.1
007C: BSF 03.5
007D: BCF 06.1
.................... swap(n);
003E: BCF 03.5
003F: SWAPF 38,F
007E: BCF 03.5
007F: SWAPF 3B,F
.................... lcd_send_nibble(n); // posli horni pulku bajtu
0040: MOVF 38,W
0041: MOVWF 39
0042: CALL 021
0080: MOVF 3B,W
0081: MOVWF 3C
0082: CALL 061
.................... swap(n);
0043: SWAPF 38,F
0083: SWAPF 3B,F
.................... lcd_send_nibble(n); // posli spodni pulku bajtu
0044: MOVF 38,W
0045: MOVWF 39
0046: CALL 021
0084: MOVF 3B,W
0085: MOVWF 3C
0086: CALL 061
.................... delay_us(40); // minimalni doba na provedeni prikazu
0047: MOVLW 0D
0048: MOVWF 20
0049: DECFSZ 20,F
004A: GOTO 049
0087: MOVLW 0D
0088: MOVWF 20
0089: DECFSZ 20,F
008A: GOTO 089
.................... }
004B: RETLW 00
008B: RETLW 00
....................
....................
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
238,89 → 238,89
.................... int i; // pocitadlo cyklu
....................
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
004C: MOVLW 14
004D: MOVWF 33
004E: CALL 00C
008C: MOVLW 14
008D: MOVWF 36
008E: CALL 04C
....................
.................... #ifdef LCD_DATA_LSB
.................... // data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
004F: MOVLW 0F
0050: BSF 03.5
0051: ANDWF 07,F
008F: MOVLW 0F
0090: BSF 03.5
0091: ANDWF 07,F
.................... #endif
....................
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
0052: BCF 03.5
0053: BCF 06.1
0054: BSF 03.5
0055: BCF 06.1
0092: BCF 03.5
0093: BCF 06.1
0094: BSF 03.5
0095: BCF 06.1
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
0056: BCF 03.5
0057: BCF 06.0
0058: BSF 03.5
0059: BCF 06.0
0096: BCF 03.5
0097: BCF 06.0
0098: BSF 03.5
0099: BCF 06.0
....................
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
005A: BCF 03.5
005B: CLRF 2A
005C: MOVF 2A,W
005D: SUBLW 02
005E: BTFSS 03.0
005F: GOTO 068
009A: BCF 03.5
009B: CLRF 2B
009C: MOVF 2B,W
009D: SUBLW 02
009E: BTFSS 03.0
009F: GOTO 0A8
.................... {
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
0060: MOVLW 02
0061: MOVWF 33
0062: CALL 00C
00A0: MOVLW 02
00A1: MOVWF 36
00A2: CALL 04C
.................... lcd_send_nibble(3); // rezim 8 bitu
0063: MOVLW 03
0064: MOVWF 39
0065: CALL 021
00A3: MOVLW 03
00A4: MOVWF 3C
00A5: CALL 061
.................... }
0066: INCF 2A,F
0067: GOTO 05C
00A6: INCF 2B,F
00A7: GOTO 09C
....................
.................... delay_us(40); // cas na zpracovani
0068: MOVLW 0D
0069: MOVWF 20
006A: DECFSZ 20,F
006B: GOTO 06A
00A8: MOVLW 0D
00A9: MOVWF 20
00AA: DECFSZ 20,F
00AB: GOTO 0AA
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
006C: MOVLW 02
006D: MOVWF 39
006E: CALL 021
00AC: MOVLW 02
00AD: MOVWF 3C
00AE: CALL 061
.................... delay_us(40); // cas na zpracovani
006F: MOVLW 0D
0070: MOVWF 20
0071: DECFSZ 20,F
0072: GOTO 071
00AF: MOVLW 0D
00B0: MOVWF 20
00B1: DECFSZ 20,F
00B2: GOTO 0B1
....................
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
0073: CLRF 2A
0074: MOVF 2A,W
0075: SUBLW 02
0076: BTFSS 03.0
0077: GOTO 084
00B3: CLRF 2B
00B4: MOVF 2B,W
00B5: SUBLW 02
00B6: BTFSS 03.0
00B7: GOTO 0C4
.................... {
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
0078: MOVF 2A,W
0079: CALL 004
007A: MOVWF 2B
007B: CLRF 37
007C: MOVF 2B,W
007D: MOVWF 38
007E: CALL 036
00B8: MOVF 2B,W
00B9: CALL 004
00BA: MOVWF 2C
00BB: CLRF 3A
00BC: MOVF 2C,W
00BD: MOVWF 3B
00BE: CALL 076
.................... delay_ms(2);
007F: MOVLW 02
0080: MOVWF 33
0081: CALL 00C
00BF: MOVLW 02
00C0: MOVWF 36
00C1: CALL 04C
.................... }
0082: INCF 2A,F
0083: GOTO 074
00C2: INCF 2B,F
00C3: GOTO 0B4
.................... }
0084: BCF 0A.3
0085: GOTO 16D (RETURN)
00C4: BCF 0A.3
00C5: GOTO 1BD (RETURN)
....................
....................
.................... // Proved presun kurzoru
333,28 → 333,28
.................... BYTE Adr;
....................
.................... Adr=x-1;
0086: MOVLW 01
0087: SUBWF 33,W
0088: MOVWF 35
00C6: MOVLW 01
00C7: SUBWF 36,W
00C8: MOVWF 38
.................... if(y==2)
0089: MOVF 34,W
008A: SUBLW 02
008B: BTFSS 03.2
008C: GOTO 08F
00C9: MOVF 37,W
00CA: SUBLW 02
00CB: BTFSS 03.2
00CC: GOTO 0CF
.................... Adr+=LCD_LINE_2;
008D: MOVLW 40
008E: ADDWF 35,F
00CD: MOVLW 40
00CE: ADDWF 38,F
....................
.................... lcd_send_byte(0,0x80|Adr);
008F: MOVF 35,W
0090: IORLW 80
0091: MOVWF 36
0092: CLRF 37
0093: MOVF 36,W
0094: MOVWF 38
0095: CALL 036
00CF: MOVF 38,W
00D0: IORLW 80
00D1: MOVWF 39
00D2: CLRF 3A
00D3: MOVF 39,W
00D4: MOVWF 3B
00D5: CALL 076
.................... }
0096: RETLW 00
00D6: RETLW 00
....................
....................
.................... // Zapis znaku na displej, zpracovani ridicich znaku
364,67 → 364,67
....................
.................... switch (c)
.................... {
0097: MOVF 32,W
0098: XORLW 0C
0099: BTFSC 03.2
009A: GOTO 0A5
009B: XORLW 06
009C: BTFSC 03.2
009D: GOTO 0AD
009E: XORLW 07
009F: BTFSC 03.2
00A0: GOTO 0B3
00A1: XORLW 05
00A2: BTFSC 03.2
00A3: GOTO 0B8
00A4: GOTO 0BD
00D7: MOVF 35,W
00D8: XORLW 0C
00D9: BTFSC 03.2
00DA: GOTO 0E5
00DB: XORLW 06
00DC: BTFSC 03.2
00DD: GOTO 0ED
00DE: XORLW 07
00DF: BTFSC 03.2
00E0: GOTO 0F3
00E1: XORLW 05
00E2: BTFSC 03.2
00E3: GOTO 0F8
00E4: GOTO 0FD
.................... case '\f' : lcd_send_byte(0,1); // smaz displej
00A5: CLRF 37
00A6: MOVLW 01
00A7: MOVWF 38
00A8: CALL 036
00E5: CLRF 3A
00E6: MOVLW 01
00E7: MOVWF 3B
00E8: CALL 076
.................... delay_ms(2);
00A9: MOVLW 02
00AA: MOVWF 33
00AB: CALL 00C
00E9: MOVLW 02
00EA: MOVWF 36
00EB: CALL 04C
.................... break;
00AC: GOTO 0C9
00EC: GOTO 109
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
00AD: MOVLW 01
00AE: MOVWF 33
00AF: MOVLW 02
00B0: MOVWF 34
00B1: CALL 086
00B2: GOTO 0C9
00ED: MOVLW 01
00EE: MOVWF 36
00EF: MOVLW 02
00F0: MOVWF 37
00F1: CALL 0C6
00F2: GOTO 109
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home
00B3: MOVLW 01
00B4: MOVWF 33
00B5: MOVWF 34
00B6: CALL 086
00B7: GOTO 0C9
00F3: MOVLW 01
00F4: MOVWF 36
00F5: MOVWF 37
00F6: CALL 0C6
00F7: GOTO 109
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
00B8: CLRF 37
00B9: MOVLW 10
00BA: MOVWF 38
00BB: CALL 036
00BC: GOTO 0C9
00F8: CLRF 3A
00F9: MOVLW 10
00FA: MOVWF 3B
00FB: CALL 076
00FC: GOTO 109
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
00BD: MOVF 32,W
00BE: SUBLW 1F
00BF: BTFSS 03.0
00C0: GOTO 0C3
00C1: MOVLW 07
00C2: ANDWF 32,F
00FD: MOVF 35,W
00FE: SUBLW 1F
00FF: BTFSS 03.0
0100: GOTO 103
0101: MOVLW 07
0102: ANDWF 35,F
.................... lcd_send_byte(1,c); break; // zapis znak
00C3: MOVLW 01
00C4: MOVWF 37
00C5: MOVF 32,W
00C6: MOVWF 38
00C7: CALL 036
00C8: GOTO 0C9
0103: MOVLW 01
0104: MOVWF 3A
0105: MOVF 35,W
0106: MOVWF 3B
0107: CALL 076
0108: GOTO 109
.................... }
.................... }
00C9: RETLW 00
0109: RETLW 00
....................
....................
.................... // Zapni kurzor
448,7 → 448,11
.................... void lcd_clr()
.................... {
.................... lcd_putc('\f');
010A: MOVLW 0C
010B: MOVWF 35
010C: CALL 0D7
.................... }
010D: RETLW 00
....................
....................
.................... // Definice vlastnich fontu
538,237 → 542,344
.................... void main()
.................... {
*
0134: CLRF 04
0135: MOVLW 1F
0136: ANDWF 03,F
0137: BSF 03.5
0138: BSF 1F.0
0139: BSF 1F.1
013A: BSF 1F.2
013B: BCF 1F.3
0184: CLRF 04
0185: MOVLW 1F
0186: ANDWF 03,F
0187: BSF 03.5
0188: BSF 1F.0
0189: BSF 1F.1
018A: BSF 1F.2
018B: BCF 1F.3
.................... signed int16 stred;
.................... signed int16 hodnota;
.................... signed int8 hodnota;
.................... unsigned int8 i, offset;
....................
.................... setup_adc_ports(ALL_ANALOG);
*
013F: BSF 03.5
0140: BCF 1F.0
0141: BCF 1F.1
0142: BCF 1F.2
0143: BCF 1F.3
018F: BSF 03.5
0190: BCF 1F.0
0191: BCF 1F.1
0192: BCF 1F.2
0193: BCF 1F.3
.................... setup_adc(ADC_CLOCK_DIV_2);
0144: BCF 03.5
0145: BCF 1F.6
0146: BCF 1F.7
0147: BSF 03.5
0148: BSF 1F.7
0149: BCF 03.5
014A: BSF 1F.0
0194: BCF 03.5
0195: BCF 1F.6
0196: BCF 1F.7
0197: BSF 03.5
0198: BSF 1F.7
0199: BCF 03.5
019A: BSF 1F.0
.................... setup_spi(FALSE);
*
013C: MOVLW FF
013D: BCF 03.5
013E: MOVWF 25
018C: MOVLW FF
018D: BCF 03.5
018E: MOVWF 25
*
014B: BCF 14.5
014C: BCF 25.5
014D: MOVF 25,W
014E: BSF 03.5
014F: MOVWF 07
0150: BCF 03.5
0151: BSF 25.4
0152: MOVF 25,W
0153: BSF 03.5
0154: MOVWF 07
0155: BCF 03.5
0156: BCF 25.3
0157: MOVF 25,W
0158: BSF 03.5
0159: MOVWF 07
015A: MOVLW 00
015B: BCF 03.5
015C: MOVWF 14
015D: BSF 03.5
015E: MOVWF 14
019B: BCF 14.5
019C: BCF 25.5
019D: MOVF 25,W
019E: BSF 03.5
019F: MOVWF 07
01A0: BCF 03.5
01A1: BSF 25.4
01A2: MOVF 25,W
01A3: BSF 03.5
01A4: MOVWF 07
01A5: BCF 03.5
01A6: BCF 25.3
01A7: MOVF 25,W
01A8: BSF 03.5
01A9: MOVWF 07
01AA: MOVLW 00
01AB: BCF 03.5
01AC: MOVWF 14
01AD: BSF 03.5
01AE: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
015F: MOVF 01,W
0160: ANDLW C7
0161: IORLW 08
0162: MOVWF 01
01AF: MOVF 01,W
01B0: ANDLW C7
01B1: IORLW 08
01B2: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
0163: BCF 03.5
0164: CLRF 10
01B3: BCF 03.5
01B4: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0165: MOVLW 00
0166: MOVWF 21
0167: MOVWF 12
0168: MOVLW 00
0169: BSF 03.5
016A: MOVWF 12
01B5: MOVLW 00
01B6: MOVWF 21
01B7: MOVWF 12
01B8: MOVLW 00
01B9: BSF 03.5
01BA: MOVWF 12
....................
.................... lcd_init();
016B: BCF 03.5
016C: GOTO 04C
01BB: BCF 03.5
01BC: GOTO 08C
.................... Delay_ms(100);
016D: MOVLW 64
016E: MOVWF 33
016F: CALL 00C
01BD: MOVLW 64
01BE: MOVWF 36
01BF: CALL 04C
.................... set_adc_channel(1);
0170: MOVLW 08
0171: MOVWF 21
0172: MOVF 1F,W
0173: ANDLW C7
0174: IORWF 21,W
0175: MOVWF 1F
01C0: MOVLW 08
01C1: MOVWF 21
01C2: MOVF 1F,W
01C3: ANDLW C7
01C4: IORWF 21,W
01C5: MOVWF 1F
....................
.................... LCD_gotoxy(1,1);
01C6: MOVLW 01
01C7: MOVWF 36
01C8: MOVWF 37
01C9: CALL 0C6
.................... printf(lcd_putc,"Gmetr 0.1.2 Beta");
01CA: CLRF 2B
01CB: MOVF 2B,W
01CC: CALL 00C
01CD: IORLW 00
01CE: BTFSC 03.2
01CF: GOTO 1D4
01D0: INCF 2B,F
01D1: MOVWF 35
01D2: CALL 0D7
01D3: GOTO 1CB
.................... LCD_gotoxy(1,2);
01D4: MOVLW 01
01D5: MOVWF 36
01D6: MOVLW 02
01D7: MOVWF 37
01D8: CALL 0C6
.................... printf(lcd_putc,"Kaklik@mlab.cz");
01D9: CLRF 2B
01DA: MOVF 2B,W
01DB: CALL 021
01DC: IORLW 00
01DD: BTFSC 03.2
01DE: GOTO 1E3
01DF: INCF 2B,F
01E0: MOVWF 35
01E1: CALL 0D7
01E2: GOTO 1DA
.................... Delay_ms(500);
0176: MOVLW 02
0177: MOVWF 2A
0178: MOVLW FA
0179: MOVWF 33
017A: CALL 00C
017B: DECFSZ 2A,F
017C: GOTO 178
.................... stred = read_adc();
017D: BSF 1F.2
017E: BTFSC 1F.2
017F: GOTO 17E
0180: BSF 03.5
0181: MOVF 1E,W
0182: BCF 03.5
0183: MOVWF 26
0184: MOVF 1E,W
0185: MOVWF 27
01E3: MOVLW 02
01E4: MOVWF 2B
01E5: MOVLW FA
01E6: MOVWF 36
01E7: CALL 04C
01E8: DECFSZ 2B,F
01E9: GOTO 1E5
....................
.................... LCD_clr();
01EA: CALL 10A
.................... LCD_gotoxy(1,1);
01EB: MOVLW 01
01EC: MOVWF 36
01ED: MOVWF 37
01EE: CALL 0C6
.................... printf(lcd_putc,"Clibration...");
01EF: CLRF 2B
01F0: MOVF 2B,W
01F1: CALL 034
01F2: IORLW 00
01F3: BTFSC 03.2
01F4: GOTO 1F9
01F5: INCF 2B,F
01F6: MOVWF 35
01F7: CALL 0D7
01F8: GOTO 1F0
....................
.................... stred = 0;
01F9: CLRF 27
01FA: CLRF 26
.................... for(i=0;i<=127;i++)
01FB: CLRF 29
01FC: MOVF 29,W
01FD: SUBLW 7F
01FE: BTFSS 03.0
01FF: GOTO 210
.................... {
.................... Delay_ms(10);
0200: MOVLW 0A
0201: MOVWF 36
0202: CALL 04C
.................... stred = stred + read_adc();
0203: BSF 1F.2
0204: BTFSC 1F.2
0205: GOTO 204
0206: BSF 03.5
0207: MOVF 1E,W
0208: BCF 03.5
0209: ADDWF 26,F
020A: BTFSC 03.0
020B: INCF 27,F
020C: MOVF 1E,W
020D: ADDWF 27,F
.................... }
020E: INCF 29,F
020F: GOTO 1FC
.................... stred = stred >> 7;
0210: RRF 27,F
0211: RRF 26,F
0212: RRF 27,F
0213: RRF 26,F
0214: RRF 27,F
0215: RRF 26,F
0216: RRF 27,F
0217: RRF 26,F
0218: RRF 27,F
0219: RRF 26,F
021A: RRF 27,F
021B: RRF 26,F
021C: RRF 27,F
021D: RRF 26,F
021E: MOVLW 01
021F: ANDWF 27,F
....................
.................... while(true)
.................... {
.................... hodnota = stred - read_adc();
0186: BSF 1F.2
0187: BTFSC 1F.2
0188: GOTO 187
0189: BSF 03.5
018A: MOVF 1E,W
018B: BCF 03.5
018C: SUBWF 26,W
018D: MOVWF 28
018E: MOVF 27,W
018F: MOVWF 29
0190: MOVF 1E,W
0191: BTFSS 03.0
0192: INCFSZ 1E,W
0193: SUBWF 29,F
.................... Delay_ms(100);
0194: MOVLW 64
0195: MOVWF 33
0196: CALL 00C
.................... LCD_gotoxy(1,1);
0197: MOVLW 01
0198: MOVWF 33
0199: MOVWF 34
019A: CALL 086
.................... printf(lcd_putc," ");
019B: MOVLW 10
019C: MOVWF 2A
019D: MOVLW 20
019E: MOVWF 32
019F: CALL 097
01A0: DECFSZ 2A,F
01A1: GOTO 19D
.................... if (hodnota<0)
01A2: BTFSS 29.7
01A3: GOTO 1CA
.................... hodnota = read_adc();
0220: BSF 1F.2
0221: BTFSC 1F.2
0222: GOTO 221
0223: BSF 03.5
0224: MOVF 1E,W
0225: BCF 03.5
0226: MOVWF 28
.................... Delay_ms(50);
0227: MOVLW 32
0228: MOVWF 36
0229: CALL 04C
.................... LCD_clr();
022A: CALL 10A
.................... LCD_gotoxy(6,1);
022B: MOVLW 06
022C: MOVWF 36
022D: MOVLW 01
022E: MOVWF 37
022F: CALL 0C6
.................... printf(lcd_putc," %03ld ",(stred - hodnota));
0230: CLRF 23
0231: MOVF 28,W
0232: MOVWF 20
0233: BTFSC 28.7
0234: DECF 23,F
0235: SUBWF 26,W
0236: MOVWF 2B
0237: MOVF 27,W
0238: MOVWF 2C
0239: MOVF 23,W
023A: BTFSS 03.0
023B: INCFSZ 23,W
023C: SUBWF 2C,F
023D: MOVLW 20
023E: MOVWF 35
023F: CALL 0D7
0240: MOVLW 0B
0241: MOVWF 04
0242: MOVF 2C,W
0243: MOVWF 2E
0244: MOVF 2B,W
0245: MOVWF 2D
0246: GOTO 10E
0247: MOVLW 20
0248: MOVWF 35
0249: CALL 0D7
.................... if (hodnota >= stred)
024A: CLRF 23
024B: MOVF 28,W
024C: MOVWF 20
024D: BTFSC 20.7
024E: DECF 23,F
024F: MOVWF 21
0250: BTFSS 27.7
0251: GOTO 255
0252: BTFSS 23.7
0253: GOTO 261
0254: GOTO 257
0255: BTFSC 23.7
0256: GOTO 278
0257: MOVF 27,W
0258: SUBWF 23,W
0259: BTFSS 03.0
025A: GOTO 278
025B: BTFSS 03.2
025C: GOTO 261
025D: MOVF 26,W
025E: SUBWF 21,W
025F: BTFSS 03.0
0260: GOTO 278
.................... {
.................... LCD_gotoxy(5,2);
01A4: MOVLW 05
01A5: MOVWF 33
01A6: MOVLW 02
01A7: MOVWF 34
01A8: CALL 086
.................... printf(lcd_putc," %03ld ",hodnota);
01A9: MOVLW 20
01AA: MOVWF 32
01AB: CALL 097
01AC: MOVLW 0A
01AD: MOVWF 04
01AE: MOVF 29,W
01AF: MOVWF 2B
01B0: MOVF 28,W
01B1: MOVWF 2A
01B2: CALL 0CA
01B3: MOVLW 20
01B4: MOVWF 32
01B5: CALL 097
01B6: MOVLW 20
01B7: MOVWF 32
01B8: CALL 097
.................... LCD_gotoxy(8-hodnota,1);
01B9: MOVF 28,W
01BA: SUBLW 08
01BB: MOVWF 2A
01BC: CLRF 2B
01BD: MOVF 29,W
01BE: BTFSS 03.0
01BF: INCFSZ 29,W
01C0: SUBWF 2B,F
01C1: MOVF 2A,W
01C2: MOVWF 33
01C3: MOVLW 01
01C4: MOVWF 34
01C5: CALL 086
.................... printf(lcd_putc,"*",hodnota);
01C6: MOVLW 2A
01C7: MOVWF 32
01C8: CALL 097
.................... offset = hodnota - stred;
0261: CLRF 23
0262: MOVF 28,W
0263: BTFSC 28.7
0264: DECF 23,F
0265: MOVWF 21
0266: MOVF 26,W
0267: SUBWF 21,W
0268: MOVWF 20
0269: MOVF 27,W
026A: BTFSS 03.0
026B: INCFSZ 27,W
026C: SUBWF 23,F
026D: MOVF 20,W
026E: MOVWF 2A
.................... offset = (offset >> 5) + 8;
026F: SWAPF 2A,W
0270: MOVWF 20
0271: RRF 20,F
0272: MOVLW 07
0273: ANDWF 20,F
0274: MOVF 20,W
0275: ADDLW 08
0276: MOVWF 2A
.................... }
.................... else
01C9: GOTO 1EF
0277: GOTO 28C
.................... {
.................... LCD_gotoxy(6,2);
01CA: MOVLW 06
01CB: MOVWF 33
01CC: MOVLW 02
01CD: MOVWF 34
01CE: CALL 086
.................... printf(lcd_putc," %03ld ",hodnota);
01CF: MOVLW 20
01D0: MOVWF 32
01D1: CALL 097
01D2: MOVLW 0A
01D3: MOVWF 04
01D4: MOVF 29,W
01D5: MOVWF 2B
01D6: MOVF 28,W
01D7: MOVWF 2A
01D8: CALL 0CA
01D9: MOVLW 20
01DA: MOVWF 32
01DB: CALL 097
01DC: MOVLW 20
01DD: MOVWF 32
01DE: CALL 097
.................... LCD_gotoxy(8-hodnota,1);
01DF: MOVF 28,W
01E0: SUBLW 08
01E1: MOVWF 2A
01E2: CLRF 2B
01E3: MOVF 29,W
01E4: BTFSS 03.0
01E5: INCFSZ 29,W
01E6: SUBWF 2B,F
01E7: MOVF 2A,W
01E8: MOVWF 33
01E9: MOVLW 01
01EA: MOVWF 34
01EB: CALL 086
.................... printf(lcd_putc,"*",hodnota);
01EC: MOVLW 2A
01ED: MOVWF 32
01EE: CALL 097
.................... offset = stred - hodnota;
0278: CLRF 23
0279: MOVF 28,W
027A: BTFSC 28.7
027B: DECF 23,F
027C: SUBWF 26,W
027D: MOVWF 20
027E: MOVF 23,W
027F: BTFSS 03.0
0280: INCFSZ 23,W
0281: GOTO 284
0282: MOVF 27,W
0283: GOTO 285
0284: SUBWF 27,W
0285: MOVWF 23
0286: MOVF 20,W
0287: MOVWF 2A
.................... offset = offset >> 5;
0288: SWAPF 2A,F
0289: RRF 2A,F
028A: MOVLW 07
028B: ANDWF 2A,F
.................... }
.................... LCD_gotoxy(offset,2);
028C: MOVF 2A,W
028D: MOVWF 36
028E: MOVLW 02
028F: MOVWF 37
0290: CALL 0C6
.................... printf(lcd_putc,"*");
0291: CLRF 2B
0292: MOVF 2B,W
0293: CALL 046
0294: IORLW 00
0295: BTFSC 03.2
0296: GOTO 29B
0297: INCF 2B,F
0298: MOVWF 35
0299: CALL 0D7
029A: GOTO 292
.................... }
01EF: GOTO 186
029B: GOTO 220
.................... }
....................
01F0: SLEEP
029C: SLEEP
 
Configuration Fuses:
Word 1: 3F39 XT NOWDT NOPUT NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG
/programy/PIC_C/mereni/gmetr/gmetr.PJT
10,7 → 10,7
LinkerScript=
 
[Target Data]
FileList=gmetr.c;
FileList=D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
31,8 → 31,11
0=0000 gmetr.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.c
1=D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c
2=C:\library\CCS\lcd.c
3=D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.h
4=C:\Program Files\PICC\devices\16F873.h
3=C:\Program Files\PICC\devices\16F873.h
4=
5=
[Units]
Count=1
1=D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c (main)
/programy/PIC_C/mereni/gmetr/gmetr.SYM
1,5 → 1,5
015 CCP_1_LOW
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
01B CCP_2_LOW
01B-01C CCP_2
12,47 → 12,57
024 @SCRATCH
025 @TRIS_C
026-027 main.stred
028-029 main.hodnota
02A lcd_init.i
02A-02B @PRINTF_LD_263.P1
02A main.@SCRATCH
02B lcd_init.@SCRATCH
028 main.hodnota
029 main.i
02A main.offset
02B lcd_init.i
02B main.@SCRATCH
02C @PRINTF_LD_263.@SCRATCH
02D @PRINTF_LD_263.@SCRATCH
02E @PRINTF_LD_263.@SCRATCH
02F @PRINTF_LD_263.@SCRATCH
030 @PRINTF_LD_263.@SCRATCH
031 @PRINTF_LD_263.@SCRATCH
032 lcd_putc.c
033 @delay_ms1.P1
033 lcd_gotoxy.x
034 lcd_gotoxy.y
035 lcd_gotoxy.Adr
036 lcd_gotoxy.@SCRATCH
037 lcd_send_byte.Adr
038 lcd_send_byte.n
039 lcd_send_nibble.n
03A lcd_send_nibble.@SCRATCH
03B lcd_send_nibble.@SCRATCH
02C lcd_init.@SCRATCH
02C main.@SCRATCH
02D-02E @PRINTF_LD_273.P1
02F @PRINTF_LD_273.@SCRATCH
030 @PRINTF_LD_273.@SCRATCH
031 @PRINTF_LD_273.@SCRATCH
032 @PRINTF_LD_273.@SCRATCH
033 @PRINTF_LD_273.@SCRATCH
034 @PRINTF_LD_273.@SCRATCH
035 lcd_putc.c
036 lcd_gotoxy.x
036 @delay_ms1.P1
037 lcd_gotoxy.y
038 lcd_gotoxy.Adr
039 lcd_gotoxy.@SCRATCH
03A lcd_send_byte.Adr
03B lcd_send_byte.n
03C lcd_send_nibble.n
03D lcd_send_nibble.@SCRATCH
03E lcd_send_nibble.@SCRATCH
 
000C @delay_ms1
0004 @const28
0021 lcd_send_nibble
0036 lcd_send_byte
004C lcd_init
0086 lcd_gotoxy
0097 lcd_putc
0134 main
00CA @PRINTF_LD_263
0134 @cinit
004C @delay_ms1
0004 @const35
0061 lcd_send_nibble
0076 lcd_send_byte
008C lcd_init
00C6 lcd_gotoxy
00D7 lcd_putc
010A lcd_clr
0184 main
000C @const10098
0021 @const10103
0034 @const10109
010E @PRINTF_LD_273
0046 @const10155
0184 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.c
D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.h
D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c
D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.h
C:\Program Files\PICC\devices\16F873.h
C:\library\CCS\lcd.c
 
Units:
D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c (main)
 
Compiler Settings:
Processor: PIC16F873
Pointer Size: 8
61,10 → 71,10
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.err
INHX8: D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.HEX
Symbols: D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.SYM
List: D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.LST
Debug/COFF: D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.cof
Call Tree: D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.tre
Statistics: D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.sta
Errors: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.err
INHX8: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.hex
Symbols: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.sym
List: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.lst
Debug/COFF: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.cof
Call Tree: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.tre
Statistics: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.sta
/programy/PIC_C/mereni/gmetr/gmetr.c
1,4 → 1,4
#include "D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.h"
#include ".\gmetr.h"
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
10,7 → 10,8
void main()
{
signed int16 stred;
signed int16 hodnota;
signed int8 hodnota;
unsigned int8 i, offset;
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_2);
22,28 → 23,43
lcd_init();
Delay_ms(100);
set_adc_channel(1);
 
LCD_gotoxy(1,1);
printf(lcd_putc,"Gmetr 0.1.2 Beta");
LCD_gotoxy(1,2);
printf(lcd_putc,"Kaklik@mlab.cz");
Delay_ms(500);
stred = read_adc();
LCD_clr();
LCD_gotoxy(1,1);
printf(lcd_putc,"Clibration...");
 
stred = 0;
for(i=0;i<=127;i++)
{
Delay_ms(10);
stred = stred + read_adc();
}
stred = stred >> 7;
 
while(true)
{
hodnota = stred - read_adc();
Delay_ms(100);
LCD_gotoxy(1,1);
printf(lcd_putc," ");
if (hodnota<0)
hodnota = read_adc();
Delay_ms(50);
LCD_clr();
LCD_gotoxy(6,1);
printf(lcd_putc," %03ld ",(stred - hodnota));
if (hodnota >= stred)
{
LCD_gotoxy(5,2);
printf(lcd_putc," %03ld ",hodnota);
LCD_gotoxy(8-hodnota,1);
printf(lcd_putc,"*",hodnota);
offset = hodnota - stred;
offset = (offset >> 5) + 8;
}
else
{
LCD_gotoxy(6,2);
printf(lcd_putc," %03ld ",hodnota);
LCD_gotoxy(8-hodnota,1);
printf(lcd_putc,"*",hodnota);
offset = stred - hodnota;
offset = offset >> 5;
}
LCD_gotoxy(offset,2);
printf(lcd_putc,"*");
}
}
/programy/PIC_C/mereni/gmetr/gmetr.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/programy/PIC_C/mereni/gmetr/gmetr.err
1,0 → 0,0
No Errors
0 Errors, 0 Warnings.
/programy/PIC_C/mereni/gmetr/gmetr.sta
1,37 → 1,42
 
ROM used: 497 (12%)
497 (12%) including unused fragments
ROM used: 669 (16%)
669 (16%) including unused fragments
 
1 Average locations per line
7 Average locations per statement
8 Average locations per statement
 
RAM used: 12 (6%) at main() level
28 (15%) worst case
RAM used: 13 (7%) at main() level
31 (16%) worst case
 
Lines Stmts % Files
----- ----- --- -----
50 28 37 D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.c
6 0 0 D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.h
240 0 0 C:\Program Files\PICC\devices\16F873.h
312 47 46 C:\library\CCS\lcd.c
66 39 45 D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c
6 0 0 D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.h
244 0 0 C:\Program Files\PICC\devices\16F873.h
312 47 38 C:\library\CCS\lcd.c
----- -----
1216 150 Total
1256 172 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 4 1 @delay_ms1
0 8 2 0 @const28
0 21 4 3 lcd_send_nibble
0 22 4 2 lcd_send_byte
0 58 12 2 lcd_init
0 21 3 1 @delay_ms1
0 8 1 0 @const35
0 21 3 3 lcd_send_nibble
0 22 3 2 lcd_send_byte
0 58 9 2 lcd_init
0 17 3 4 lcd_gotoxy
0 51 10 1 lcd_putc
0 189 38 6 main
0 106 21 8 @PRINTF_LD_263
0 51 8 1 lcd_putc
0 4 1 0 lcd_clr
0 281 42 7 main
0 21 3 0 @const10098
0 19 3 0 @const10103
0 18 3 0 @const10109
0 118 18 8 @PRINTF_LD_273
0 6 1 0 @const10155
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 493 1551
00004-007FF 665 1379
00800-00FFF 0 2048
 
/programy/PIC_C/mereni/gmetr/gmetr.tre
1,5 → 1,5
ÀÄgmetr
ÀÄmain 0/189 Ram=6
ÀÄmain 0/281 Ram=7
ÃÄ??0??
ÃÄlcd_init 0/58 Ram=2
³ ÃÄ@delay_ms1 0/21 Ram=1
6,18 → 6,17
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@const28 0/8 Ram=0
³ ÃÄ@const35 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_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 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
ÃÄ@const10098 0/21 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
41,6 → 40,7
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@const10103 0/19 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
60,45 → 60,8
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@PRINTF_LD_263 0/106 Ram=8
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄ@delay_ms1 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/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄ@delay_ms1 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_ms1 0/21 Ram=1
ÃÄlcd_clr 0/4 Ram=0
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
118,25 → 81,11
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 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_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
ÃÄ@const10109 0/18 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
156,11 → 105,10
³ ÀÄ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/51 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_clr 0/4 Ram=0
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
202,45 → 150,7
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@PRINTF_LD_263 0/106 Ram=8
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄ@delay_ms1 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/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄ@delay_ms1 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_LD_273 0/118 Ram=8
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
279,29 → 189,11
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 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
ÃÄ@const10155 0/6 Ram=0
ÀÄlcd_putc 0/51 Ram=1
ÃÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3