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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/11/07 09:08
Read: times


 
#140537 - Here is CKT & code
Responding to: ???'s previous message
Hi Steve,
I found out how to post pictures here.
But I paste the code first:



AD_MEAS: MOV A,CH_MEAS
ANL A,#03h
ANL P3,#11111100b
ORL P3,A
CALL ADSTRT
CLR A
JNB VA_SEL,VOLTS
MOV A,#01
VOLTS: CALL GETCNT
mov ADCNT,B
mov ADCNT+1,A
ret

;===========================
ADSTRT:
CLR Din
CLR sclk
CLR _CS
SETB Din
NOP
NOP
SETB sclk
NOP
NOP
CLR sclk
CLR Din
RET
;==============================
;GET ADCOUNTS: THIS REQUIRES CHANNEL # IN A 0= CH0 1= CH1
; CHANNEL WORD CH MSB ODD/SIGN SINGLE/DIFF ACTUAL WORD
; 0 1 0 1 0000 0101
; 1 1 1 1 0000 0111
;High 4bits in B and LOw 8bits in A

GETCNT: MOV DPTR,#CHWORD
MOVC A,@A+DPTR
MOV R0,#03h

NXTBIT: RRC A
MOV Din,C
NOP
SETB sclk
NOP
NOP
CLR sclk
DJNZ R0,NXTBIT

CLR A
MOV B,A
CLR C
SETB SCLK
MOV C,DOUT
JC ADERROR

MOV R1,#04H

NXTB2: CLR SCLK
NOP
NOP
SETB SCLK
MOV C,DOUT
RLC A
DJNZ R1,NXTB2
MOV B,A

CLR A
CLR C
MOV R1,#08H

NXTB8: CLR SCLK
NOP
NOP
SETB SCLK
MOV C,DOUT
RLC A
DJNZ R1,NXTB8

SETB DIN
SETB _CS
RET

ADERROR: MOV A,#00
MOV B,#00
SETB _CS
RET

;==================================================================



Hope you get it properly.
regards,
psdayama

List of 25 messages in thread
TopicAuthorDate
MCP3202 ADC problem            01/01/70 00:00      
   Circuit ?            01/01/70 00:00      
      MCP3202 ADC problem            01/01/70 00:00      
         Testing strategy recommendation            01/01/70 00:00      
            Prototype            01/01/70 00:00      
               Could you specify all parts of your circuit?            01/01/70 00:00      
               What is driving the inputs of CD4052?            01/01/70 00:00      
                  Diagram blues            01/01/70 00:00      
                     Why diode in /CS line of MCP3202?            01/01/70 00:00      
                     Voltage divider directly to input of CD4052?            01/01/70 00:00      
                     Pseudo-differential mode?            01/01/70 00:00      
                        Who cares for Psudo?            01/01/70 00:00      
                           You definitely need buffers at the inputs of ADC!            01/01/70 00:00      
                              No violations            01/01/70 00:00      
      Here is CKT & code            01/01/70 00:00      
         Uncommented, unformatted code :-(            01/01/70 00:00      
            connection to CH0 & CH1            01/01/70 00:00      
               Ckt Diagram            01/01/70 00:00      
            Commented code            01/01/70 00:00      
               Some changes needed            01/01/70 00:00      
                  Formatting Forward Slash - not Backslash!            01/01/70 00:00      
                  Setup problem            01/01/70 00:00      
               Togglings needed while /CS is high?            01/01/70 00:00      
                  toggling CLK doesnt help!            01/01/70 00:00      
      A picture is worth a 1000 words            01/01/70 00:00      

Back to Subject List