;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; PowerIntegrator setup for Analog Probe
; 15 Jun 20 - Richard Woodruff - Setup for PI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; An AnalogProbe is plugged into slot A of the PowerIntegrator
;   V0 channel is hooked up
;   I0/I1 are hooked up

 do ~~/demo/powerintegrator/probeanalog/setupadc.cmm

; setup pod A ADC
 pod A                         ; display ADC for slot A
 pod.adc.a.v0 on               ; enable channel 0 voltage           
 pod.adc.a.v0.on 8/1           ; voltage channel 0 is enable
 pod.adc.a.i0 on 8/1 0.010     ; differential current with a .010 ohm shunt
 pod.adc.a.p0 on               ; enable power channel (math v0*i0)

 ;setup integrator control
 Integrator.state              ; display integrator controls 
 Integrator.ABCDEF.250MHZ      ; timing analysis, AP only needs 625KHz
 Integrator.OFF
 Integrator.AutoArm OFF        ; handle arm/disarm manually
 Integrator.AutoInit ON        ; make i-trace is clean
 Integrator.AutoArm ON         ; link to program exection on/off

 Trace.AutoInit ON             ; make p-trace is clean

 Integrator.List
 Integrator.Draw  

 ;GOSUB GETDATA()

 ;trace.save etm-data.ad
 ;Integrator.save ap-data.ad
 
enddo

GETDATA:
( 
 term.reset
 term.method com \\.\COM24 115200. 8 NONE 1STOP NONE
 term.size 80. 24. 500.
 term.mode vt100
 term.scroll on
 term
 wintop term

 term.out "./dhrystone 1000000000 &  ./dhrystone 1000000000 &"  ; setup to run dual test
 ;wait 1.s                                                      ; get to idle
 integrator.arm                                                 ; start adc sample
 term.out 0xd                                                   ; start test
 wait 500.mS                                                    ; capture start
 integrator.off                                                 ; stop sampling
 RETURN
)
