/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,7 → 77,8
set_adc_channel(1);
delay_us(100);
napeti = (napeti+read_adc())/2;
 
if(input(OUTPUT_ENABLE))
{
if (napeti <= setpoint)
{
if (plneni < 300) plneni++;
88,12 → 91,20
}
set_pwm1_duty(plneni);
set_pwm2_duty(1023-plneni);
}
else
{
set_pwm1_duty(0);
set_pwm2_duty(1023);
}
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))