Mikroelektronika MIKROE-350 データシート

ページ / 526
value = 2048                   ' When program starts, DAC gives
'   the output in the mid-range
while (TRUE)                  ' Endless loop
if ((PINA0_bit) and (value < 4095)) then
' If PA0 button is
pressed
Inc(value)                '   increment value
else
if ((PINA1_bit) and (value > 0)) then
' If PA1 button is
pressed
Dec(value)             '   decrement value
end if
end if
DAC_Output(value)          ' Send value to DAC chip
Delay_ms(1)                ' Slow down key repeat pace
wend
end.
350
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6