need help

fisherman

New Member
:( I am trying to do a differential ttemp program for solar water collectors ( time is getting critical as temp drops)
I have a simple program using the readadc command but in order to use the readtemp required for the ds18b20 sensors I am missing something. When I try to use the generic input on the simulator it toggles both sensors, when I try to toggle a seperate variable it doesn't work.
I have tried changing the variables in case I am using the wrong inputs but need help asap please.
(code)
main: ;14m basic diff controller installed sept 6 09
readtemp 1 ,b0 ; outside sensor
readtemp 2 ,b1 ; inside sensor

b1= b1+4
if b0 >b1 then top
low 0
low 5
goto main

top:
high 0
goto main

bot:
low 0
goto main

(code)
hope I have done this right

tx
 

Andrew Cowan

Senior Member
:( I am trying to do a differential ttemp program for solar water collectors ( time is getting critical as temp drops)
I have a simple program using the readadc command but in order to use the readtemp required for the ds18b20 sensors I am missing something. When I try to use the generic input on the simulator it toggles both sensors, when I try to toggle a seperate variable it doesn't work.
I have tried changing the variables in case I am using the wrong inputs but need help asap please.
Code:
main:  ;14m  basic diff controller installed sept 6 09
readtemp 1 ,b0	; outside sensor
readtemp 2 ,b1	;  inside sensor

b1= b1+4
if b0 >b1 then top
low 0
low 5
goto main

top:
high 0
goto main

bot:
low 0
goto main
hope I have done this right

tx
The code needs to have /code at the end, and be in square (not curvy) brackets [].

Is the problem just when simulating? If so, why not put a pause between the readtemps so you can change the generic field? I may have misunderstood the problem, however...

It will also never get to subroutine bot - should it?

A
 
Last edited:

hippy

Ex-Staff (retired)
When I try to use the generic input on the simulator it toggles both sensors
That's the behaviour of the simulator and you cannot get round it. You have to step through your program and change the generic value before each READTEMP command.

Alternatively, replace one of the READTEMP commands with an assignment to a variable and allow the other to vary.

readtemp 1 ,b0 ; outside sensor
readtemp 2 ,b1 ; inside sensor

could, during testing, become

b0 = 45 ; outside sensor
readtemp 2 ,b1 ; inside sensor
 

fisherman

New Member
that helps

:) Ok that explains things and I can now step through the program to the end.

This is a very basic comparator and I have copied anothers program that averages 64 readings but also uses the readadc.
It works on the simulator but i have to change it over to the readtemp for the ds18b20 sensor.
I figured it best to step through the simple program first but got hung up trying to change the inputs for the readtemp.
The readadc is simpler to use!!!
Now that I have a program that works its time to download it into the 14m and connect the sensors.
I realize I am pushing the learning curve instead of going slowly but need a working program so I can get the pump and water system under control before we get more minus temps.

Thanks
 
Top