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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/13/07 03:57
Read: times


 
#144532 - Cant solve, trouble midi controller with adc0804
Hello, I'm trying to build a midi controller, it is already working (in breadboard), but having much trouble with imprecision (values are not stable, keep changing). I'm next to give up, tried everything I know, which is not much so I asking (bothering) you to help me.

I tried to make a schematic (not good at this) so you can see what I done, I removed reset, power and some connections that will just keep schematics ugly, and its basic, its working so I think isnt them. I feeding all the circuit with 4 x 1.25v batteries (5v), all CD4051 IOs are connected to 10k pots, common output of CD4051 is connect to input of AD0804, midi output is connected to optocoupler, so, circuit is completly isolated.

Excuse me if I missed something (noob)




The code is very simple, it just reads ADC, verify if new value is different from old ram value, if yes, set ram value to new value and send midi data

WRA             EQU P3.4
INTR            EQU P3.5
RDA             EQU P3.3

TL              EQU 07Bh        ; Endereços das variaveis
TH              EQU 07Ch
TP              EQU 07Dh
V0              EQU 07Eh
V1              EQU 07Fh        ; DONT USE OVER THIS - SFR ADDRESS START


;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
        MOV R0,#080h
        MOV R2,#8
        MOV R3,#9
        
READ0:  CALL READ           ; Read ADC
        MOV P1,A
        CLR C               ; Midi adjust (MSB must be 0)
        RRC A               ; Midi adjust
        MOV TP,@R0
        CJNE A,TP,SEND0
        JMP INCI            ; EQUAL read next
SEND0:  MOV @R0,A
        CALL SEND
        
        
INCI:   MOV A,R3            ; INCREMENT FOR NEXT READ
        MOV R2,A            ; V
        MOV R0,A            ; V
        MOV A,#080h
        ORL A,R0
        MOV R0,A
        INC R3              ; V
        CJNE R3,#20,ISO     ; #N = NUMBER OF VALUES TO BE READ
        MOV R3,#8           ; V
ISO:    JMP READ0           ; START OVER




READ:   MOV P1,R2           ; Set mux Input
        MOV TL,#255
        MOV TH,#5
        CALL DELAY
        CLR WRA
        SETB WRA            ; dat WR = 1 to start convert
        JB INTR,$           ; wait to end convert 
        CLR RDA             ; end convert and allow read data from ADC
        MOV A,P2            ; read data onto A register
        MOV P1,R3           ; Set next input
        SETB RDA
        ;MOV P1,R3
        RET
        
SEND:   JNB TI,$            ; If diff send midi
        CLR TI
        MOV SBUF,#0B0H      ;Control Change Channel 0
        JNB TI,$
        CLR TI
        MOV SBUF,R2         ;Controller Number
        JNB TI,$
        CLR TI
        MOV SBUF,A          ;Controller Value
        RET
        
        




;------------------------------
Delay:  DJNZ TL,$
        MOV TL,#255
        DJNZ TH,Delay
        ;MOV TH,#255
        ;DJNZ TS,DTL
        RET


END



Thanks in advance (and for you patience).

List of 65 messages in thread
TopicAuthorDate
Cant solve, trouble midi controller with adc0804            01/01/70 00:00      
   Some suggestions            01/01/70 00:00      
      Average read            01/01/70 00:00      
   Breadboard ?            01/01/70 00:00      
   Getting rid of the flutter            01/01/70 00:00      
      Averaging            01/01/70 00:00      
         Trying to understand            01/01/70 00:00      
            |Caps            01/01/70 00:00      
            Re: Trying to understand            01/01/70 00:00      
            everything there applies and is exasperated ...            01/01/70 00:00      
               words!            01/01/70 00:00      
                  thanx            01/01/70 00:00      
      Tried your method            01/01/70 00:00      
         Re: Tried your method            01/01/70 00:00      
            Your method            01/01/70 00:00      
               Relocatable assembler ?            01/01/70 00:00      
                  re: Relocatable assembler            01/01/70 00:00      
                     Relocatable assembler            01/01/70 00:00      
                        Examples            01/01/70 00:00      
                           essentially, yes            01/01/70 00:00      
                        You mean...            01/01/70 00:00      
                           Yip            01/01/70 00:00      
                              Am I doing wrong?            01/01/70 00:00      
                                 ds            01/01/70 00:00      
      changed the code, but cant debug!            01/01/70 00:00      
         Re: changed the code, but cant debug!            01/01/70 00:00      
            Certainly it isnt READ            01/01/70 00:00      
               RE: Certainly it isnt READ            01/01/70 00:00      
                  Here goes the code. Thanks for all help            01/01/70 00:00      
                     Pascal            01/01/70 00:00      
   does 'everything' include reading ...            01/01/70 00:00      
   Example?            01/01/70 00:00      
      Simple!            01/01/70 00:00      
         That is all??            01/01/70 00:00      
            Discard LSB for MIDI            01/01/70 00:00      
               He is using Pots            01/01/70 00:00      
                  Vref needs to be solid            01/01/70 00:00      
                     not necessafrily            01/01/70 00:00      
                        OK it's good half the time            01/01/70 00:00      
            Averaging, "dead zone"            01/01/70 00:00      
               No disagree...            01/01/70 00:00      
   Discarding the lsb!            01/01/70 00:00      
      What is Vref            01/01/70 00:00      
         Vref            01/01/70 00:00      
      MIDI power source            01/01/70 00:00      
         Re: MIDI power source, provides power.            01/01/70 00:00      
            re: MIDI power source, provides power.            01/01/70 00:00      
               re: MIDI power source            01/01/70 00:00      
                  Stealing MIDI power            01/01/70 00:00      
                  +5V power on the MIDI connector            01/01/70 00:00      
   Pot matrix? Is possible?            01/01/70 00:00      
      No!            01/01/70 00:00      
         How could I do?            01/01/70 00:00      
            One 4051 for each group of 4 trimmers...            01/01/70 00:00      
      History Lesson            01/01/70 00:00      
         ->Grant            01/01/70 00:00      
   LCD Upgrade            01/01/70 00:00      
      Pull Ups            01/01/70 00:00      
         Thanks Neil, 10k works 100%            01/01/70 00:00      
   How to control CS EN lines...            01/01/70 00:00      
      Google            01/01/70 00:00      
         YEAH!!!            01/01/70 00:00      
            Watch the output polarity            01/01/70 00:00      
      74HCT237            01/01/70 00:00      
   Quality            01/01/70 00:00      

Back to Subject List