Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. int counter; // Timer value
  2. int value; // OUtput intensity
  3.  
  4. bool FastPWM()
  5. {
  6. int overflow = counter + value;
  7. counter = overflow & 0xFF;
  8. return overflow & 0x100;
  9. }
  10.  
  11. bool PhasePWM()
  12. {
  13. counter = (counter + 1) & 0xFF;
  14. return counter > value;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement