Analog Input Code Example - VersaLogic Python EBX-11 Reference Manual

Amd lx 800 based sbc with ethernet, video, audio, industrial i/o, and spi
Table of Contents

Advertisement

A
I
C
NALOG
NPUT
The following code example illustrates the procedure for reading an analog voltage from the
onboard ADC channel 3. A 32bit SPI frame is used to provide a valid single sample.
MOV
MOV
OUT
MOV
MOV
OUT
MOV
MOV
OUT
BUSY: MOV
IN
AND
JNZ
MOV
IN
For more detailed information on the EBX-11 A/D converter, please refer to the
Semiconductor ADC78H90
EBX-11 Reference manual
E
ODE
XAMPLE
DX, 1D8h
AL, 35h
;SPICONTROL: SPI Mode 00, 32bit, auto ADC_SS#
DX, AL
DX, 1D9h
AL, 30h
;SPISTATUS: 8MHz, no IRQ, left-shift
DX, AL
;SPIDATA2, SPIDATA1, SPIDATA0: don't care
DX, 1DDh
AL, 18h
;SPIDATA3: ADC78H90 AIN4 = EBX-11 ADCH3
DX, AL
DX, 1D9h
;Get SPISTATUS
AL, DX
AL, 01h
;Isolate the BUSY bit
BUSY
;Loop back if SPI transaction not complete
DX, 1DAh
;Point to SPIDATA0 register
AX, DX
;16bit input reads current conversion data
;from SPIDATA1 into AH and from SPIDATA0 into
;AL
Datasheet.
Interfaces and Connectors
National
50

Advertisement

Table of Contents
loading

Table of Contents