|
发表于 2009-11-16 13:22:02
|
显示全部楼层
本人程序:
CLR AD_CS
LCALL INIT_SPI ;初始化,发15个FFH和1个FEH
CLR AD_CS
NOP
NOP
MOV A,#03H ;复位寄存器
LCALL Write8bit
MOV A,#20H
LCALL Write8bit
LCALL Write8bit
LCALL Write8bit
LCALL Write8bit
;MOV A,#03H ;写设置寄存器
;LCALL Write8bit
;MOV A,#20H
;LCALL Write8bit
;MOV A,#00H
;LCALL Write8bit
;MOV A,#00H
;LCALL Write8bit
;MOV A,#00H
;LCALL Write8bit
MOV A,#05H ;写通道寄存器
LCALL Write8bit
MOV A,#10H
LCALL Write8bit
MOV A,#80H
LCALL Write8bit
MOV A,#10H
LCALL Write8bit
MOV A,#80H
LCALL Write8bit
;MOV A,#01H ;写偏移寄存器
;LCALL Write8bit
;MOV A,#000H
;LCALL Write8bit
;MOV A,#000H
;LCALL Write8bit
;MOV A,#000H
;LCALL Write8bit
;MOV A,#000H
;LCALL Write8bit
;MOV A,#02H ;写增益寄存器
;LCALL Write8bit
;MOV A,#01H
;LCALL Write8bit
;MOV A,#00H
;LCALL Write8bit
;MOV A,#00H
;LCALL Write8bit
;MOV A,#00H
;LCALL Write8bit
MOV A,#0c0H ;发送连续转换命令
CLR AD_SDI
LCALL Write8bit
NNN: NOP
LOOP: ;LCALL DELAY1uS
JB AD_SDO,$ ;等待输出口变低
MOV A,#00H
LCALL Write8bit
MOV R0,#30H ;调用读取32位子程序
LCALL Read32bit
LCALL DELAY200MS
jmp loop
本人在用中,也有些许问题,愿意共同讨论的加我的qq 273045940 |
|