/Designs/Measuring_instruments/GM_counter/SW/HV_source/main.c
52,10 → 52,7
{
unsigned int16 setpoint=43;
unsigned int16 napeti;
unsigned int16 plneni=0;
unsigned int1 button_press; // semafor pro cteni tlacitek
unsigned int16 reg;
float given;
 
setup_adc_ports(sAN0|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_2);
63,13 → 60,15
setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DIV_BY_1,DIVISOR,1);
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);
set_pwm1_duty(HALFDUTY);
set_pwm2_duty(MAXDUTY);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
setup_oscillator(OSC_8MHZ);
 
set_pwm1_duty(0);
set_pwm2_duty(0);
// set_pwm1_duty(0);
// set_pwm2_duty(0);
 
output_high(LED1);
output_high(LED2);
88,35 → 87,28
lcd_putc("\f");
 
reg=400;
given=regreseM*reg+regreseN;
 
while(true)
{
set_adc_channel(1);
delay_us(100);
napeti = (napeti+read_adc())/2;
napeti = read_adc();
if(input(OUTPUT_ENABLE))
{
if (napeti <= setpoint)
{
if (plneni < 300) plneni++;
set_pwm2_duty((int16)255); // zapnuti menice
output_low(LED2);
}
else
else // vypnuti menice
{
if (plneni > 0) plneni--;
output_high(LED2);
set_pwm2_duty((int16)MAXDUTY);
output_high(LED2);
}
set_pwm1_duty(plneni);
set_pwm2_duty(1023-plneni);
 
}
else
{
set_pwm1_duty(1023);
set_pwm2_duty(0);
set_pwm2_duty((int16)MAXDUTY);
output_high(LED2);
}
lcd_gotoxy(1,1);
174,9 → 166,7
}
if ( input(S1) && input(S2) && input(S3) && input(S4) ) button_press=false;
 
output_toggle(LED1);
delay_ms(10);
}
 
}
/Designs/Measuring_instruments/GM_counter/SW/HV_source/main.hex
2,160 → 2,152
:1000100028340C3401340634482BD029B018410060
:10002000A026CC204217633D00010C00D332741D82
:100030002536751020100000C424D3204226452206
:100040000000323084008313000803193428023082
:100040000000303084008313000803193428023084
:10005000F800F701F70B2A28F80B29289730F7004A
:10006000F70B3028800B2728080039183928081288
:100070003A280816831608128312B91841288812E4
:1000800042288816831688128312391949280813C2
:100090004A280817831608138312B91951288813A0
:10006000F70B3028800B272808003718392808128A
:100070003A280816831608128312B71841288812E6
:1000800042288816831688128312371949280813C4
:100090004A280817831608138312B71951288813A2
:1000A00052288817831688130000831209148316B8
:1000B00009105A285B28831209108316091083122D
:1000C0000800BA018316081600308312081A01309E
:1000D000BA048316881600308312881A0130F7009C
:1000E0000310F70D7708BA0483160817003083123F
:1000C0000800B8018316081600308312081A0130A0
:1000D000B8048316881600308312881A0130F7009E
:1000E0000310F70D7708B804831608170030831241
:1000F000081B0130F700F70DF70DFC30F705770806
:10010000BA048316881700308312881B0130F70069
:10011000F70DF70DF70DF830F7057708BA043A0830
:10010000B8048316881700308312881B0130F7006B
:10011000F70DF70DF70DF830F7057708B804380834
:10012000F80008008316091089100911831289103C
:100130008316891008168816081788178312091560
:100140008316091100008312091483160910000098
:10015000831261207808B900091083160910000085
:10015000831261207808B700091083160910000087
:100160008312091483160910B528831261207808B8
:10017000B800091083160910081288120813881392
:100180008312390EF700F030F70577083804F800CD
:100190007808B800B81FCE2883169A28B608031D21
:10017000B600091083160910081288120813881394
:100180008312370EF700F030F70577083604F800D1
:100190007808B600B61FCE2883169A28B408031D27
:1001A000D3288910D428891483168910000083125B
:1001B0000911831609110000831209108316091012
:1001C0008312370EB8000F30B8053808B900352053
:1001D00037080F39B800B900352008008316081217
:1001C0008312350EB6000F30B6053608B70035205D
:1001D00035080F39B600B70035200800831608121D
:1001E00088120813881309108910091183128910C5
:1001F00083168910831209118316091183120910BD
:10020000831609100F308312B20021200130A8009C
:100210002808033C031C14290330B900352005309D
:10022000B2002120A80A08290230B9003520A8010F
:100230002808033C031C252928080420A900B6012E
:100240002908B7009220A80A18298A110A12552BEA
:10025000330B2B292E294030B4002F29B401013053
:100260003202B40734088038B500B6013508B7004B
:10027000922008003108073A031948290B3A03195C
:10020000831609100F308312B00021200130A600A0
:100210002608033C031C14290330B70035200530A1
:10022000B0002120A60A08290230B7003520A60117
:100230002608033C031C252926080420A700B40136
:100240002708B5009220A60A18298A110A125B2BEA
:10025000310B2B292E294030B2002F29B201013059
:100260003002B20732088038B300B4013308B50059
:10027000922008002F08073A031948290B3A03195E
:100280004D29063A03195529023A03195B296029B9
:100290000130B200B30028216629B6010130B70051
:1002A00092200230B200212066290130B2000230D3
:1002B000B30028216629B6011030B70092206629C4
:1002C0000130B6003108B700922066290800831675
:100290000130B000B10028216629B4010130B50059
:1002A00092200230B000212066290130B0000230D7
:1002B000B10028216629B4011030B50092206629CA
:1002C0000130B4002F08B50092206629080083167B
:1002D00003178C170C140000000083120C087F39E0
:1002E0000319AB290313A80003170D080313A90072
:1002F00003170F080313AA002808B1003A212908A0
:1003000003178D0003132A0803178F0083168C1719
:1002E0000319AB290313A60003170D080313A70076
:1002F00003170F080313A8002608AF003A212708A8
:1003000003178D000313280803178F0083168C171B
:100310000C140000000083120C0D0E0D7F39031920
:10032000AB290313A80003170D080313A900031733
:100330000F080313AA002808B1003A21290803175F
:100340008D0003132A0803178F008D0A03198F0AE3
:1003500003136729031703130800B0010408AF0053
:100360003010831B3014290EF038AB00AB07E23E8F
:10037000AC00323EAE0029080F39AC07AC07AE071F
:10038000E93EAD00AD07AD07280E0F39AD07AE074A
:10039000AD0DAE0DAE09AE0D28080F39AE07AB0D91
:1003A0000730AA000A30AE07AD03031CD329AD07FE
:1003B000AC03031CD729AC07AB03031CDB29AB0739
:1003C000AA03031CDF292A308400831307302F057A
:1003D0002F1384072E30040203192F170008F7008B
:1003E000031DFA292F1BFA292F1A0C2AAF19FA29F3
:1003F0002030FD29AF152F123030F707A90104086E
:10040000A8002910831B29147708B1003A21280875
:100410008400831329188317840A2F1FEA290800F0
:10032000AB290313A60003170D080313A700031737
:100330000F080313A8002608AF003A212708031767
:100340008D000313280803178F008D0A03198F0AE5
:1003500003136729031703130800AE010408AD0057
:100360002E10831B2E14270EF038A900A907E23E99
:10037000AA00323EAC0027080F39AA07AA07AC072B
:10038000E93EAB00AB07AB07260E0F39AB07AC0756
:10039000AB0DAC0DAC09AC0D26080F39AC07A90D9F
:1003A0000730A8000A30AC07AB03031CD329AB0706
:1003B000AA03031CD729AA07A903031CDB29A90741
:1003C000A803031CDF2928308400831307302D0580
:1003D0002D1384072C30040203192D170008F70091
:1003E000031DFA292D1BFA292D1A0C2AAD19FA29F9
:1003F0002030FD29AD152D123030F707A701040874
:10040000A6002710831B27147708AF003A2126087F
:100410008400831327188317840A2D1FEA290800F4
:10042000831603178C170C140000000003183F2AD2
:1004300083120C087F390313A90003170D08031357
:10044000AA0003170F080313AB002908B1003A21D3
:100450002A0803178D0003132B0803178F00831638
:100460008C170C140000000083120313A80B392A08
:1004300083120C087F390313A70003170D08031359
:10044000A80003170F080313A9002708AF003A21DB
:10045000280803178D000313290803178F0083163C
:100460008C170C140000000083120313A60B392A0A
:100470003C2A831603173F2A5E2A8316031783122A
:100480000C0D0E0D7F390313A90003170D0803137C
:10049000AA0003170F080313AB002908B1003A2183
:1004A0002A0803178D0003132B0803178F008D0AEA
:1004B00003198F0A03100313A80B102A8A110A12BA
:1004C000212C0830AF02031C712A2F3084008313C3
:100480000C0D0E0D7F390313A70003170D0803137E
:10049000A80003170F080313A9002708AF003A218B
:1004A000280803178D000313290803178F008D0AEE
:1004B00003198F0A03100313A60B102A8A110A12BC
:1004C000E52B0830AD02031C712A2D308400831304
:1004D0000310800C00080319712A6F2A0000800B9A
:1004E0006E2A0800AB012B082802031CBA2A8316C7
:1004F0000811043083128806AD010130AC002A08CF
:10050000AF002908AE00F801F901F701FA012F0840
:10051000031D8D2A2E080319A72A1030B0000310DE
:10052000AC0DAD0DF70DFA0D2F087A02031D9A2AB6
:100530002E087702031CA32A2E08F702031CFA03D5
:100540002F08FA020314F80DF90DB00B8F2A790861
:10055000AD007808AC002D08AE00AE0AAE0303195A
:10056000B52AFF30AF006122AE2A2C08AF0061220D
:10057000AB0A732A0800840183131F30830571308E
:1004E0006E2A0800A90129082602031CBA2A8316CD
:1004F0000811043083128806AB010130AA002808D5
:10050000AD002708AC00F801F901F701FA012D0848
:10051000031D8D2A2C080319A72A1030AE000310E2
:10052000AA0DAB0DF70DFA0D2D087A02031D9A2ABC
:100530002C087702031CA32A2C08F702031CFA03D9
:100540002D08FA020314F80DF90DAE0B8F2A790865
:10055000AB007808AA002B08AC00AC0AAC03031966
:10056000B52AFF30AD006122AE2A2A08AD00612213
:10057000A90A732A0800840183131F308305713090
:1005800083168F000F0806138312061783160317AE
:100590000908C039890003131F129F120030031786
:1005A00088008312870188018901FF300313A000AE
:1005B000A2012B30A100A601A5018316031709088B
:1005C000C039890003131F129F12013003178800DE
:1005D000831203131F139F1783169F1783121F1471
:1005E0009412A01220088316870083122016200878
:1005F000831687008312A01120088316870001301C
:10060000831294000030831694000108C7392838FB
:100610008100831290010030F80004389200FF300E
:1006200083169200831220112008831687008312FC
:100630000711831609130C308312970083169B0150
:100640009C0101309D008312A010200883168700B2
:10065000831287100C309D00013080000317870142
:10066000880189017130831603138F000F088312EC
:1006700095019B012013200883168700831207171A
:10068000A0122008831687008312871620122008E4
:100690008316870083120716831688118312881524
:1006A0008316081183120811EE280130B200B3003E
:1006B00028210C3003178D0000308F0003136721B1
:1006C0000130B2000230B3002821103003178D0032
:1006D00000308F00031367210430A800FA30B20005
:1006E0002120A80B6E2B153003178D0000308F00D2
:1006F000031367210430F8001F08C33978049F00F2
:100700004230F700F70B822B00009F149F18862BB6
:1007100083161E0883122307A8002408A9001E08B8
:1007200003181E0FA9070310290CA400280CA3000E
:10073000A0142008831687008312871CF92B240835
:100740002202031CBD2B031DA92B23082102031C1D
:10075000BD2B2608013C031CB62B031DB32B25081B
:100760002B3C031CB62BA50A0319A60AA0122008CD
:100770008316870083128712CD2BA508031DC32B78
:10078000A6080319C72B25080319A603A503A01261
:10079000200883168700831287162608F90025088B
:1007A000F800F90CF80CF90CF80CF90C7808950025
:1007B000F90C790C3039F7001708CF397704970016
:1007C0002508FF3CA8000330A9002608031C260FBB
:1007D000A902A90CA80CA90CA80CA90C28089B001C
:1007E000A90C290C3039F7001D08CF3977049D007A
:1007F000002CFF3095001708CF39303897009B0147
:100800000130B200B3002821013084002408A9007F
:100810002308A800AD210130B2000230B300282126
:10082000A0142008831687008312871C322C1630F0
:1008300003178D0000308F00031004300313A8004D
:10084000102A103084002208A9002108A800AD2138
:100850002030B1003A212030B1003A212030B100DF
:100860003A21392C1C3003178D0000308F00031300
:1008700067212718C12C83160614831206185E2CD4
:100880001430B200212083160614831206185E2C41
:1008900027146430A8000230AA00BC30A9007222DC
:1008A0002208033C031C5E2C031D5A2C2108F93C32
:1008B000031C5E2C0530A1070318A20A83168614B8
:1008C00083128618802C1430B200212083168614DF
:1008D00083128618802C27146430A8000230AA00E6
:1008E0005830A9007222A208031D7A2C2108053C69
:1008F0000318802C0530A1020030031C0130A20235
:100900008316081483120818A22C1430B200212078
:100910008316081483120818A22C27146430A80028
:100920000130AA00F430A90072222208033C031C03
:10093000A22C031D9F2C2108FE3C031CA22CA10A03
:100940000319A20A8316881483128818C12C143044
:10095000B20021208316881483128818C12C271412
:100960006430A8000130AA009030A9007222A108CA
:10097000031DBD2CA2080319C12C21080319A203D1
:10098000A103831606148312061CD52C8316861425
:100990008312861CD52C831608148312081CD52CB0
:1009A00083168814831288182710201320088316B2
:1009B00087004030831287060A30B20021207A2B4C
:0209C0006300D2
:1005B000A2012B30A100831603170908C039890056
:1005C00003131F129F1201300317880083120313B5
:1005D0001F139F1383169F1783121F149412A012C8
:1005E00020088316870083122016200883168700B0
:1005F0008312A01120088316870001308312940013
:100600000030831694000108C7392838810083120E
:1006100090010030F8000438920063308316920095
:100620008312201120088316870083120711831676
:1006300009130C308312970083169B019C01013033
:100640009D008312A0102008831687008312871054
:100650000C309D0001308000323095001708CF39F2
:10066000970064309B001D08CF399D000317870158
:10067000880189017130831603138F000F088312DC
:10068000201320088316870083120717A012200862
:10069000831687008312871620122008831687008E
:1006A0008312071683168811831288158316081182
:1006B00083120811EE280030F8001F08C3397804AF
:1006C0009F000130B000B10028210C3003178D00CD
:1006D00000308F00031367210130B0000230B100F9
:1006E0002821103003178D0000308F00031367217D
:1006F0000430A600FA30B0002120A60B7A2B15306A
:1007000003178D0000308F00031367219F149F187B
:10071000872B83161E088312A3001E08A400A014B2
:100720002008831687008312871CB92B2408220215
:10073000031CAD2B031DA02B23082102031CAD2B92
:100740003F309B001D08CF3930389D00A012200893
:100750008316870083128712B82B64309B001D0814
:10076000CF399D00A01220088316870083128716B8
:10077000C42B64309B001D08CF399D00A0122008B7
:1007800083168700831287160130B000B10028213C
:10079000013084002408A7002308A600AD21013001
:1007A000B0000230B1002821A01420088316870071
:1007B0008312871CF62B163003178D0000308F0034
:1007C000031004300313A600102A103084002208FE
:1007D000A7002108A600AD212030AF003A2120302B
:1007E000AF003A212030AF003A21FD2B1C30031717
:1007F0008D0000308F00031367212518852C831688
:10080000061483120618222C1430B00021208316FF
:10081000061483120618222C25146430A600023018
:10082000A800BC30A70072222208033C031C222C23
:10083000031D1E2C2108F93C031C222C0530A107A6
:100840000318A20A8316861483128618442C1430C7
:10085000B00021208316861483128618442C251498
:100860006430A6000230A8005830A7007222A20807
:10087000031D3E2C2108053C0318442C0530A10221
:100880000030031C0130A2028316081483120818DA
:10089000662C1430B0002120831608148312081827
:1008A000662C25146430A6000130A800F430A7009F
:1008B00072222208033C031C662C031D632C2108B2
:1008C000FE3C031C662CA10A0319A20A8316881495
:1008D00083128818852C1430B000212083168814C8
:1008E00083128818852C25146430A6000130A800D6
:1008F0009030A7007222A108031D812CA2080319C1
:10090000852C21080319A203A10383160614831260
:10091000061C992C831686148312861C992C831628
:1009200008148312081C992C8316881483128818C3
:100930002510201320088316870040308312870675
:04094000862B63009F
:04400E00F52CFF3F4F
:00000001FF
;PIC16F887
;CRC=1F67 CREATED="29-VI-13 14:59"
;CRC=7CE0 CREATED="23-IX-13 00:21"
/Designs/Measuring_instruments/GM_counter/SW/HV_source/main.pjt
23,7 → 23,7
5=
[Target Data]
OptionString=-p +FM
FileList=Z:\home\kaklik\MLAB\Designs\Measuring_instruments\GM_counter\SW\HV_source\main.c
FileList=Z:\home\kaklik\svnMLAB\Designs\Measuring_instruments\GM_counter\SW\HV_source\main.c
[Units]
Count=1
1=main (main)