Datasheet

begin
InitMain(); // Perform main initialization
value := 2048; // When program starts, DAC gives
// the output in the mid-range
while (TRUE) do // Endless loop
begin
if ((PINA.B0) and (value < 4095)) then // If PA0 button
is pressed
Inc(value) // increment value
else
begin
if ((PINA.B1) and (value > 0)) then // If PA1 but-
ton is pressed
Dec(value); // decrement value
end;
DAC_Output(value); // Send value to DAC chip
Delay_ms(1); // Slow down key repeat pace
end;
end.
363
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6