Whoops guess it didnt attach
Here's the code
'Our program for Space Heater
DEFINE OSC 8 'Sets to 8Mhz
DEFINE ADC_CLOCK 64 'Set clock source (rc=64) WHATS THIS MEAN
DEFINE ADC_BITS 10 'Set number of bits in result
DEFINE ADC_SAMPLEUS 50 'Sets sampling time to 50 microseconds
temp VAR WORD 'create temp to store result
buzzer VAR PORTA.1 'renames PortA.4 as buzzer
onswitch VAR PORTB.2 'renames the ports as switches
stepswitch VAR PORTB.3
OSCCON.4=1
OSCCON.5=1
OSCCON.6=1
cmcon.0=1
cmcon.1=1
cmcon.2=1
cvrcon.6=0
cvrcon.7=0
ansel= %0000001 'Turns on channel 0
TRISB=%00110000 'sets PortB.2,3 as inputs and rest outputs
TRISA=%00001000 'as of now setting PORTA.3 as input
ADCON1=%00001000 'Sets PORTA.3 as analog input (right justified?)
ADCIN 0, temp 'Read channel 0 to temp
Pause 500 'Wait .5 sec
loop:
While (onswitch=1) 'lights up "on" led
Gosub Fan
Wend
ADCIN 0, temp
serout PORTA.2,2,[$0C] 'clears screen
serout PORTA.2,2 ["The Temperature is"] 'sends the string The Temperature is
serout PORTA.2,2 [$FE,$C0] 'moves the cursor to second line
serout PORTA.2,2,[DEC temp] 'displays the decimal value of temp OR SHOULD USE #?
Pause 500 'pauses display for .5 sec
If (DEC temp<30) 'So if temp is less that 30C, the buzzer doesn't sound
Then buzzer=0
Else buzzer=1 'Once the temp is greater than 30C, the buzzer goes off indefinitley
Endif
While (stepswitch=1) 'lights up "stepper" led OR would IF statements be better?
Gosub Stepper
Wend
Goto loop 'does it forever
End
Fan:
High PORTB.4 'this port is the port that goes into transistor for motor circuit
return
Stepper:
'Wait till lab
return