lpcware

Timer and interrupts

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Ferix on Thu Jul 28 10:54:38 MST 2011
Hello

I want to dim a lot of LED's using Bit Angle Modulation.
In the blinky example, the uC goes into sleep mode after executing its code and once every 10mS the timer "Interrupts" and the uC wakes up, executes the blinkaled code and goes back to sleep.
I want to do other stuff to while PWMing LED's so i don't want to have my uC sleeping all the time.
How do i modify my code to do this:


  [FONT=Courier New, monospace][SIZE=2][COLOR=#7f0055][B]#include[/B][/COLOR][COLOR=#2a00ff]"driver_config.h"[/COLOR][/SIZE][/FONT]
[FONT=Courier New, monospace][SIZE=2][COLOR=#7f0055][B]#include[/B][/COLOR][COLOR=#2a00ff]"target_config.h"[/COLOR][/SIZE][/FONT]
[FONT=Courier New, monospace][SIZE=2][COLOR=#7f0055][B]#include[/B][/COLOR][COLOR=#2a00ff]"timer32.h"[/COLOR][/SIZE][/FONT]
[FONT=Courier New, monospace][SIZE=2][COLOR=#7f0055][B]#include[/B][/COLOR][COLOR=#2a00ff]"gpio.h"[/COLOR][/SIZE][/FONT]


[FONT=Courier New, monospace][SIZE=2][COLOR=#7f0055][B]int [/B][/COLOR][COLOR=#000000][B]main[/B][/COLOR][COLOR=#000000] ([/COLOR][COLOR=#7f0055][B]void[/B][/COLOR][COLOR=#000000])[/COLOR][/SIZE][/FONT]
[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]{[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]init_timer32(1, TIME_INTERVAL);[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]enable_timer32(1);[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]GPIOInit();[/SIZE][/FONT][/COLOR]


[FONT=Courier New, monospace][SIZE=2][COLOR=#7f0055][B]while[/B][/COLOR][COLOR=#000000](1)[/COLOR][/SIZE][/FONT]
   [COLOR=#000000][FONT=Courier New, monospace][SIZE=2]{[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]    dostuffhere[/SIZE][/FONT][/COLOR]
   [COLOR=#000000][FONT=Courier New, monospace][SIZE=2]}[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]}[/SIZE][/FONT][/COLOR]


[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]Timerinterrupt()[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]{[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]    Code for PWMing LED's with Bit Angle Modulation[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New, monospace][SIZE=2]}[/SIZE][/FONT][/COLOR]
Its a bit of a beginners question but i hope you don't mind to help me out.

Outcomes