This service responds to functions calls from the fan motor state machine, interacting with the rotary potentiometer to convert the analog input signal into the correct PWM to output to the fan motor.
Pseudocode
Pseudo-code for the fan motor control module (a low level interface to interface between the analog potentiometer input and the digital fan motor PWM output)
FanInit
Initialize PE0 as the analog input pin for the potentiometer
Initialize PB4 as the PWM output
End of FanInit
Fan
Takes an input i that is either 1 or 0
If i is 1
Read the analog signal from the potentiometer pin
Set the PWM period
Calculate the pulse width based on the analog input
Set the PWM pulse width
Else If i is 0
Set the PWM period to 0
Set the PWM duty cycle to 0
End
End of Fan
FanInit
Initialize PE0 as the analog input pin for the potentiometer
Initialize PB4 as the PWM output
End of FanInit
Fan
Takes an input i that is either 1 or 0
If i is 1
Read the analog signal from the potentiometer pin
Set the PWM period
Calculate the pulse width based on the analog input
Set the PWM pulse width
Else If i is 0
Set the PWM period to 0
Set the PWM duty cycle to 0
End
End of Fan
Header
ES_Configure.h
Source Code
Download
fan.h | |
File Size: | 0 kb |
File Type: | h |
fan.c | |
File Size: | 2 kb |
File Type: | c |