www.pudn.com > C8051F020ANDads1255.rar > Text1, change:2007-11-13,size:1599b


  	org 0000h 
 
	ORG 000BH 
	LJMP timer0  
	ORG 0023H	        	 
 
	LJMP COMM 
 
	ORG 0073H 
 
        LJMP T3INT 
 
	ORG 0100H 
;----------------------------------------- 
;      ADS1255读一个字节 
;P20:  	SCLK 
;P21: 	DIN 
;P23:	DOUT 
;P24:	DRDY 
;P25:	CS1255 
 
;-------------------------------------------- 
;          READ BYTE 
;CLK  上升沿有效 
;---------------------------------------------- 
/* 
RDRAS1255:  SETB SCLK 
            MOV R1,#08H 
RDAD1:      CLR SCLK 
	    NOP 
            NOP 
            MOV C,DOUT 
            NOP 
            NOP 
            RLC A 
            SETB SCLK 
            NOP 
	    NOP 
            NOP 
            DJNZ R1,RDAD1 
            MOV R7,A 
            MOV R6,#00H 
 
	    CLR SCLK 
            RET 
	    */ 
;---------------------------------------- 
;         WRITE ads1255 
;write ADS1255:   CLK  下降沿有效 
;DIN  :P2.1 
;SCLK :P2.0 
;---------------------------------------- 
WRADS1255C:mov a,BUF 
           mov R7,A 
WRADS1255: MOV A,R7 
           CLR DIN 
	   MOV R1,#08H 
           CLR CS1255 
WRADS1:	   SETB SCLK 
           RLC A 
           MOV DIN,C 
           NOP 
           NOP	    
           CLR SCLK     ;WRITE  
	   NOP 
           NOP 
           NOP 
           NOP 
      	   DJNZ R1,WRADS1 
	   SETB CS1255 
	   NOP           
           SETB SCLK 
 	   RET 
;---------------------------------------- 
;    Get ADS1255  
;read ADS1255  CLK  上升沿有效 
;write ADS1255 CLK  下降沿有效 
;CS:  P2.5 
;----------------------------------------- 
;    START ADS1255 
;---------------------------------------- 
STARTADS1255: