| ??? 03/12/08 07:28 Read: times |
#152146 - ADC Responding to: ???'s previous message |
hi,
i added comment to the code. Thanks and regards Muthu START:
ORG 2000H
LJMP MAIN
ORG 2003H ;A15-Enable the decoder and A0=1,A1=A2=A3=0;
MOV DPTR,#0001H ;convertion data is received from this address;
MOVX A,@DPTR
RETI
ORG 2030H
MAIN:
ACALL SERIAL
MOV IE,#10000001B ;external interrupt0
SETB TCON.0 ;edge triggered
HERE: MOV A,#07H ;select analog input8(A0=A1=A2=1)
MOV DPTR,#0001H
MOVX @DPTR,A ;Latch the input
ACALL HEXTODEC
ACALL DECTOASCII
SJMP HERE
SERIAL:
MOV TMOD,#20H
MOV TH1,#0F6H
MOV SCON,#50H
SETB TR1
RET
HEXTODEC: ;hex to decimal convertion
MOV R0,#40H
MOV B,#10
DIV AB
MOV @R0,B
INC R0
MOV B,#10
DIV AB
MOV @R0,B
INC R0
MOV @R0,A
RET ;decimal to ascii convertion
DECTOASCII:
MOV R0,#42H
MOV R1,#3
H1: MOV A,@R0
ORL A,#30H
ACALL TX
DEC R0
DJNZ R1,H1
RET
TX: CLR TI ;display the data on serialport
MOV SBUF,A
L5: JNB TI,L5
RET
END |
| Topic | Author | Date |
| ADC | 01/01/70 00:00 | |
| is there some monitor involved? | 01/01/70 00:00 | |
| Muthu, would you please be so kind... | 01/01/70 00:00 | |
| ADC | 01/01/70 00:00 | |
| Strange Hookup | 01/01/70 00:00 | |
| What, exactly, does this imply? | 01/01/70 00:00 | |
| it has hurt many to sit down after they ... | 01/01/70 00:00 | |
| ADC | 01/01/70 00:00 | |
compare your ADC timing with data sheet p4 | 01/01/70 00:00 |



