Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
else
if (PINC.0 <> 0) then
// Detect if PORTC pin 0 is pressed
begin
Delay_ms(40); // Small delay to avoid deboucing effect
Inc(current_duty1);           // Increment duty ratio
PWM1_Set_Duty(current_duty1);  // Set incremented duty
end
else
if (PINC.1 <> 0) then // Detect if PORTC pin 1 is pressed
begin
Delay_ms(40);                   // Small delay to
avoid deboucing effect
Dec(current_duty1);         // Decrement duty ratio
PWM1_Set_Duty(current_duty1);   // Set decremented
duty ratio
end;
end;
end.
HW Connection
PWM demonstration
329
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6