ECS-L Home Automation and Security Archives
  learn more | view messages for this month | NetBloc® | terms of use | search

Google
 


  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects

Subject:
From:
Date:
Re: [ECS] Serial-Byte
peter kraus
Tue, 25 May 1999 21:11:17 -0400

the device sends 8 lines containing the temperature at 8 locations. all in
ascii. the recieve and process portions are below. i convert temps to hai
stat temps as my house standard this allows some other stuff to occur. the
code was written over a year ago. probably not the best, but hey it works!

|Event: RST recieve                     Called ?:No
|       BEGINIF Temp port               Is Not          None
|
|       Do      temp count              Add             1
|
|       If      Temp port               Is              10
|       Then    RST recieved            Set             True
|       Then    temp count 2            Add             1
|
|       BEGINIF temp count 2            Is LT           9
|
|       If      temp count              Is              1
|       Then    rst 01                  Set             Temp port
|       If      temp count              Is              2
|       Then    rst 02                  Set             Temp port
|       If      temp count              Is              3
|       Then    rst 03                  Set             Temp port
|       If      temp count              Is              4
|       Then    rst 04                  Set             Temp port
|       If      temp count              Is              5
|       Then    rst 05                  Set             Temp port
|       If      temp count              Is              6
|       Then    rst 06                  Set             Temp port
|       If      temp count              Is              7
|       Then    rst 07                  Set             Temp port
|       If      temp count              Is              8
|       Then    rst 08                  Set             Temp port
|       If      temp count              Is              9
|       Then    rst 09                  Set             Temp port
|       If      temp count              Is              10
|       Then    rst 10                  Set             Temp port
|
|       ENDIF
|       ENDIF
|
|       End


|Event: RST process                     Called ?:No
| BEGINIF    RST recieved        Is         True
|
| If         rst 01              Is GT      47
| And        rst 01              Is LT      58
| Then       rst 01              Subtract   48
| If         rst 02              Is GT      47
| And        rst 02              Is LT      58
| Then       rst 02              Subtract   48
| If         rst 03              Is GT      47
| And        rst 03              Is LT      58
| Then       rst 03              Subtract   48
| If         rst 04              Is GT      47
| And        rst 04              Is LT      58
| Then       rst 04              Subtract   48
| If         rst 05              Is GT      47
| And        rst 05              Is LT      58
| Then       rst 05              Subtract   48
| If         rst 06              Is GT      47
| And        rst 06              Is LT      58
| Then       rst 06              Subtract   48
| If         rst 07              Is GT      47
| And        rst 07              Is LT      58
| Then       rst 07              Subtract   48
| If         rst 08              Is GT      47
| And        rst 08              Is LT      58
| Then       rst 08              Subtract   48
| If         rst 09              Is GT      47
| And        rst 09              Is LT      58
| Then       rst 09              Subtract   48
| If         rst 10              Is GT      47
| And        rst 10              Is LT      58
| Then       rst 10              Subtract   48
|
| Do         Number-B            Set        0
| If         rst 01              Is GE      0
| And        rst 01              Is LE      7
| And        rst 02              Is         32
| Then       Number-B            Set        1
| BEGINIF    Number-B            Is         1
|
| If         rst 01              Is Now     4
| Then       rst 51              Set        rst 01
| Then       rst 52              Set        rst 02
| Then       rst 53              Set        rst 03
| Then       rst 54              Set        rst 04
| Then       rst 55              Set        rst 05
| Then       rst 56              Set        rst 06
| Then       rst 57              Set        rst 07
| Then       rst 58              Set        rst 08
|
| Do         Number-A            Set        0
|
| If         rst 03              Is GE      0
| And        rst 03              Is LE      9
| then       Number-A            Add        rst 03
| then       Number-A            Multiply   10
|
| If         rst 04              Is GE      0
| And        rst 04              Is LE      9
| Then       Number-A            Add        rst 04
| Then       Number-A            Multiply   10
|
|
| If         rst 05              Is GE      0
| And        rst 05              Is LE      9
| Then       Number-A            Add        rst 05
| Then       Number-A            Multiply   10
|
| If         rst 06              Is GE      0
| And        rst 06              Is LE      9
| Then       Number-A            Add        rst 06
| If         rst 06              Is GE      0
| And        rst 06              Is LE      9
| And        rst 04              Is Not     46
| Then       Number-A            Multiply   10
|
| If         rst 07              Is GE      0
| And        rst 07              Is LE      9
| Then       Number-A            Add        rst 07
| If         rst 07              Is GE      0
| And        rst 07              Is LE      9
| And        rst 06              Is         46
| Then       Number-A            Multiply   10
|
| If         rst 08              Is GE      0
| And        rst 08              Is LE      9
| Then       Number-A            Add        rst 08
|
| Do         Number-C            Set        2000
| If         rst 03              Is         45
| Then       Number-C            Subtract   Number-A
| Else       Number-C            Add        Number-A
| Do         Number-A            Set        Number-C
|
|
| ENDIF
|
| If         rst 01              Is         0
| And        rst c1              Is         0
| Then       rst c1              Set        Number-A
| If         rst 01              Is         0
| And        rst c1              Is Not     0
| Then       rst c1              Add        Number-A
| Then       rst c1              Divide     2
| If         rst 01              Is         0
| Then       Number-A            Set        rst c1
|
| If         rst 01              Is         1
| And        rst c2              Is         0
| Then       rst c2              Set        Number-A
| If         rst 01              Is         1
| And        rst c2              Is Not     0
| Then       rst c2              Add        Number-A
| Then       rst c2              Divide     2
| If         rst 01              Is         1
| Then       Number-A            Set        rst c2
|
| If         rst 01              Is         2
| And        rst c3              Is         0
| Then       rst c3              Set        Number-A
| If         rst 01              Is         2
| And        rst c3              Is Not     0
| Then       rst c3              Add        Number-A
| Then       rst c3              Divide     2
| If         rst 01              Is         2
| Then       Number-A            Set        rst c3
|
| If         rst 01              Is         3
| And        rst c4              Is         0
| Then       rst c4              Set        Number-A
| If         rst 01              Is         3
| And        rst c4              Is Not     0
| Then       rst c4              Add        Number-A
| Then       rst c4              Divide     2
| If         rst 01              Is         3
| Then       Number-A            Set        rst c4
|
| If         rst 01              Is         4
| And        rst c5              Is         0
| then       rst c5              Set        Number-A
| If         rst 01              Is         4
| And        rst c5              Is Not     0
| Then       rst c5              Add        Number-A
| Then       rst c5              Divide     2
| If         rst 01              Is         4
| Then       Number-A            Set        rst c5
|
| If         rst 01              Is         5
| And        rst c6              Is         0
| Then       rst c6              Set        Number-A
| If         rst 01              Is         5
| And        rst c6              Is Not     0
| Then       rst c6              Add        Number-A
| Then       rst c6              Divide     2
| If         rst 01              Is         5
| Then       Number-A            Set        rst c6
|
| If         rst 01              Is         6
| And        rst c7              Is         0
| Then       rst c7              Set        Number-A
| If         rst 01              Is         6
| And        rst c7              Is Not     0
| Then       rst c7              Add        Number-A
| Then       rst c7              Divide     2
| If         rst 01              Is         6
| Then       Number-A            Set        rst c7
|
| If         rst 01              Is         7
| And        rst c8              Is         0
| Then       rst c8              Set        Number-A
| If         rst 01              Is         7
| And        rst c8              Is Not     0
| Then       rst c8              Add        Number-A
| Then       rst c8              Divide     2
| If         rst 01              Is         7
| Then       Number-A            Set        rst c8
|
| if         Number-A            Is GE      2000
| Then       Number-A            Subtract   2000
| Then       rst 03              Set        44
| Else If    Number-A            Is lt      2000
| Then       rst 03              Set        45
| then       Number-C            Set        2000
| then       Number-C            Subtract   Number-A
| then       Number-A            Set        Number-C
|
|
| Do         Number-A            Divide     5
| Do         Number-A            Multiply   9
| If         rst 03              Is         45
| Then       Number-B            Set        3205
| Then       Number-B            Subtract   Number-A
| Then       Number-A            Set        Number-B
| Else       Number-A            Add        3205
| Do         Number-A            Divide     10
|
| Do         Tenth-A             Set        Number-A
| Do         Tenth-A             Subtract   0.5
| Do         Tenth-A             Divide     0.9
|
| If         rst 01              Is         0
| Then       RST Office          Set        0.5
| Then       RST Office          Add        Tenth-A
| If         rst 01              Is         1
| Then       RST basement        Set        0.5
| Then       RST basement        Add        Tenth-A
| If         rst 01              Is         2
| Then       RST Attic           Set        0.5
| Then       RST Attic           Add        Tenth-A
| If         rst 01              Is         3
| Then       RST Outside         Set        0.5
| Then       RST Outside         Add        Tenth-A
| If         rst 01              Is         4
| Then       RST Port 5          Set        0.5
| Then       RST Port 5          Add        Tenth-A
| If         rst 01              Is         5
| Then       RST Port 6          Set        0.5
| Then       RST Port 6          Add        Tenth-A
| If         rst 01              Is         6
| Then       RST Port 7          Set        0.5
| Then       RST Port 7          Add        Tenth-A
| If         rst 01              Is         7
| Then       RST Port 8          Set        0.5
| Then       RST Port 8          Add        Tenth-A
|
| Do         temp count          Set        0
| Do         RST recieved        Set        False
|
| ENDIF
|
| End




  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects




Services provided by [NetBloc]®! NetBloc Solutions Inc.
Terms of use. Indexing software (c) 1999 Lin-De, Inc
.