Line 58... |
Line 58... |
58 |
output_high(LED3); |
58 |
output_high(LED3); |
59 |
output_high(LED4); |
59 |
output_high(LED4); |
60 |
output_low(BEEP); |
60 |
output_low(BEEP); |
61 |
|
61 |
|
62 |
lcd_init(); |
62 |
lcd_init(); |
63 |
|
63 |
|
- |
|
64 |
lcd_gotoxy(1,1); |
64 |
lcd_putc("\fHVPS01A 2013 MLAB\n"); |
65 |
lcd_putc("HVPS01A"); |
- |
|
66 |
lcd_gotoxy(1,2); |
- |
|
67 |
lcd_putc(" MLAB.cz"); |
65 |
Delay_ms(1000); |
68 |
Delay_ms(1000); |
66 |
|
69 |
|
67 |
lcd_putc("\f"); |
70 |
lcd_putc("\f"); |
68 |
|
71 |
|
69 |
while(true) |
72 |
while(true) |
Line 85... |
Line 88... |
85 |
} |
88 |
} |
86 |
set_pwm1_duty(plneni); |
89 |
set_pwm1_duty(plneni); |
87 |
set_pwm2_duty(1023-plneni); |
90 |
set_pwm2_duty(1023-plneni); |
88 |
|
91 |
|
89 |
lcd_gotoxy(1,1); |
92 |
lcd_gotoxy(1,1); |
90 |
printf(lcd_putc,"Actual: %lu V ",napeti); |
93 |
printf(lcd_putc,"%lu",napeti); |
91 |
lcd_gotoxy(1,2); |
94 |
lcd_gotoxy(1,2); |
92 |
printf(lcd_putc,"Set: %lu V ",setpoint); |
95 |
printf(lcd_putc,"Set:%lu"setpoint); |
93 |
|
- |
|
94 |
|
96 |
|
95 |
if(button_press==false ) // tlacitka se ctou znovu pouze pokud v redchozim cyklu nebyla zmacknuta. |
97 |
if(button_press==false ) // tlacitka se ctou znovu pouze pokud v redchozim cyklu nebyla zmacknuta. |
96 |
{ |
98 |
{ |
97 |
if(!input(S1)) |
99 |
if(!input(S1)) |
98 |
{ |
100 |
{ |
99 |
delay_ms(20); |
101 |
delay_ms(20); |
100 |
if(!input(S1)) |
102 |
if(!input(S1)) |
101 |
{ |
103 |
{ |
102 |
button_press=true; |
104 |
button_press=true; |
103 |
sound_beep(100,700); |
105 |
sound_beep(100,700); |
104 |
if(setpoint < 0xfa )setpoint+=5; |
106 |
if(setpoint < (1023-5) )setpoint+=5; |
105 |
} |
107 |
} |
106 |
} |
108 |
} |
107 |
|
109 |
|
108 |
if(!input(S2)) |
110 |
if(!input(S2)) |
109 |
{ |
111 |
{ |
Line 121... |
Line 123... |
121 |
delay_ms(20); |
123 |
delay_ms(20); |
122 |
if(!input(S3)) |
124 |
if(!input(S3)) |
123 |
{ |
125 |
{ |
124 |
button_press=true; |
126 |
button_press=true; |
125 |
sound_beep(100,500); |
127 |
sound_beep(100,500); |
126 |
if(setpoint < 0xff )setpoint++; |
128 |
if(setpoint < 1023 )setpoint++; |
127 |
} |
129 |
} |
128 |
} |
130 |
} |
129 |
|
131 |
|
130 |
if(!input(S4)) |
132 |
if(!input(S4)) |
131 |
{ |
133 |
{ |