metalzse
Newbie level 2

Hello everyone,
At first, I apologize for my poor English.
I am working with a project, which making an DIY E-Drum Midi-Trigger.
The E-drum pad make a 0~5V pulse signal, when it is hit.
The Signal depend on how hard is it hit.
I use a MCU at89s51, ADC0804, and HCF4051 for a scan-input circuit.
As a test-circuit, I connect the circuit as the fallowing picture
I drew only the part of 8051 and 4051.
At first, I use only 2 Inputs, for a Snare and a Bass drum (Kick).
I use the pin13 as a Snare input and pin14 as a Kick input.
and give the Snare input a sustained 3V signal. For Kick 0V
Here is the part of Code about Scan-input
----------------------------------------------------------
while(1)
{
P0_0 = 0; // pick 4051-pin13 as input
P0_1 = 0;
P0_2 = 0;
ADC(); // ADC convert and read value
Snare_value = ADC_value; // write value to Snare
if(Snare_value > 5) // If there is value in snare, send snare midi siganl
{
Midi_Out_Conv(Snare,Snare_value,0,0,0,0); // send a snare MIDI signal to computer
}
Snare_value = 0; // after send, clear Snare value
ADC_value = 0; // after send, clear AD value.
P0_0 = 1; // pick 4051-pin14 as input
P0_1 = 0;
P0_2 = 0;
ADC(); // ADC convert and read value
Kick_value = ADC_value; // write value to Kick
if(Kick_value > 5) // If there is value in Kick, send Kick midi siganl
{
Midi_Out_Conv(Kick,Kick_value,0,0,0,0); // send a Kick MIDI signal to computer
}
Kick_value = 0; // after send, clear Kick value
ADC_value = 0; // after send, clear AD value.
}
----------------------------------------------------------------------------
In this case, I should get only the Midi signal of Snare
Because the AD Value for Kick should be always 0.
The problem is, that I received both of Kick and Snare signal in my computer. And in a unregular tempo.
Just like this.
The X axis is Time in second.
I am confused from this problem for some weeks.
I hope that, you guys can understand my problem.
What is wrong with this circuit.
Thanks a lot.
At first, I apologize for my poor English.
I am working with a project, which making an DIY E-Drum Midi-Trigger.
The E-drum pad make a 0~5V pulse signal, when it is hit.
The Signal depend on how hard is it hit.
I use a MCU at89s51, ADC0804, and HCF4051 for a scan-input circuit.
As a test-circuit, I connect the circuit as the fallowing picture
I drew only the part of 8051 and 4051.

At first, I use only 2 Inputs, for a Snare and a Bass drum (Kick).
I use the pin13 as a Snare input and pin14 as a Kick input.
and give the Snare input a sustained 3V signal. For Kick 0V
Here is the part of Code about Scan-input
----------------------------------------------------------
while(1)
{
P0_0 = 0; // pick 4051-pin13 as input
P0_1 = 0;
P0_2 = 0;
ADC(); // ADC convert and read value
Snare_value = ADC_value; // write value to Snare
if(Snare_value > 5) // If there is value in snare, send snare midi siganl
{
Midi_Out_Conv(Snare,Snare_value,0,0,0,0); // send a snare MIDI signal to computer
}
Snare_value = 0; // after send, clear Snare value
ADC_value = 0; // after send, clear AD value.
P0_0 = 1; // pick 4051-pin14 as input
P0_1 = 0;
P0_2 = 0;
ADC(); // ADC convert and read value
Kick_value = ADC_value; // write value to Kick
if(Kick_value > 5) // If there is value in Kick, send Kick midi siganl
{
Midi_Out_Conv(Kick,Kick_value,0,0,0,0); // send a Kick MIDI signal to computer
}
Kick_value = 0; // after send, clear Kick value
ADC_value = 0; // after send, clear AD value.
}
----------------------------------------------------------------------------
In this case, I should get only the Midi signal of Snare
Because the AD Value for Kick should be always 0.
The problem is, that I received both of Kick and Snare signal in my computer. And in a unregular tempo.
Just like this.

The X axis is Time in second.
I am confused from this problem for some weeks.
I hope that, you guys can understand my problem.
What is wrong with this circuit.
Thanks a lot.