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:
Need help with analog conversion
Garren Davis
Thu, 6 Jan 2000 09:06:54 -0800


Hi:

I just started using ECS. I am in the process of switching from a 
home control program I wrote in BASIC to ECS and I'm having a 
problem with a routine to read analog inputs. The analog converter 
was built by me and I have included the routine I used in my BASIC 
program to read the analog inputs.

4280 FOR AN = 0 TO 7: REM Loop through 7 analog channels
4300 OUT 768, AN: REM Select analog channel number
4340 OUT 775, 0: REM Start conversion
4380 ANALOG(AN) = INP(&H307): REM Read converted value
4400 NEXT AN

Below is what I use in ECS to read the analog inputs. The problem I 
am having is that the value of Analog CH1 is always the same as the 
value of Analog CH2 when they are displayed in a Group window. Can 
someone tell me why the last value in the Event is the only one that 
is displayed properly and all the others are the same as the last. 


This is what I use in ECS. I have added Remarks to match what I did 
in my BASIC program

|Item:Analog CH1		Type:Number
Acc:User/User
|	Initial State:(none)					Backup:No
|Item:Analog CH2		Type:Number
Acc:User/User
|	Initial State:(none)					Backup:No
|Item:Sel Analog CH		Type:I/O-Port-Byte
Acc:User/User
|	Initial State:(none)					Backup:No
|	Port Address :768
|Item:Conv			Type:I/O-Port-Byte
Acc:User/User
|	Initial State:(none)					Backup:No
|	Port Address :775



|Event:	rd analogs			Called ?:No
|	Do	Sel Analog CH		Set		1 :REM Select analog
channel number 1
|	Do	Conv			Set		0 :REM Start
conversion
|	Do	Analog CH1		Set		Conv :REM Read
converted value
|
|	Do	Sel Analog CH		Set		2 :REM Select analog
channel number 2
|	Do	Conv			Set		0 :REM Start
conversion
|	Do	Analog CH2		Set		Conv :REM Read
converted value
|	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
.