??? 06/22/07 17:10 Read: times |
#141164 - No, just pots connected to inputs of 4051, my code Responding to: ???'s previous message |
This is the code I'm using, already rewrited it all over, cant find the problem, please, can correct it for me? Thanks.
TL EQU 07Ch ;Endereços das variaveis TH EQU 07Dh TS EQU 07Eh V0 EQU 07Fh V1 EQU 080h ;P3.4 <-->WR(to start convert analog - binary (0804)we must have WR 0->1) ;P3.5 <-->INTR (=0 to and convert) ;P3.3 <-->RD (RD 1->0 to read data from ADC) ;P2 <-->D0-D7 (out put) ;-----------------------------------------------------------; START: MOV PCON,#0 MOV TMOD,#00100010B ;Set Timer1 Mode for 8bit autoreload (T1M1=1) MOV TL1,#255 ;Set load/reload MOV TH1,#255 ; SETB TR1 MOV SCON,#01000010B MOV P2,#255 ; to receive data from ADC MOV P1,#00000000b ; Mux Input 0 READ0: MOV P1,#00000000b ; Mux Input 0 MOV TL,#255 MOV TH,#100 CALL DELAY CLR P3.4 ; WR =0 SETB P3.4 ; dat WR = 1 to start convert JB P3.5,$ ; wait to end convert CLR P3.3 ; end convert and allow read data from ADC MOV A,P2 ; read data onto A register MOV P0,A CLR C ; Adjust for midi send RRC A ; Adjust for midi send SETB P3.3 ; dat RD=1 for read next steps CJNE A,V0,DIFF0 JMP READ1 DIFF0: MOV V0,A JNB TI,$ ; If diff send midi CLR TI MOV SBUF,#0B0H ;Control Change Channel 0 JNB TI,$ CLR TI MOV SBUF,#47 ;Controller Number JNB TI,$ CLR TI MOV SBUF,V0 ;Controller Value JMP READ1 READ1: MOV P1,#00000001b ; Mux Input 1 MOV TL,#255 MOV TH,#100 CALL DELAY CLR P3.4 ; WR =0 SETB P3.4 ; dat WR = 1 to start convert JB P3.5,$ ; wait to end convert CLR P3.3 ; end convert and allow read data from ADC MOV A,P2 ; read data onto A register ;MOV P0,A CLR C ; Adjust for midi send RRC A ; Adjust for midi send SETB P3.3 ; dat RD=1 for read next steps CJNE A,V1,DIFF1 JMP READ0 DIFF1: MOV V1,A JNB TI,$ ; If diff send midi CLR TI MOV SBUF,#0B0H ;Control Change Channel 0 JNB TI,$ CLR TI MOV SBUF,#47 ;Controller Number JNB TI,$ CLR TI MOV SBUF,V1 ;Controller Value JMP READ0 ;------------------------------ Delay: DJNZ TL,$ MOV TL,#255 DJNZ TH,Delay ;MOV TH,#255 ;DJNZ TS,DTL RET END |
Topic | Author | Date |
ADC0804 and analog mux 4051 help | 01/01/70 00:00 | |
Source impedance driving the CD4051? | 01/01/70 00:00 | |
what is "Source impedance driving"? | 01/01/70 00:00 | |
Source impedance | 01/01/70 00:00 | |
RC | 01/01/70 00:00 | |
I'm using just 10K pots | 01/01/70 00:00 | |
I would wait 3.5µsec | 01/01/70 00:00 | |
Using a multiplexer | 01/01/70 00:00 | |
Crosstalk/Interacting is the problem, need help | 01/01/70 00:00 | |
Do you use buffers? | 01/01/70 00:00 | |
No, just pots connected to inputs of 4051, my code | 01/01/70 00:00 | |
Why add complexity? | 01/01/70 00:00 | |
To make it work??![]() | 01/01/70 00:00 |