Comfort  Automation/ Security System Forums Home
Home Search search Menu menu Not logged in - Login | Register

Practical Temp Control Using SCS
 Moderated by: admin
 New Topic   Reply   Printer Friendly 
 Rate Topic 
AuthorPost
 Posted: Saturday Sep 1st, 2007 05:34 pm
   PM  Quote  Reply 
1st Post
garym999
Member


Joined: Saturday Aug 19th, 2006
Location: Oxford, United Kingdom
Posts: 214
Status: 
Offline

  back to top

Never been good at maffs :P and cannot see the answer for looking...

Trying to get Comfort to turn an output on or off based on the temperature of the SCSSensor and comparision to a counter containing the setpoint.

Obviously the counter can only contain a value of 0-255, no negative numbers.

So how do I work out wether to turn the output on or off, using if statements or subtracting counters?

 



 Posted: Saturday Jan 3rd, 2009 07:35 am
   PM  Quote  Reply 
2nd Post
admin
Administrator


Joined: Saturday Mar 3rd, 2007
Location: Singapore
Posts: 1200
Status: 
Offline

  back to top

Sorry we missed this question
16 months is still not that bad for an answer:D

This code is a suitable example

Get SensorRegister 8
Subtract Counter001
If LastActionValue <128 Then
    Do IR1Output1
End If

It compares sensor 8 with the value in  counter 1
If <128 (equivalent to > 0)  then it does something
Note that counter values 0 to 255. If a comparison result is negative the value in the counter is > 128
eg
Counter 1 =100
Counter 2 = 200
Counter 1 - Counter 2 gives a value in the counter of 100-200+256 = 156
This is because counters have positive values and dont directly support signed arithmetic

You can add the Else condition if the sensor is less than the counter value

Last edited on Friday Sep 16th, 2011 08:46 am by



 Current time is 08:03 pm
Top




UltraBB 1.172 Copyright © 2007-2014 Data 1 Systems