Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/04/02 04:17
Read: times


 
#31950 - ADCs (max1112 and TI0838) Code check?
I've tried 3 chips, two max1112s and one TI0383. Same issue. Both are 8 channels, both "blur" the channel results. If I want to read channel 0, it will report the correct value. If I read channel 5, it will still give the channel 0 results. It might be my control byte I'm sending, but I'm not sure. I've written the code several times for each chip, nothing works. Can someone check my code, perhaps there is obvious things I've missed... I'm still new to ASM. The 8 bit value it reads is visually confirmed by being sent to P2 on the 8051, leds indicate the value. If someone can go over this with me in detail, please email me. This is a problem going on 4 or 5 months now.

$mod51

; MOV TO WHERE, VALUE

call time_delay_very_short
CLR P1.5

; P1.0 connects to SLK
; P1.1 connects to CS
; P1.4 connects to DIN
; P1.5 connects to DOUT


Sensor_0:

CLR P1.1
CALL Time_Delay_Very_Short
MOV A, #10001111b
MOV R6, #8

Sensor_0_loop:

RLC A
MOV P1.4, C
CALL Time_Delay_Very_Short
SETB P1.0
CALL Time_Delay_Very_Short
CLR P1.0
CALL Time_Delay_Very_Short

DJNZ R6, Sensor_0_loop

SETB P1.0
CALL Time_Delay_Very_Short
CLR P1.0
CALL Time_Delay_Very_Short
SETB P1.0
CALL Time_Delay_Very_Short
CLR P1.0
CALL Time_Delay_Very_Short

MOV R6, #8

Sensor_Input:

MOV C, P1.5
RLC A
SETB P1.0
CALL Time_Delay_Very_Short
CLR P1.0
CALL Time_Delay_Very_Short
DJNZ R6, Sensor_Input

MOV R6, #8

Extra_clocks:
MOV R6, 6
SETB P1.0
CALL Time_Delay_Very_Short
CLR P1.0
CALL Time_Delay_Very_Short
DJNZ R6, Extra_Clocks

SETB P1.1
CALL Time_Delay_Very_Short

MOV P2, A

jmp sensor_0

Time_Delay_Very_Short:

MOV R7, #50
Delay_Loop:
DJNZ R7, Delay_Loop


RET


End



List of 6 messages in thread
TopicAuthorDate
ADCs (max1112 and TI0838) Code check?            01/01/70 00:00      
RE: ADCs (max1112 and TI0838) Code check?            01/01/70 00:00      
RE: ADCs (max1112 and TI0838) Code check?            01/01/70 00:00      
RE: ADCs (max1112 and TI0838) Code check?            01/01/70 00:00      
RE: ADCs (max1112 and TI0838) Code check?            01/01/70 00:00      
RE: ADCs (max1112 and TI0838) Code check?            01/01/70 00:00      

Back to Subject List