Problems with R7F0C8051 using timer 1 channel to generate PWM signal[Copy link]
This post was last edited by Korol on 2018-10-10 17:13 As the title says: How to use a 1-channel 16-bit timer as two 8-bit timers to generate PWM signals? Please give me some advice! (Note: This chip itself has the function of outputting PWM signals, but if the two timers of channel 0 and channel 1 are used together, the timers will not be enough. The manual says that the 16-bit timer of channel 1 can be used as two 8-bit timers (high 8 bits and low 8 bits), but the actual signal output is always a square wave, and the frequency is wrong. I don't know what's going on.) The following are two timer interrupt service routines (the low 8 bits control the period, and the high 8 bits control the duty cycle): __interrupt static void r_tau0_channel1_interrupt(void) { P4.0 = 1U ; R_TAU0_Channel1_Higher8bits_Start() ; } __interrupt static void r_tau0_channel1_higher8bits_interrupt(void) { P4.0 = 0U ; R_TAU0_Channel1_Higher8bits_Stop() ; }