/Designs/Measuring_instruments/GM_counter/SW/HV_source/main.c
34,6 → 34,35
 
#define MAX_OUTPUT 1000
 
unsigned int16 setpoint=43;
unsigned int16 adc_value;
int1 output_permit=FALSE;
 
#INT_AD
void adc_handler() {
 
adc_value = read_adc();
if(output_permit == TRUE)
{
if (adc_value <= setpoint)
{
set_pwm2_duty((int16)255); // zapnuti menice
output_low(LED2);
}
else // vypnuti menice
{
set_pwm2_duty((int16)MAXDUTY);
output_high(LED2);
}
 
}
else
{
set_pwm2_duty((int16)MAXDUTY);
output_high(LED2);
}
}
 
void sound_beep( unsigned int lenght, int16 frequency)
{
unsigned int i;
46,9 → 75,7
}
 
void main()
{
unsigned int16 setpoint=43;
unsigned int16 napeti;
{
unsigned int1 button_press; // semafor pro cteni tlacitek
 
setup_adc_ports(sAN0|VSS_VREF);
64,7 → 91,8
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
setup_oscillator(OSC_8MHZ);
 
// enable_interrupts(GLOBAL);
enable_interrupts(INT_AD);
enable_interrupts(GLOBAL);
 
output_high(LED1);
output_high(LED2);
83,33 → 111,15
lcd_putc("\f");
 
//read_adc(ADC_START_ONLY);
read_adc(ADC_START_ONLY);
while(true)
{
napeti = read_adc();
if(input(OUTPUT_ENABLE))
{
if (napeti <= setpoint)
{
set_pwm2_duty((int16)255); // zapnuti menice
output_low(LED2);
}
else // vypnuti menice
{
set_pwm2_duty((int16)MAXDUTY);
output_high(LED2);
}
 
}
else
{
set_pwm2_duty((int16)MAXDUTY);
output_high(LED2);
}
if(input(OUTPUT_ENABLE)) output_permit=TRUE;
else output_permit=FALSE;
lcd_gotoxy(1,1);
printf(lcd_putc,"%4lu",napeti);
printf(lcd_putc,"%4lu",adc_value);
lcd_gotoxy(1,2);
 
if(input(OUTPUT_ENABLE))printf(lcd_putc,"Set:%lu "setpoint);
/Designs/Measuring_instruments/GM_counter/SW/HV_source/main.hex
1,152 → 1,160
:1000000002308A00BB2A00000A108A100A118207F7
:1000100028340C3401340634482BD029B018410060
:10002000A026CC204217633D00010C00D332741D82
:100030002536751020100000C424D3204226452206
:100040000000303084008313000803193428023084
:10005000F800F701F70B2A28F80B29289730F7004A
:10006000F70B3028800B272808003718392808128A
:100070003A280816831608128312B71841288812E6
:1000800042288816831688128312371949280813C4
:100090004A280817831608138312B71951288813A2
:1000A00052288817831688130000831209148316B8
:1000B00009105A285B28831209108316091083122D
:1000C0000800B8018316081600308312081A0130A0
:1000D000B8048316881600308312881A0130F7009E
:1000E0000310F70D7708B804831608170030831241
:1000F000081B0130F700F70DF70DFC30F705770806
:10010000B8048316881700308312881B0130F7006B
:10011000F70DF70DF70DF830F7057708B804380834
:10012000F80008008316091089100911831289103C
:100130008316891008168816081788178312091560
:100140008316091100008312091483160910000098
:10015000831261207808B700091083160910000087
:100160008312091483160910B528831261207808B8
:10017000B600091083160910081288120813881394
:100180008312370EF700F030F70577083604F800D1
:100190007808B600B61FCE2883169A28B408031D27
:1001A000D3288910D428891483168910000083125B
:1001B0000911831609110000831209108316091012
:1001C0008312350EB6000F30B6053608B70035205D
:1001D00035080F39B600B70035200800831608121D
:1001E00088120813881309108910091183128910C5
:1001F00083168910831209118316091183120910BD
:10020000831609100F308312B00021200130A600A0
:100210002608033C031C14290330B70035200530A1
:10022000B0002120A60A08290230B7003520A60117
:100230002608033C031C252926080420A700B40136
:100240002708B5009220A60A18298A110A125B2BEA
:10025000310B2B292E294030B2002F29B201013059
:100260003002B20732088038B300B4013308B50059
:10027000922008002F08073A031948290B3A03195E
:100280004D29063A03195529023A03195B296029B9
:100290000130B000B10028216629B4010130B50059
:1002A00092200230B000212066290130B0000230D7
:1002B000B10028216629B4011030B50092206629CA
:1002C0000130B4002F08B50092206629080083167B
:1002D00003178C170C140000000083120C087F39E0
:1002E0000319AB290313A60003170D080313A70076
:1002F00003170F080313A8002608AF003A212708A8
:1003000003178D000313280803178F0083168C171B
:100310000C140000000083120C0D0E0D7F39031920
:10032000AB290313A60003170D080313A700031737
:100330000F080313A8002608AF003A212708031767
:100340008D000313280803178F008D0A03198F0AE5
:1003500003136729031703130800AE010408AD0057
:100360002E10831B2E14270EF038A900A907E23E99
:10037000AA00323EAC0027080F39AA07AA07AC072B
:10038000E93EAB00AB07AB07260E0F39AB07AC0756
:10039000AB0DAC0DAC09AC0D26080F39AC07A90D9F
:1003A0000730A8000A30AC07AB03031CD329AB0706
:1003B000AA03031CD729AA07A903031CDB29A90741
:1003C000A803031CDF2928308400831307302D0580
:1003D0002D1384072C30040203192D170008F70091
:1003E000031DFA292D1BFA292D1A0C2AAD19FA29F9
:1003F0002030FD29AD152D123030F707A701040874
:10040000A6002710831B27147708AF003A2126087F
:100410008400831327188317840A2D1FEA290800F4
:10042000831603178C170C140000000003183F2AD2
:1004300083120C087F390313A70003170D08031359
:10044000A80003170F080313A9002708AF003A21DB
:10045000280803178D000313290803178F0083163C
:100460008C170C140000000083120313A60B392A0A
:100470003C2A831603173F2A5E2A8316031783122A
:100480000C0D0E0D7F390313A70003170D0803137E
:10049000A80003170F080313A9002708AF003A218B
:1004A000280803178D000313290803178F008D0AEE
:1004B00003198F0A03100313A60B102A8A110A12BC
:1004C000E12B0830AD02031C712A2D308400831308
:1004D0000310800C00080319712A6F2A0000800B9A
:1004E0006E2A0800A90129082602031CBA2A8316CD
:1004F0000811043083128806AB010130AA002808D5
:10050000AD002708AC00F801F901F701FA012D0848
:10051000031D8D2A2C080319A72A1030AE000310E2
:10052000AA0DAB0DF70DFA0D2D087A02031D9A2ABC
:100530002C087702031CA32A2C08F702031CFA03D9
:100540002D08FA020314F80DF90DAE0B8F2A790865
:10055000AB007808AA002B08AC00AC0AAC03031966
:10056000B52AFF30AD006122AE2A2A08AD00612213
:10057000A90A732A0800840183131F308305713090
:1005800083168F000F0806138312061783160317AE
:100590000908C039890003131F129F120030031786
:1005A00088008312870188018901FF300313A000AE
:1005B000A2012B30A100831603170908C039890056
:1005C00003131F169F1201300317880083120313B1
:1005D0001F139F1783169F1783121F149412A012C4
:1005E00020088316870083122016200883168700B0
:1005F0008312A01120088316870001308312940013
:100600000030831694000108C7392838810083120E
:1006100090010030F8000438920063308316920095
:100620008312201120088316870083120711831676
:1006300009130C308312970083169B019C01013033
:100640009D008312A0102008831687008312871054
:100650000C309D0001308000323095001708CF39F2
:10066000970064309B001D08CF399D000317870158
:10067000880189017130831603138F000F088312DC
:10068000201320088316870083120717A012200862
:10069000831687008312871620122008831687008E
:1006A0008312071683168811831288158316081182
:1006B00083120811EE280030F8001F08C3397804AF
:1006C0009F000130B000B10028210C3003178D00CD
:1006D00000308F00031367210130B0000230B100F9
:1006E0002821103003178D0000308F00031367217D
:1006F0000430A600FA30B0002120A60B7A2B15306A
:1007000003178D0000308F00031367219F149F187B
:10071000872B83161E088312A3001E08A4008316CD
:1007200086168312861EB72B24082202031CAB2BCD
:10073000031D9E2B23082102031CAB2B3F309B0083
:100740001D08CF3930389D00A0122008831687007D
:1007500083128712B62B64309B001D08CF399D0091
:10076000A01220088316870083128716C22B6430DC
:100770009B001D08CF399D00A0122008831687001A
:10078000831287160130B000B100282101308400A7
:100790002408A7002308A600AD210130B0000230D4
:1007A000B1002821831686168312861EF22B16307E
:1007B00003178D0000308F00031004300313A600D0
:1007C000102A103084002208A7002108A600AD21BD
:1007D0002030AF003A212030AF003A212030AF0066
:1007E0003A21F92B1C3003178D0000308F000313C2
:1007F00067212518812C83160614831206181E2CD7
:100800001430B000212083160614831206181E2C03
:1008100025146430A6000230A800BC30A700722264
:100820002208033C031C1E2C031D1A2C2108E23C49
:10083000031C1E2C0530A1070318A20A8316861478
:1008400083128618402C1430B000212083168614A1
:1008500083128618402C25146430A6000230A800AC
:100860005830A7007222A208031D3A2C2108053C2B
:100870000318402C0530A1020030031C0130A202F5
:100880008316081483120818622C1430B00021203B
:100890008316081483120818622C25146430A600ED
:1008A0000130A800F430A70072222208033C031C88
:1008B000622C031D5F2C2108E73C031C622CA10A5B
:1008C0000319A20A8316881483128818812C143005
:1008D000B00021208316881483128818812C2514D7
:1008E0006430A6000130A8009030A7007222A10851
:1008F000031D7D2CA2080319812C21080319A203D2
:10090000A103831606148312061C952C83168614E5
:100910008312861C952C831608148312081C952CB0
:100920008316881483128818251020132008831634
:0C0930008700403083128706862B63008E
:1000000003308A00252B0000FF00030E8301A100AE
:100010000A08A0008A010408A2007708A300780853
:10002000A4007908A5007A08A600831383128C30F7
:100030008400001F1D280C1B2E2822088400230882
:10004000F7002408F8002508F9002608FA0020081F
:100050008A00210E8300FF0E7F0E09008A110A120A
:1000600039280A108A100A11820728340C34013406
:1000700006349F149F183A2883161E088312A9007D
:100080001E08AA002B1C67282A082802031C5B28CC
:10009000031D4E2829082702031C5B283F309B00C4
:1000A0001D08CF3930389D00AC122C08831687000C
:1000B00083128712662864309B001D08CF399D008B
:1000C000AC122C08831687008312871672286430BE
:1000D0009B001D08CF399D00AC122C0883168700A9
:1000E000831287160C138A110A121D28482BD02957
:1000F000B0184100A026CC204217633D00010C003F
:10010000D332741D2536751020100000C424D3206E
:10011000422645220000383084008313000803196A
:100120009E280230F800F701F70B9428F80B93286B
:100130009730F700F70B9A28800B912808003F189A
:10014000A3280812A4280816831608128312BF18C1
:10015000AB288812AC2888168316881283123F19A0
:10016000B3280813B4280817831608138312BF197D
:10017000BB288813BC2888178316881300008312B5
:10018000091483160910C428C52883120910831680
:10019000091083120800C00183160816003083126C
:1001A000081A0130C0048316881600308312881A9A
:1001B0000130F7000310F70D7708C0048316081705
:1001C00000308312081B0130F700F70DF70DFC30EB
:1001D000F7057708C0048316881700308312881B40
:1001E0000130F700F70DF70DF70DF830F705770838
:1001F000C0044008F800080083160910891009118E
:100200008312891083168910081688160817881714
:10021000831209158316091100008312091483162D
:10022000091000008312CB207808BF000910831644
:100230000910000083120914831609101F29831264
:10024000CB207808BE000910831609100812881206
:100250000813881383123F0EF700F030F705770874
:100260003E04F8007808BE00BE1F38298316042912
:10027000BC08031D3D2989103E2989148316891065
:10028000000083120911831609110000831209105E
:100290008316091083123D0EBE000F30BE053E08C6
:1002A000BF009F203D080F39BE00BF009F200800FF
:1002B000831608128812081388130910891009116F
:1002C000831289108316891083120911831609116C
:1002D00083120910831609100F308312B8008B2087
:1002E0000130AE002E08033C031C7E290330BF0002
:1002F0009F200530B8008B20AE0A72290230BF0063
:100300009F20AE012E08033C031C8F292E083120AC
:10031000AF00BC012F08BD00FC20AE0A82298A1163
:100320000A12C92B390B952998294030BA0099290E
:10033000BA0101303802BA073A088038BB00BC0164
:100340003B08BD00FC2008003708073A0319B22912
:100350000B3A0319B729063A0319BF29023A0319C0
:10036000C529CA290130B800B9009221D029BC01A1
:100370000130BD00FC200230B8008B20D0290130B4
:10038000B8000230B9009221D029BC011030BD0064
:10039000FC20D0290130BC003708BD00FC20D0294A
:1003A0000800831603178C170C140000000083123A
:1003B0000C087F390319152A0313AE0003170D0823
:1003C0000313AF0003170F080313B0002E08B70084
:1003D000A4212F0803178D000313300803178F0083
:1003E00083168C170C140000000083120C0D0E0DE8
:1003F0007F390319152A0313AE0003170D080313E1
:10040000AF0003170F080313B0002E08B700A42194
:100410002F0803178D000313300803178F008D0A70
:1004200003198F0A0313D129031703130800B60118
:100430000408B5003610831B36142F0EF038B100B7
:10044000B107E23EB200323EB4002F080F39B207C6
:10045000B207B407E93EB300B307B3072E0E0F3956
:10046000B307B407B30DB40DB409B40D2E080F399A
:10047000B407B10D0730B0000A30B407B303031C52
:100480003D2AB307B203031C412AB207B103031C80
:10049000452AB107B003031C492A30308400831376
:1004A0000730350535138407343004020319351736
:1004B0000008F700031D642A351B642A351A762AC2
:1004C000B519642A2030672AB51535123030F70780
:1004D000AF010408AE002F10831B2F147708B7005C
:1004E000A4212E08840083132F188317840A351F34
:1004F000542A0800831603178C170C140000000000
:100500000318A92A83120C087F390313AF000317BD
:100510000D080313B00003170F080313B1002F08D1
:10052000B700A421300803178D0003133108031707
:100530008F0083168C170C14000000008312031325
:10054000AE0BA32AA62A83160317A92AC82A831644
:10055000031783120C0D0E0D7F390313AF00031721
:100560000D080313B00003170F080313B1002F0881
:10057000B700A421300803178D00031331080317B7
:100580008F008D0A03198F0A03100313AE0B7A2A0A
:100590008A110A121C2C0830B502031CDB2A3530E4
:1005A000840083130310800C00080319DB2AD92A66
:1005B0000000800BD82A0800B10131082E02031C6C
:1005C000242B83160811043083128806B3010130EE
:1005D000B2003008B5002F08B400F801F901F701A6
:1005E000FA013508031DF72A34080319112B1030BE
:1005F000B6000310B20DB30DF70DFA0D35087A02EF
:10060000031D042B34087702031C0D2B3408F7025A
:10061000031CFA033508FA020314F80DF90DB60BA2
:10062000F92A7908B3007808B2003308B400B40A94
:10063000B40303191F2BFF30B500CB22182B32084F
:10064000B500CB22B10ADD2A0800840183131F30D4
:100650008305713083168F000F0806138312061767
:10066000A8012B30A7002B10831603170908C039E7
:10067000890003131F129F12003003178800831292
:10068000870188018901FF300313AC00831603172B
:100690000908C039890003131F169F120130031780
:1006A0008800831203131F139F1783169F1783124B
:1006B0001F149412AC122C088316870083122C1678
:1006C0002C08831687008312AC112C088316870030
:1006D0000130831294000030831694000108C7395A
:1006E00028388100831290010030F800043892000D
:1006F00063308316920083122C112C088316870016
:1007000083120711831609130C3083129700831686
:100710009B019C0101309D008312AC102C088316B4
:100720008700831287100C309D000130800032302A
:1007300095001708CF39970064309B001D08CF390A
:100740009D00031787018801890171308316031307
:100750008F000F080C17C03083128B042C132C0849
:100760008316870083120717AC122C0883168700A4
:10077000831287162C122C08831687008312071603
:1007800083168811831288158316081183120811A5
:1007900058290030F8001F08C33978049F00013041
:1007A000B800B9009221763003178D0000308F0019
:1007B0000313D1210130B8000230B90092217A3000
:1007C00003178D0000308F000313D1210430AE00D9
:1007D000FA30B8008B20AE0BE82B7F3003178D006A
:1007E00000308F000313D1219F14831686168312C5
:1007F000861EFC2B2B14FD2B2B100130B800B900EA
:100800009221013084002A08AF002908AE00172287
:100810000130B8000230B900922183168616831287
:10082000861E2D2C803003178D0000308F000310A2
:1008300004300313AE007A2A103084002808AF0079
:100840002708AE0017222030B700A4212030B700BF
:10085000A4212030B700A421342C863003178D004A
:1008600000308F000313D1212D18BC2C83160614E1
:1008700083120618592C1430B8008B2083160614E6
:1008800083120618592C2D146430AE000230B000CB
:10089000BC30AF00DC222808033C031C592C031D8C
:1008A000552C2708E23C031C592C0530A7070318D8
:1008B000A80A83168614831286187B2C1430B8007D
:1008C0008B2083168614831286187B2C2D1464309B
:1008D000AE000230B0005830AF00DC22A808031D83
:1008E000752C2708053C03187B2C0530A702003027
:1008F000031C0130A80283160814831208189D2CCB
:100900001430B8008B2083160814831208189D2C0D
:100910002D146430AE000130B000F430AF00DC22A2
:100920002808033C031C9D2C031D9A2C2708E73C38
:10093000031C9D2CA70A0319A80A83168814831286
:100940008818BC2C1430B8008B20831688148312AE
:100950008818BC2C2D146430AE000130B0009030EB
:10096000AF00DC22A708031DB82CA8080319BC2C73
:1009700027080319A803A703831606148312061C6D
:10098000D02C831686148312861CD02C8316081450
:100990008312081CD02C83168814831288182D10FB
:1009A0002C132C0883168700403083128706F52B02
:0209B0006300E2
:04400E00F52CFF3F4F
:00000001FF
;PIC16F887
;CRC=A673 CREATED="28-IX-13 12:57"
;CRC=9F80 CREATED="28-IX-13 13:24"