Advertisement
masa-

F2806 Timer0 init

Jun 7th, 2011
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. CpuTimer0Regs.PRD.all = 2400;   // Period: 2400 = 5 kHz @ 12 MHz
  2. CpuTimer0Regs.TPR.bit.TDDR = 0; // Divide Down Register: 0 => prescaler = 1
  3. CpuTimer0Regs.TPRH.bit.TDDRH = 0;
  4. CpuTimer0Regs.TCR.bit.FREE = 0; // Halt at breakpoints
  5. CpuTimer0Regs.TCR.bit.SOFT = 0; // Stop after the nect timer cycle at breakpoints
  6. CpuTimer0Regs.TCR.bit.TIF = 1;  // Clear the interrupt flag
  7. CpuTimer0Regs.TCR.bit.TIE = 1;  // Enable interrupts
  8. CpuTimer0Regs.TCR.bit.TRB = 1;  // Reload the timer registers
  9. CpuTimer0Regs.TCR.bit.TSS = 0;  // Start/enable the timer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement