#include "LPC8xx.h" #include "lpc8xx_clkconfig.h" #include "lpc8xx_gpio.h" #include "lpc8xx_mrt.h" extern uint32_t mrt_counter; #define freq (50) #define PWM (1000) /*main program*/ void setpwm(int pwncount, uint8_t percentage) { uint32_t value; if ((pwncount < 0) || (pwncount > 5)) { return; } if (percentage >= 100) { value = 1; } else if (percentage == 0) { value = cycle + 1; } int main(void) { uint8_t dutyCycle; int i, j, count = 1; GPIOSetDir( 0, 7, 1 ); GPIOSetDir( 0, 17, 1 ); dutyCycle = 50; setPWM(0, dutyCycle); setPWM(1, dutyCycle); setPWM(2, dutyCycle); while (1) { dutyCycle += count; if ((dutyCycle == 0) || (dutyCycle >= 100)) { count = -count; for (i = 0; i < 10; i++) { dutyCycle = 100 - dutyCycle; setPWM(0, dutyCycle); setPWM(1, dutyCycle); setPWM(2, dutyCycle); for (j = 0; j < ( freq / 1); j++) { } } } return 0; } delayMs(30); } |
Hi Team,
I can't get source code from above link, could you share the source code here?
Thanks,
Heru