SHARE
TWEET

timer

a guest Jan 12th, 2017 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <targets\AT91SAM7.h>
  2.  
  3. int main(void)
  4. {
  5.  
  6. PMC_PCER=PMC_PCER_PIOB|PMC_PCER_TC0;
  7. PIOB_PER=PIOB_PER_P20;
  8. PIOB_OER=(1<<20);
  9.  
  10.  
  11. //ustawianie timera
  12. TC0_CCR=TC0_CCR_CLKDIS;
  13. TC0_IDR=0xFF;
  14. TC0_SR;
  15. TC0_CMR=(1<<2);
  16. TC0_CCR=TC0_CCR_CLKEN|TC0_CCR_SWTRG;
  17.  
  18. PIOB_OWER=PIOB_OWER_P20;
  19.  
  20. while(1)
  21. {
  22. if((TC0_SR&TC0_SR_COVFS)!=0){
  23. PIOB_ODSR^=(1<<20);
  24. }
  25. }
  26. }
RAW Paste Data
Top