/Designs/Measuring_instruments/GM_counter/SW/HV_source/main.c
5,10 → 5,10
#define LED3 PIN_C4 //CHANGE PIN_XX TO YOUR LED PIN NUMBER
#define LED4 PIN_D3 //CHANGE PIN_XX TO YOUR LED PIN NUMBER
 
#define S1 PIN_B0 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5
#define S2 PIN_B1 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5
#define S3 PIN_D0 //CHANGE PIN_XX TO YOUR LED PIN NUMBER
#define S4 PIN_D1 //CHANGE PIN_XX TO YOUR LED PIN NUMBER
#define S1 PIN_B0 //Raw up
#define S2 PIN_B1 //Raw down
#define S3 PIN_D0 //Fine up
#define S4 PIN_D1 //Fine down
 
#define BEEP PIN_D2 //piezo beeper
 
21,6 → 21,8
#define LCD_DATA7 PIN_D7
#include <lcd.c>
 
#define OUTPUT_ENABLE PIN_C1
 
void sound_beep( unsigned int lenght, int16 frequency)
{
unsigned int i;
75,25 → 77,34
set_adc_channel(1);
delay_us(100);
napeti = (napeti+read_adc())/2;
 
if (napeti <= setpoint)
if(input(OUTPUT_ENABLE))
{
if (plneni < 300) plneni++;
output_low(LED2);
if (napeti <= setpoint)
{
if (plneni < 300) plneni++;
output_low(LED2);
}
else
{
if (plneni > 0) plneni--;
output_high(LED2);
}
set_pwm1_duty(plneni);
set_pwm2_duty(1023-plneni);
}
else
{
if (plneni > 0) plneni--;
output_high(LED2);
set_pwm1_duty(0);
set_pwm2_duty(1023);
}
set_pwm1_duty(plneni);
set_pwm2_duty(1023-plneni);
lcd_gotoxy(1,1);
printf(lcd_putc,"%lu",napeti);
printf(lcd_putc,"%4lu",napeti);
lcd_gotoxy(1,2);
printf(lcd_putc,"Set:%lu"setpoint);
 
if(input(OUTPUT_ENABLE))printf(lcd_putc,"Set:%lu "setpoint);
else printf(lcd_putc,"DISABLED");
 
if(button_press==false ) // tlacitka se ctou znovu pouze pokud v redchozim cyklu nebyla zmacknuta.
{
if(!input(S1))
/Designs/Measuring_instruments/GM_counter/SW/HV_source/main.hex
1,155 → 1,161
:1000000002308A00B42A00000A108A100A118207FE
:1000000002308A00BB2A00000A108A100A118207F7
:1000100028340C3401340634482BD029B018410060
:10002000A026CC204217633D00010C00D332741D82
:1000300025367500323084008313000803192D28FB
:100040000230F800F701F70B2328F80B222897302D
:10005000F700F70B2928800B2028080039183228D0
:10006000081233280816831608128312B9183A2882
:1000700088123B2888168316881283123919422861
:10008000081343280817831608138312B9194A283E
:1000900088134B28881783168813000083120914CD
:1000A0008316091053285428831209108316091047
:1000B00083120800BA018316081600308312081A4A
:1000C0000130BA048316881600308312881A013072
:1000D000F7000310F70D7708BA04831608170030ED
:1000E0008312081B0130F700F70DF70DFC30F70500
:1000F0007708BA048316881700308312881B0130F2
:10010000F700F70DF70DF70DF830F7057708BA048B
:100110003A08F800080083160910891009118312A3
:1001200089108316891008168816081788178312F5
:10013000091583160911000083120914831609108A
:10014000000083125A207808B9000910831609109C
:1001500000008312091483160910AE2883125A2056
:100160007808B800091083160910081288120813BD
:1001700088138312390EF700F030F705770838043A
:10018000F8007808B800B81FC72883169328B60867
:10019000031DCC288910CD288914831689100000EE
:1001A00083120911831609110000831209108316A6
:1001B00009108312370EB8000F30B8053808B9009F
:1001C0002E2037080F39B800B9002E2008008316FA
:1001D0000812881208138813091089100911831254
:1001E000891083168910831209118316091183124D
:1001F0000910831609100F308312B2001A20013043
:10020000A8002808033C031C0D290330B9002E2048
:100210000530B2001A20A80A01290230B9002E20A8
:10022000A8012808033C031C1E2928080420A90053
:10023000B6012908B7008B20A80A11298A110A12D1
:100240004E2B330B242927294030B4002829B40130
:1002500001303202B40734088038B500B6013508E1
:10026000B7008B2008003108073A031941290B3ADF
:1002700003194629063A03194E29023A031954294B
:1002800059290130B200B30021215F29B6010130A4
:10029000B7008B200230B2001A205F290130B20073
:1002A0000230B30021215F29B6011030B7008B2046
:1002B0005F290130B6003108B7008B205F290800A4
:1002C000831603178C170C140000000083120C080F
:1002D0007F390319A4290313A80003170D0803137A
:1002E000A90003170F080313AA002808B10033213F
:1002F000290803178D0003132A0803178F0083169C
:100300008C170C140000000083120C0D0E0D7F39A9
:100310000319A4290313A80003170D080313A90048
:1003200003170F080313AA002808B1003321290876
:1003300003178D0003132A0803178F008D0A031972
:100340008F0A03136029031703130800B001040880
:10035000AF003010831B3014290EF038AB00AB0710
:10036000E23EAC00323EAE0029080F39AC07AC07C4
:10037000AE07E93EAD00AD07AD07280E0F39AD075A
:10038000AE07AD0DAE0DAE09AE0D28080F39AE07A4
:10039000AB0D0730AA000A30AE07AD03031CCC2911
:1003A000AD07AC03031CD029AC07AB03031CD42955
:1003B000AB07AA03031CD8292A3084008313073013
:1003C0002F052F1384072E30040203192F1700085E
:1003D000F700031DF3292F1BF3292F1A052AAF1944
:1003E000F3292030F629AF152F123030F707A90175
:1003F0000408A8002910831B29147708B1003321B1
:1004000028088400831329188317840A2F1FE329DF
:100410000800831603178C170C1400000000031843
:10042000382A83120C087F390313A90003170D081B
:100430000313AA0003170F080313AB002908B10028
:1004400033212A0803178D0003132B0803178F008D
:1004500083168C170C140000000083120313A80BE2
:10046000322A352A83160317382A572A8316031788
:1004700083120C0D0E0D7F390313A90003170D080D
:100480000313AA0003170F080313AB002908B100D8
:1004900033212A0803178D0003132B0803178F003D
:1004A0008D0A03198F0A03100313A80B092A8A1156
:1004B0000A12042C0830AF02031C6A2A2F30840071
:1004C00083130310800C000803196A2A682A0000AD
:1004D000800B672A0800AB012B082802031CB32AF3
:1004E00083160811043083128806AD010130AC0078
:1004F0002A08AF002908AE00F801F901F701FA0156
:100500002F08031D862A2E080319A02A1030B000D8
:100510000310AC0DAD0DF70DFA0D2F087A02031D77
:10052000932A2E087702031C9C2A2E08F702031C2C
:10053000FA032F08FA020314F80DF90DB00B882AFC
:100540007908AD007808AC002D08AE00AE0AAE0305
:100550000319AE2AFF30AF005A22A72A2C08AF0099
:100560005A22AB0A6C2A0800840183131F308305CA
:10057000713083168F000F08061383120617831637
:1005800003170908C039890003131F129F12003096
:10059000031788008312870188018901FF30031344
:1005A000A000A2012B30A100A601A501831603170C
:1005B0000908C039890003131F129F120130031765
:1005C0008800831203131F139F1783169F1783122C
:1005D0001F149412A012200883168700831220167D
:1005E0002008831687008312A01120088316870035
:1005F0000130831294000030831694000108C7393B
:1006000028388100831290010030F80004389200ED
:10061000FF30831692008312201120088316870072
:1006200083120711831609130C3083129700831667
:100630009B019C0101309D008312A01020088316AD
:100640008700831287100C309D0001308000031753
:100650008701880189017130831603138F000F0809
:10066000831295019B0120132008831687008312B3
:100670000717A012200883168700831287162012FE
:1006800020088316870083120716831688118312A9
:1006900088158316081183120811E7280130B2006B
:1006A000B30021210C3003178D0000308F0003139D
:1006B00060210130B2000230B30021211030031755
:1006C0008D0000308F00031360210430A800FA3041
:1006D000B2001A20A80B672B153003178D000030CD
:1006E0008F00031360210430F8001F08C339780419
:1006F0009F004230F700F70B7B2B00009F149F18E0
:100700007F2B83161E0883122307A8002408A90044
:100710001E0803181E0FA9070310290CA400280C9B
:10072000A30024082202031CAF2B031D9B2B2308CC
:100730002102031CAF2B2608013C031CA82B031D20
:10074000A52B25082B3C031CA82BA50A0319A60AD8
:10075000A01220088316870083128712BF2BA508DA
:10076000031DB52BA6080319B92B25080319A603E9
:10077000A503A01220088316870083128716260877
:10078000F9002508F800F90CF80CF90CF80CF90C34
:1007900078089500F90C790C3039F7001708CF3933
:1007A000770497002508FF3CA8000330A90026081D
:1007B000031C260FA902A90CA80CA90CA80CA90CB3
:1007C00028089B00A90C290C3039F7001D08CF39E7
:1007D00077049D000130B200B30021211030840065
:1007E0002408A9002308A800A6210130B200023085
:1007F000B3002121163003178D0000308F00031045
:1008000004300313A800092A103084002208A9002C
:100810002108A800A6212718932C831606148312FA
:100820000618302C1430B2001A20831606148312D6
:100830000618302C27146430A8000230AA00BC30FF
:10084000A9006B222208033C031C302C031D2C2C16
:100850002108F93C031C302C0530A1070318A20A1B
:100860008316861483128618522C1430B2001A2074
:100870008316861483128618522C27146430A8001D
:100880000230AA005830A9006B22A208031D4C2C8C
:100890002108053C0318522C0530A1020030031C2E
:1008A0000130A2028316081483120818742C143025
:1008B000B2001A208316081483120818742C271407
:1008C0006430A8000130AA00F430A9006B2222088D
:1008D000033C031C742C031D712C2108FE3C031CDB
:1008E000742CA10A0319A20A83168814831288188B
:1008F000932C1430B2001A2083168814831288189F
:10090000932C27146430A8000130AA009030A9006D
:100910006B22A108031D8F2CA2080319932C210818
:100920000319A203A103831606148312061CA72C25
:10093000831686148312861CA72C83160814831230
:10094000081CA72C831688148312881827102013DC
:100950002008831687004030831287060A30B200D1
:060960001A20732B630056
:100030002536751020100000C424D3204226452206
:100040000000323084008313000803193428023082
:10005000F800F701F70B2A28F80B29289730F7004A
:10006000F70B3028800B2728080039183928081288
:100070003A280816831608128312B91841288812E4
:1000800042288816831688128312391949280813C2
:100090004A280817831608138312B91951288813A0
:1000A00052288817831688130000831209148316B8
:1000B00009105A285B28831209108316091083122D
:1000C0000800BA018316081600308312081A01309E
:1000D000BA048316881600308312881A0130F7009C
:1000E0000310F70D7708BA0483160817003083123F
:1000F000081B0130F700F70DF70DFC30F705770806
:10010000BA048316881700308312881B0130F70069
:10011000F70DF70DF70DF830F7057708BA043A0830
:10012000F80008008316091089100911831289103C
:100130008316891008168816081788178312091560
:100140008316091100008312091483160910000098
:10015000831261207808B900091083160910000085
:100160008312091483160910B528831261207808B8
:10017000B800091083160910081288120813881392
:100180008312390EF700F030F70577083804F800CD
:100190007808B800B81FCE2883169A28B608031D21
:1001A000D3288910D428891483168910000083125B
:1001B0000911831609110000831209108316091012
:1001C0008312370EB8000F30B8053808B900352053
:1001D00037080F39B800B900352008008316081217
:1001E00088120813881309108910091183128910C5
:1001F00083168910831209118316091183120910BD
:10020000831609100F308312B20021200130A8009C
:100210002808033C031C14290330B900352005309D
:10022000B2002120A80A08290230B9003520A8010F
:100230002808033C031C252928080420A900B6012E
:100240002908B7009220A80A18298A110A12552BEA
:10025000330B2B292E294030B4002F29B401013053
:100260003202B40734088038B500B6013508B7004B
:10027000922008003108073A031948290B3A03195C
:100280004D29063A03195529023A03195B296029B9
:100290000130B200B30028216629B6010130B70051
:1002A00092200230B200212066290130B2000230D3
:1002B000B30028216629B6011030B70092206629C4
:1002C0000130B6003108B700922066290800831675
:1002D00003178C170C140000000083120C087F39E0
:1002E0000319AB290313A80003170D080313A90072
:1002F00003170F080313AA002808B1003A212908A0
:1003000003178D0003132A0803178F0083168C1719
:100310000C140000000083120C0D0E0D7F39031920
:10032000AB290313A80003170D080313A900031733
:100330000F080313AA002808B1003A21290803175F
:100340008D0003132A0803178F008D0A03198F0AE3
:1003500003136729031703130800B0010408AF0053
:100360003010831B3014290EF038AB00AB07E23E8F
:10037000AC00323EAE0029080F39AC07AC07AE071F
:10038000E93EAD00AD07AD07280E0F39AD07AE074A
:10039000AD0DAE0DAE09AE0D28080F39AE07AB0D91
:1003A0000730AA000A30AE07AD03031CD329AD07FE
:1003B000AC03031CD729AC07AB03031CDB29AB0739
:1003C000AA03031CDF292A308400831307302F057A
:1003D0002F1384072E30040203192F170008F7008B
:1003E000031DFA292F1BFA292F1A0C2AAF19FA29F3
:1003F0002030FD29AF152F123030F707A90104086E
:10040000A8002910831B29147708B1003A21280875
:100410008400831329188317840A2F1FEA290800F0
:10042000831603178C170C140000000003183F2AD2
:1004300083120C087F390313A90003170D08031357
:10044000AA0003170F080313AB002908B1003A21D3
:100450002A0803178D0003132B0803178F00831638
:100460008C170C140000000083120313A80B392A08
:100470003C2A831603173F2A5E2A8316031783122A
:100480000C0D0E0D7F390313A90003170D0803137C
:10049000AA0003170F080313AB002908B1003A2183
:1004A0002A0803178D0003132B0803178F008D0AEA
:1004B00003198F0A03100313A80B102A8A110A12BA
:1004C000212C0830AF02031C712A2F3084008313C3
:1004D0000310800C00080319712A6F2A0000800B9A
:1004E0006E2A0800AB012B082802031CBA2A8316C7
:1004F0000811043083128806AD010130AC002A08CF
:10050000AF002908AE00F801F901F701FA012F0840
:10051000031D8D2A2E080319A72A1030B0000310DE
:10052000AC0DAD0DF70DFA0D2F087A02031D9A2AB6
:100530002E087702031CA32A2E08F702031CFA03D5
:100540002F08FA020314F80DF90DB00B8F2A790861
:10055000AD007808AC002D08AE00AE0AAE0303195A
:10056000B52AFF30AF006122AE2A2C08AF0061220D
:10057000AB0A732A0800840183131F30830571308E
: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
:1007F000002C9501FF309B001D08CF3930389D003B
: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
:04400E00F52CFF3F4F
:00000001FF
;PIC16F887
;CRC=39DC CREATED="23-V-13 16:45"
;CRC=52A4 CREATED="23-V-13 18:48"
/Designs/Measuring_instruments/GM_counter/SW/HV_source/main.pjt
17,7 → 17,7
0=0000 %S 0 0 796 451 3 0
[Opened Files]
1=main.c
2=main.h
2=
3=C:\Program Files (x86)\PICC\devices\16F887.h
4=C:\Program Files (x86)\PICC\drivers\lcd.c
5=