MPC2000 Reference Manual [JAPANESE] [ENGLISH]
yFunctionz   yAD_DAz
yUSEz
AD

A=AD(0)
IF AD(1,7)>500 THEN
PRX AD(-1)
yFORMATz yFUNCTIONz
AD(ch)
AD(fnc,ch)

Getting AD result
yEXPLANATIONz
ySampling 1msec intervalz

AD(ch) gives the value of the result of the AD conversion.
The ch (0 `7) means the channel number of the MPC-AD12.
MPC-AD12 updates the A/D data every 1msec automatically.

The return value is a 12bits integer and the 1 digit is 1mV when a AD7890-4(default) is mounted on MPC-AD12.
When the return value of AD(1) is 1000, it means the CH1 of the MPC-AD12 detects 1V.
When a AD7890-10(Optional) is mounted, you should add the statement : SET_AD AD7890_10. The return value will be in –2048 to +2047 and 2047 and the 1digit means 10000mv/2048=4.883mV.
When you need an average value for each channel, you should use AD(1.ch).
AD(1,ch) returns the average of the 8 data. MPC-AD12 is updating the average data every 8msec.
When you change the number of data that gives the average, you should refer to the SET_AD command.

yCapturing a CH in 1msec intervalz
MPC-AD12 can capture all the data every 1msec up to 832 counts.

Example
AD(2,ch) : Start capturing 832 results of conversion of CH ch at 1msec interval.
AD(4,ch) : Start capturing 832 results of conversion of CH ch at 2msec interval.
AD(3,ch): This function is halted when the capturing is on busy.
After the process is completed, the results can be accessed with AD_D(0,n) n:0`831.

yCapturing 8 CH in 1msec intervalz
AD(2,8) : Start capturing 104 of results of conversion of all the CH every 1msec.
AD(3,0): This function is suspended when the capturing process is on busy.

After the process is completed, the results can be accessed with AD_D(ch,n) n:0`103.




'1msec SAMPLING
SYCSCLK=0
FOR i=0 TO 1440 STEP 2
WAIT i==SYSCLK
X(i+1000)=AD(0)
NEXT

'Bulk Sampling
SYSCLK=0
dmy=AD(2,ch)
PRINT AD(3,ch) SYSCLK "1msec"
PRINT "dump"
FOR i=0 TO 800 STEP 50
PRINT i AD_D(0,i)
NEXT

'8CH Bulk sampling
dmy=AD(2,8)
PRINT AD(3,0) SYSCLK
FOR i=0 TO 100 STEP 10
PRINT i AD_D(0,i) AD_D(1,i) AD_D(2,i) AD_D(3,i)
NEXT
[LASTMODIFY]2024-05-16 14:12:52 [CREATEDATE]2008-12-15 17:18:45
MPC2000 Reference Manual -R5.11-   (C)2007 ACCEL Corp. all right reserved.