
4Ć5
4.3.1 BASIC Task Example
This example will read an analog input from channel 0 once every
second and store the value in the symbol
CURRENT
VALUE%. The analog value will be digitized every .1
second.
1000 !
1002 ! common data declarations
1004 !
1005 COMMON ANALOG
INPUT 0% \!Data from channel 0
1010 COMMON CCLK
ENABLE 0@ \!Common clock enable Ć 0
1020 COMMON CCLK
ENABLE 1@ \!Common clock enable Ć 1
1030 COMMON UPDATE
TIME 0% \!Update period for channel 0
1040 COMMON INPUT
0 FILTER% \!Input filter for channel 0
1400 !
1450 ! local data declarations
1475 !
1500 LOCAL CURRENT
VALUE% \!Current value of analog input
1900 !
2000 INPUT
0 FILTER% = 2 \! 79 rad/sec crossover frequency
2010 UPDATE
TIME 0% = 200 \!.1 second conversion
2020 CCLK
ENABLE 0@ = TRUE \!Turn on the clock
2030 CCLK
ENABLE 1@ = TRUE \!Must turn on both outputs
2500 !
3000 ! Place any additional initialization statements here
4000 !
4001 ! The rest of the task is run every 1.0 seconds
4002 !
5000 START EVERY 1 SECONDS
5010 CURRENT
VALUE% = ANALOG INPUT 0%
1000 END
The symbolic names defined as COMMON" reference the inputs
defined in the configuration. The symbolic name CURRENT
VALUE%
is local to the BASIC task and does not have I/O associated with it.
Kommentare zu diesen Handbüchern