使用过程中技术的记录学习
一、首先了解N2HET
The N2HET is an advanced intelligent timer that provides sophisticated timing functions for real-time applications. The timer is software-controlled, using a reduced instruction set, with a specialized timer micromachine and an attached I/O port. The N2HET can be used for pulse width modulated outputs, capture or compare inputs, or general-purpose I/O.. It is especially well suited for applications requiring multiple sensor information and drive actuators with complex and accurate time pulses。
1、第一步输出PWM波
使能外设
进行HAL的设置,我这随意选了一个NHET1的NHET116也就是定时器1的PIN16引脚
然后生成文件,初始化相关的配置
hetInit();
pwmSetDuty(hetRAM1,pwm4,20); //(也可以在这改变输出pwm的占空比)
pwmStart(hetRAM1,pwm4); //(开启pwm)
最后测试A4引脚,这个引脚就是NHET116也就是定时器1的PIN16引脚。可以看到产生了我们刚才设置的PWM,占空比20%,周期就是只有1000us,也就是1ms。误差是示波器的问题。