Internet PLC Forum

General => Technical support => Topic started by: leo9 on July 25, 2003, 11:04:35 PM

Title: HVAC Control
Post by: leo9 on July 25, 2003, 11:04:35 PM
I have an SYNTAX ERROR in a dCusf HVAC control.
I have the tried your HVAC sample and have exactly the same problem. If you refer to the sample program the syntax error occurs at  CLRIO OUT1
IF S -T > 15
    SETIO OUT1
ELSE
    CLRIO OUT1  T < 1.5
Kindly advice
Title: Re: HVAC Control
Post by: BLF_Electronics on July 27, 2003, 07:18:29 PM
You have a couple of problems here. An ENDIF statement needs to be at the end of the logic. You need to add the OUT1 to the output labels and the T < 1.5 is not a complete statement. It needs changed or removed depending on what you need to do with it. I ran it like this with no syntax error. Hope this helps you.

IF (S-T) > 15
    SETIO OUT1
ELSE
    CLRIO OUT1
REM  T < 1.5
ENDIF
Title: Re: HVAC Control
Post by: leo9 on July 28, 2003, 12:26:57 AM
This is the program. I still have syntax errors. Kindly advise on this. Thank you. ???
S= ADC(5)*(500+500)/4096 -500
T= ADC(1)*(500+500)/4096 -500

S= -450
IF(S-T) > 1
   SETIO OUT3
ELSE
   CLRIO OUT3
REM T < 1
ENDIF

IF(S-T) > -1
   SETIO OUT4
ELSE
   CLRIO OUT4
REM T < -1  
ENDIF
Title: Re: HVAC Control
Post by: support on July 28, 2003, 11:13:54 AM
I tried compiling your program, first without defining the label for OUT3 and OUT4 and I got syntax error. After defining the label name for OUT3 and OUT4 in the output table then the program compiled without any problem.

Note that to use SETIO or CLRIO, the label name for the I/O bit that you want to set/clear must be defined in the table. OUT1 does not automatically means output #1. It is just a label name and can be any I/O bit (yes, it can also be a timer or counter bit! although there is little reason for doing so since it can confuse you).