Rev 3320 Rev 3321
Line 44... Line 44...
44   44  
45 #define k 0.333961 45 #define k 0.333961
46 #define q 206.952 46 #define q 206.952
47   47  
48   48  
49 unsigned int16 setpoint=43; 49 unsigned int16 setpoint;
50 unsigned int16 adc_value; 50 unsigned int16 adc_value;
51 int1 output_permit=FALSE; 51 int1 output_permit=FALSE;
52   52  
53 #INT_AD 53 #INT_AD
54 void adc_handler() { 54 void adc_handler() {
Line 118... Line 118...
118 set_pwm2_duty((int16)MAXDUTY); 118 set_pwm2_duty((int16)MAXDUTY);
119   119  
120 lcd_init(); 120 lcd_init();
121 set_adc_channel(0); 121 set_adc_channel(0);
122 122
-   123 setpoint =(int16) ((voltage_setpoint - q) / k);
-   124  
123 lcd_gotoxy(1,1); 125 lcd_gotoxy(1,1);
124 lcd_putc("HVPS01A"); 126 lcd_putc("HVPS01A");
125 lcd_gotoxy(1,2); 127 lcd_gotoxy(1,2);
126 lcd_putc(" MLAB.cz"); 128 lcd_putc(" MLAB.cz");
127 Delay_ms(1000); 129 Delay_ms(1000);
Line 142... Line 144...
142 else printf(lcd_putc,"---"); 144 else printf(lcd_putc,"---");
143 145
144   146  
145 lcd_gotoxy(1,2); 147 lcd_gotoxy(1,2);
146 voltage_setpoint = setpoint * k + q; 148 voltage_setpoint = setpoint * k + q;
147   -  
148 if(input(OUTPUT_ENABLE))printf(lcd_putc,"Set:%3.0f ", voltage_setpoint); // setpoint print 149 if(input(OUTPUT_ENABLE))printf(lcd_putc,"Set:%3.0f ", voltage_setpoint); // setpoint print
149 else printf(lcd_putc,"DISABLED"); 150 else printf(lcd_putc,"DISABLED");
150   151  
151 if(button_press==false ) // tlacitka se ctou znovu pouze pokud v redchozim cyklu nebyla zmacknuta. 152 if(button_press==false ) // tlacitka se ctou znovu pouze pokud v redchozim cyklu nebyla zmacknuta.
152 { 153 {
Line 203... Line 204...
203 } 204 }
204 205
205 if ( input(S1) && input(S2) && input(S3) && input(S4) ) button_press=false; 206 if ( input(S1) && input(S2) && input(S3) && input(S4) ) button_press=false;
206 output_toggle(LED1); 207 output_toggle(LED1);
207 } 208 }
208   -  
209 } 209 }