Subversion Repositories svnkaklik

Compare Revisions

Regard whitespace Rev 471 → Rev 472

/programy/C/PIC_C/mereni/teplomer/main.c
14,16 → 14,30
#include "1wire.c"
#include "ds1820.c"
 
void main()
{
long duty; // strida PWM
int temp; // zaokrouhlena teplota
 
#int_RTCC
RTCC_isr()
{
int znak; // zobrazovany znak
int i; // i pro for
int znak1; // hodnota jednotek
int znak2; // hodnota desitek
int znak; // zobrazovany znak
int i, n; // i pro for
 
 
 
setup_adc_ports(NO_ANALOGS|VSS_VDD); // parametry
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(False);
 
while(TRUE)
{
temp = ds1820_read();
if (temp<10)
{ //pro teploty 0-10°C
znak1=temp;
35,57 → 49,34
znak1=temp-znak2*10; //jednotky rozdil teploty a desitek
}
 
 
for (i=0;i<2;i++)
{ //cyklus zobrazeni udaje
if (i==0) {
output_low(LED_K2); //dva bloky pro sepnuti aktivniho segmentu na 1
output_high(LED_K1);
if (znak1==1) output_b(0b11110011); //blok if pro rozeznani zobrazeneho znaku
if (znak1==2) output_b(0b01001001);
if (znak1==3) output_b(0b01100001);
if (znak1==4) output_b(0b00110011);
if (znak1==5) output_b(0b00100101);
if (znak1==6) output_b(0b00000101);
if (znak1==7) output_b(0b11110001);
if (znak1==8) output_b(0b00000001);
if (znak1==9) output_b(0b00100001);
if (znak1==0) output_b(0b10000001);
znak=znak1;
}
if (i==1) {
output_low(LED_K1);
output_high(LED_K2);
if (znak2==1) output_b(0b11110011); //blok if pro rozeznani zobrazeneho znaku
if (znak2==2) output_b(0b01001001);
if (znak2==3) output_b(0b01100001);
if (znak2==4) output_b(0b00110011);
if (znak2==5) output_b(0b00100101);
if (znak2==6) output_b(0b00000101);
if (znak2==7) output_b(0b11110001);
if (znak2==8) output_b(0b00000001);
if (znak2==9) output_b(0b00100001);
if (znak2==0) output_b(0b10000001);
znak=znak2;
}
if (znak==1) output_b(0b11110011); //blok if pro rozeznani zobrazeneho znaku
if (znak==2) output_b(0b01001001);
if (znak==3) output_b(0b01100001);
if (znak==4) output_b(0b00110011);
if (znak==5) output_b(0b00100101);
if (znak==6) output_b(0b00000101);
if (znak==7) output_b(0b11110001);
if (znak==8) output_b(0b00000001);
if (znak==9) output_b(0b00100001);
if (znak==0) output_b(0b10000001);
Delay_ms(10);
}
 
void main()
{
long duty; // strida PWM
 
 
setup_adc_ports(NO_ANALOGS|VSS_VDD); // parametry
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(False);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);
 
while(TRUE)
{
temp = 19;
 
 
 
 
// duty=104+(2,31*temperature); // .000416/(16*(1/4000000)) ....PWM presne podle helpu
// set_pwm1_duty(duty);
}
/programy/C/PIC_C/mereni/teplomer/main.h
2,17 → 2,17
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC //Crystal osc <= 4mhz
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPUT //No Power Up Timer
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES MCLR //Master Clear pin enabled
#FUSES BROWNOUT //Reset when brownout detected
#FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES IESO //Internal External Switch Over mode enabled
 
#use delay(clock=8000000)
#use delay(clock=4000000)
 
/programy/C/PIC_C/mereni/teplomer/main.hex
1,53 → 1,76
:1000000000308A0049290000FF00030E8301A1008F
:100010007F08A0000A08A8008A01A00E0408A20018
:100020007708A3007808A4007908A5007A08A6003C
:100030007B08A700831383128B1E20280B193328FB
:10004000220884002308F7002408F8002508F90096
:100050002608FA002708FB0028088A00210E8300E2
:10006000FF0E7F0E09008A1171283108F801300255
:1000700003183D283008F7004928F7010830B2007E
:10008000B00DF70D310877020318F700F80DB20B29
:1000900040288A117E28F701F80130080310311832
:1000A000F707F70CF80CB118F707F70CF80C311933
:1000B000F707F70CF80CB119F707F70CF80C311A21
:1000C000F707F70CF80CB11AF707F70CF80C311B0F
:1000D000F707F70CF80CB11BF707F70CF80C8A11AF
:1000E00085282908093C031C79282908AE00AF019E
:1000F00088282908B0000A30B10035287808AF00F8
:100100002F08B0000A30B1004B2878082902AE0051
:100110008316851083128510831605118312051529
:100120002E0B972883168601F330831286002E0843
:10013000023C031DA02883168601493083128600E5
:100140002E08033C031DA928831686016130831203
:1001500086002E08043C031DB22883168601333026
:10016000831286002E08053C031DBB2883168601DA
:100170002530831286002E08063C031DC4288316F2
:1001800086010530831286002E08073C031DCD280A
:1001900083168601F130831286002E08083C031D69
:1001A000D628831686010130831286002E08093C6A
:1001B000031DDF2883168601213083128600AE08D6
:1001C000031DE7288316860181308312860083167B
:1001D00005118312051183168510831285142F0BC8
:1001E000F62883168601F330831286002F08023C1E
:1001F000031DFF28831686014930831286002F08CD
:10020000033C031D08298316860161308312860092
:100210002F08043C031D11298316860133308312F5
:1002200086002F08053C031D1A29831686012530F8
:10023000831286002F08063C031D2329831686019E
:100240000530831286002F08073C031D2C298316D6
:100250008601F130831286002F08083C031D3529E2
:10026000831686010130831286002F08093C031D86
:100270003E2983168601213083128600AF08031DB4
:100280004629831686018130831286000B118A115C
:10029000202884011F308305703083168F001F12C1
:1002A0009F121B0880399B0007309C001F129F1271
:1002B0001B0880399B0083121F10941283160611AD
:1002C00086140612003083129400831694000108ED
:1002D000C73908388100831290010030F80092007D
:1002E00000308316920007309C0005080630F700A6
:1002F000F70B782900001C0883120D1383169D014B
:100300008F010F0883128B16C0308B041330A900A5
:0403100086296300D7
:04400E00193FFC3F1B
:1000000000308A006D290000831685118312851146
:10001000A630F700F70B0A28000083168515A630D6
:10002000F700F70B11280000851583120034B30187
:100030003308073C031C372883168511831285116A
:10004000000000000314B20C031828288511292889
:100050008515831685111330F700F70B2D28000046
:1000600000008515000000008312B30A1828003430
:10007000B2013208073C031C5A28831685118312EB
:10008000851100000000831685150230F700F70B7C
:100090004728000085158312851950280310512820
:1000A0000314B30C2730F700F70B542800000000AE
:1000B000B20A39283308F80000343308350680398D
:1000C000B700B31F6828B209B309B20A0319B30A0B
:1000D000B51F6F28B409B509B40A0319B50AF801A8
:1000E000F901F701FA013508031D792834080319CD
:1000F00093281030B6000310B20DB30DF70DFA0DB2
:1001000035087A02031D862834087702031C8F28DD
:100110003408F702031CFA033508FA020314F80D39
:10012000F90DB60B7B280000B71F9B28F809F909C9
:10013000F80A0319F90A8A11E4288E30F700330807
:10014000F8003208F900FA01F808031DB12879080F
:10015000F800F9010830F702F808031DB128F7018B
:10016000B9280310F81BB828F90DF80DF703B128CA
:10017000F81300008A11E828A9010420CC30B2004D
:1001800017204430B2001720A908031DCB283820BF
:100190007808A900C4280420CC30B2001720BE3053
:1001A000B200172038207808AA0038207808AB0061
:1001B0002B08AD002A08AC002D08B3002C08B200B3
:1001C000B5011030B4005D287808B301B2009D2855
:1001D0007A08B1007908B0007808AF007708AE005F
:1001E0002E08F7002F08F8003008F9003108FA004F
:1001F0008A11A7298E30F7002908F7022A08F9008A
:100200002B08F800F917F708031911290310F9084A
:10021000031D0D29F80803191129F90CF80CF70B27
:100220000629AA1F1829F809F909F80A0319F90A71
:1002300000008A11B0292A08F8012902031823298D
:100240002908F7002F29F7010830AB00A90DF70D99
:100250002A0877020318F700F80DAB0B26298A113C
:10026000BF29F701F801290803102A18F707F70C2E
:10027000F80CAA18F707F70CF80C2A19F707F70C6F
:10028000F80CAA19F707F70CF80C2A1AF707F70C5D
:10029000F80CAA1AF707F70CF80C2A1BF707F70C4B
:1002A000F80CAA1BF707F70CF80C8A11C62929309D
:1002B0008400000803196B290130F800F701F70BDF
:1002C0005F29F80B5E294A30F700F70B652900001B
:1002D0000000800B5C298A11412A84011F308305AC
:1002E000603083168F001F129F121B0880399B00FD
:1002F00007309C001F129F121B0880399B0083123D
:100300001F109412831606118614061200308312F1
:100310009400831694000108C739083881008312BD
:1003200090010030F80092000030831692000730F0
:100330009C0005080330F700F70B9C291C0883126A
:100340000D1383169D018F010F088312BC287A08B4
:10035000AC007908AB007808AA007708A900FA2851
:100360007808A3002308093C031CBA292308A40029
:10037000A501C9292308A9000A30AA001B29780869
:10038000A5002508A9000A30AA003129780823020F
:10039000A400A7012708013C031C432AA708031D4A
:1003A000DB298316851083128510831605118312AD
:1003B00005152408A600270BE729831605118312CB
:1003C000051183168510831285142508A600260BB7
:1003D000EE2983168601F330831286002608023C3C
:1003E000031DF729831686014930831286002608EB
:1003F000033C031D002A83168601613083128600A8
:100400002608043C031D092A831686013330831213
:1004100086002608053C031D122A83168601253016
:10042000831286002608063C031D1B2A83168601BC
:100430000530831286002608073C031D242A8316F4
:100440008601F130831286002608083C031D2D2A00
:10045000831686010130831286002608093C031D9D
:10046000362A83168601213083128600A608031DD2
:100470003E2A831686018130831286000A30A90045
:0C0480005729A70ACA298316A529630082
:04400E00F83FFF3F39
:00000001FF
;PIC16F88
/programy/C/PIC_C/mereni/teplomer/main.sta
1,34 → 1,40
 
ROM used: 394 (10%)
394 (10%) including unused fragments
ROM used: 582 (14%)
582 (14%) including unused fragments
 
1 Average locations per line
4 Average locations per statement
7 Average locations per statement
 
RAM used: 17 (10%) at main() level
24 (14%) worst case
RAM used: 13 (7%) at main() level
28 (16%) worst case
 
Lines Stmts % Files
----- ----- --- -----
97 65 65 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.c
88 52 60 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.c
19 0 0 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.h
279 0 0 C:\Program Files\PICC\devices\16F88.h
49 22 13 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\1wire.c
29 13 7 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\ds1820.c
49 22 16 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\1wire.c
29 13 8 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\ds1820.c
----- -----
946 200 Total
928 174 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 216 55 4 RTCC_isr
0 22 6 3 @DIV88
0 38 10 2 @MUL88
0 65 16 2 main
0 22 4 1 @delay_ms1
0 19 3 0 onewire_reset
0 33 6 2 onewire_write
0 37 6 2 onewire_read
0 62 11 9 ds1820_read
0 64 11 6 @DIVS1616
0 31 5 2 @ITOF
0 217 37 8 main
0 33 6 4 @SFTOI
0 22 4 3 @DIV88
0 38 7 2 @MUL88
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-00034 49 0
00035-007FF 341 1654
00004-007FF 578 1466
00800-00FFF 0 2048
 
/programy/C/PIC_C/mereni/teplomer/main.sym
1,26 → 1,34
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
020 @INTERRUPT_AREA
021 @INTERRUPT_AREA
022 @INTERRUPT_AREA
023 @INTERRUPT_AREA
024 @INTERRUPT_AREA
025 @INTERRUPT_AREA
026 @INTERRUPT_AREA
027 @INTERRUPT_AREA
028 @INTERRUPT_AREA
029 temp
02A-02B main.duty
02C RTCC_isr.znak
02D RTCC_isr.i
02E RTCC_isr.znak1
02F RTCC_isr.znak2
030 @MUL88.P1
030 @DIV88.P2
031 @DIV88.P1
031 @MUL88.P2
032 @DIV88.@SCRATCH
021-022 main.duty
023 main.temp
024 main.znak1
025 main.znak2
026 main.znak
027 main.i
028 main.n
029 ds1820_read.busy
029 @DIV88.P1
029 @delay_ms1.P2
029 @MUL88.P3
029-02C @SFTOI.P4
02A @DIV88.P1
02A ds1820_read.temp1
02A @MUL88.P1
02B ds1820_read.temp2
02B @DIV88.@SCRATCH
02C-02D ds1820_read.temp3
02E-031 ds1820_read.result
032 onewire_read.count
032-033 @ITOF.P1
032-033 @DIVS1616.P2
032 onewire_write.data
033 onewire_write.count
033 onewire_read.data
034-035 @DIVS1616.P1
036 @DIVS1616.@SCRATCH
037 @DIVS1616.@SCRATCH
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
30,11 → 38,18
09C.6 C1OUT
09C.7 C2OUT
 
0071 RTCC_isr
0035 @DIV88
004B @MUL88
0149 main
0149 @cinit
0157 @delay_ms1
0004 onewire_reset
0017 onewire_write
0038 onewire_read
00BC ds1820_read
005D @DIVS1616
009D @ITOF
016D main
00FA @SFTOI
011B @DIV88
0131 @MUL88
016D @cinit
 
Project Files:
D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.c
/programy/C/PIC_C/mereni/teplomer/main.tre
1,6 → 1,19
ÀÄmain
ÃÄmain 0/65 Ram=2
³ ÀÄ??0??
ÀÄRTCC_isr 0/216 Ram=4
ÀÄmain 0/217 Ram=8
ÃÄ??0??
ÃÄds1820_read 0/62 Ram=9
³ ÃÄonewire_reset 0/19 Ram=0
³ ÃÄonewire_write 0/33 Ram=2
³ ÃÄonewire_write 0/33 Ram=2
³ ÃÄonewire_read 0/37 Ram=2
³ ÃÄonewire_reset 0/19 Ram=0
³ ÃÄonewire_write 0/33 Ram=2
³ ÃÄonewire_write 0/33 Ram=2
³ ÃÄonewire_read 0/37 Ram=2
³ ÃÄonewire_read 0/37 Ram=2
³ ÃÄ@DIVS1616 0/64 Ram=6
³ ÀÄ@ITOF 0/31 Ram=2
ÃÄ@SFTOI 0/33 Ram=4
ÃÄ@DIV88 0/22 Ram=3
ÀÄ@MUL88 0/38 Ram=2
ÃÄ@MUL88 0/38 Ram=2
ÀÄ@delay_ms1 0/22 Ram=1