欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: ARDUINO PWM庫下載 [打印本頁]

作者: tyqr    時間: 2019-10-10 20:16
標題: ARDUINO PWM庫下載
ARDUINO PWM庫


單片機源程序如下:
  1. /*
  2. This library is built to support two of the AVR Architecture 'groups' that Arduino uses
  3. a) ATmega48/88/168/328,
  4. b) ATmega640/1280/1281/2560/2561
  5. */

  6. #ifndef PWM_H_
  7. #define PWM_H_

  8. #include "avr/pgmspace.h"
  9. #include "math.h"

  10. #if defined(__AVR_ATmega640__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
  11.         #include "utility/ATimerDefs.h"
  12. #elif defined(__AVR_ATmega48__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega88P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
  13.         #include "utility/BTimerDefs.h"
  14. #endif


  15. #if defined(__AVR_ATmega640__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
  16. // 16 bit timers
  17. extern uint32_t        GetFrequency_16(const int16_t timerOffset);
  18. extern bool                SetFrequency_16(const int16_t timerOffset, uint32_t f);
  19. extern uint16_t GetPrescaler_16(const int16_t timerOffset);
  20. extern void                SetPrescaler_16(const int16_t timerOffset, prescaler psc);
  21. extern void                SetTop_16(const int16_t timerOffset, uint16_t top);
  22. extern uint16_t GetTop_16(const int16_t timerOffset);
  23. extern void                Initialize_16(const int16_t timerOffset);
  24. extern float        GetResolution_16(const int16_t timerOffset);

  25. // 8 bit timers
  26. extern uint32_t        GetFrequency_8(const int16_t timerOffset);
  27. extern bool                SetFrequency_8(const int16_t timerOffset, uint32_t f);
  28. extern uint16_t GetPrescaler_8(const int16_t timerOffset);
  29. extern void                SetPrescaler_8(const int16_t timerOffset, prescaler psc);
  30. extern void                SetPrescalerAlt_8(const int16_t timerOffset, prescaler_alt psc);
  31. extern void                SetTop_8(const int16_t timerOffset, uint8_t top);
  32. extern uint8_t        GetTop_8(const int16_t timerOffset);
  33. extern void                Initialize_8(const int16_t timerOffset);
  34. extern float        GetResolution_8(const int16_t timerOffset);

  35. #endif

  36. #if defined(__AVR_ATmega48__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega88P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)

  37. // 16 bit timers
  38. extern uint32_t        GetFrequency_16();
  39. extern bool                SetFrequency_16(uint32_t f);
  40. extern uint16_t GetPrescaler_16();
  41. extern void                SetPrescaler_16(prescaler psc);
  42. extern void                SetTop_16(uint16_t top);
  43. extern uint16_t GetTop_16();
  44. extern void                Initialize_16();
  45. extern float        GetResolution_16();

  46. // 8 bit timers
  47. extern uint32_t        GetFrequency_8(const int16_t timerOffset);
  48. extern bool                SetFrequency_8(const int16_t timerOffset, uint32_t f);
  49. extern uint16_t GetPrescaler_8(const int16_t timerOffset);
  50. extern void                SetPrescaler_8(const int16_t timerOffset, prescaler psc);
  51. extern void                SetPrescalerAlt_8(const int16_t timerOffset, prescaler_alt psc);
  52. extern void                SetTop_8(const int16_t timerOffset, uint8_t top);
  53. extern uint8_t        GetTop_8(const int16_t timerOffset);
  54. extern void                Initialize_8(const int16_t timerOffset);
  55. extern float        GetResolution_8(const int16_t timerOffset);

  56. #endif

  57. //common functions

  58. extern void                InitTimers();
  59. extern void                InitTimersSafe();                                                                                //doesn't init timers responsible for time keeping functions
  60. extern void                pwmWrite(uint8_t pin, uint8_t val);
  61. extern void                pwmWriteHR(uint8_t pin, uint16_t val);                                        //accepts a 16 bit value and maps it down to the timer for maximum resolution
  62. extern bool                SetPinFrequency(int8_t pin, uint32_t frequency);
  63. extern bool                SetPinFrequencySafe(int8_t pin, uint32_t frequency);        //does not set timers responsible for time keeping functions
  64. extern float        GetPinResolution(uint8_t pin);                                                        //gets the PWM resolution of a pin in base 2, 0 is returned if the pin is not connected to a timer

  65. #endif /* PWM_H_ */
復制代碼

所有資料51hei提供下載:
pwm.zip (14.53 KB, 下載次數: 98)



作者: hezhumin    時間: 2019-12-14 00:36
謝謝分享
作者: kucy850710    時間: 2019-12-25 11:31
為樓主點贊,感謝技術大咖分析好資料!后續多多支持!!!




歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1