atomlcp
Newbie level 4
mcp3201 and 8051
I am facing a problem using the MCD3201 where the output hav an offset to the input. I am using 4.096Vref So far i had check with some reading adn the result are show as below:
INPUT OUTPUT
below 27mv same as input
40mV 41mV
50mV 52mV
60mV 63mV
70mV 74mV
85mV 89mV
100mV 105mV
120mV 126mv
500mV 531mV
1V 1.065V
1.2V 1.275V
2V 2.127
3V 3.19
I have place together with the code dor the MCP3201.
Please help. Desparate
below is the code using 8051
AD:
INIT_AD:
SETB CS
SETB DO
CLR CLK
CLR A
MOV ADH,#00
MOV ADL,#00
AD_START:
CLR CS
NOP
NOP
MOV TIME1,#5D ;300US
MOV TIME2,#6D
MOV TIME3,#6D
CALL DELAY_NS
AD_CON:
SETB CLK
NOP
NOP
CLR CLK
NOP
NOP
SETB CLK
NOP
NOP
CLR CLK
NOP
NOP
SETB CLK
NOP
NOP
CLR CLK
NOP
MOV COUNTER,#4D
AD_BIT_INH:
SETB CLK
NOP
MOV C,DO
RLC A
CLR CLK
DJNZ COUNTER,AD_BIT_INH
ANL A,#00001111B
MOV ADH,A
MOV COUNTER,#8D
AD_BIT_INL:
SETB CLK
NOP
MOV C,DO
RLC A
CLR CLK
DJNZ COUNTER,AD_BIT_INL
MOV ADL,A
SETB CS
NOP
NOP
NOP
MOV TIME1,#10D ;DELAY about 1mS
MOV TIME2,#10D
MOV TIME3,#10D
CALL DELAY_NS
RET
I am facing a problem using the MCD3201 where the output hav an offset to the input. I am using 4.096Vref So far i had check with some reading adn the result are show as below:
INPUT OUTPUT
below 27mv same as input
40mV 41mV
50mV 52mV
60mV 63mV
70mV 74mV
85mV 89mV
100mV 105mV
120mV 126mv
500mV 531mV
1V 1.065V
1.2V 1.275V
2V 2.127
3V 3.19
I have place together with the code dor the MCP3201.
Please help. Desparate
below is the code using 8051
AD:
INIT_AD:
SETB CS
SETB DO
CLR CLK
CLR A
MOV ADH,#00
MOV ADL,#00
AD_START:
CLR CS
NOP
NOP
MOV TIME1,#5D ;300US
MOV TIME2,#6D
MOV TIME3,#6D
CALL DELAY_NS
AD_CON:
SETB CLK
NOP
NOP
CLR CLK
NOP
NOP
SETB CLK
NOP
NOP
CLR CLK
NOP
NOP
SETB CLK
NOP
NOP
CLR CLK
NOP
MOV COUNTER,#4D
AD_BIT_INH:
SETB CLK
NOP
MOV C,DO
RLC A
CLR CLK
DJNZ COUNTER,AD_BIT_INH
ANL A,#00001111B
MOV ADH,A
MOV COUNTER,#8D
AD_BIT_INL:
SETB CLK
NOP
MOV C,DO
RLC A
CLR CLK
DJNZ COUNTER,AD_BIT_INL
MOV ADL,A
SETB CS
NOP
NOP
NOP
MOV TIME1,#10D ;DELAY about 1mS
MOV TIME2,#10D
MOV TIME3,#10D
CALL DELAY_NS
RET