hey guys,
Im working on this project for school where i'm using the "DS18B20" to record the temp and set the percentage of the fan speed(i'm using a 2 wire fan.) i have everything set up except for the PWM for the fan control. I was looking around and don't really understand how PWM works and what everything means. this is my code
This code here is to determine the temp of "DS18B20" is recording. can anyone help me with the PWM side of things ? I will be using pin C.1 for the "DS18B20" and pin B.2 for my fan.
Im working on this project for school where i'm using the "DS18B20" to record the temp and set the percentage of the fan speed(i'm using a 2 wire fan.) i have everything set up except for the PWM for the fan control. I was looking around and don't really understand how PWM works and what everything means. this is my code
Code:
symbol temp = b1
main:
;Read temp from DS18B20
readtemp C.1,temp
;Calc Values
let temp = temp - 128
;Start fan process
if temp >= 35 AND temp =< 39 then ThirtyFive
if temp =< 35 then goto main
if temp >= 40 AND temp =< 44 then Fourty
if temp =< 40 then goto main
if temp >= 45 AND temp =< 49 then FourtyFive
if temp =< 45 then goto main
if temp >= 50 AND temp =< 54 then Fifity
if temp =< 50 then goto main
if temp >= 55 AND temp =< 59 then FifityFive
if temp =< 55 then goto main
if temp >= 60 AND temp =< 64 then Sixty
if temp =< 60 then goto main
if temp >= 65 then SixtyFive
if temp =< 65 then goto main
goto main
ThirtyFive:
high b.0
wait 1
low b.0
goto main
Fourty:
high b.1
wait 1
low b.1
goto main
FourtyFive:
high b.2
wait 1
low b.2
goto main
Fifity:
high b.3
wait 1
low b.3
goto main
FifityFive:
high b.4
wait 1
low b.4
goto main
Sixty:
high b.5
wait 1
low b.5
goto main
SixtyFive:
high c.4
wait 1
low c.4
goto main