today I hooked up a Boss GT6 guitar effects processor to my scope. The probes were connected to multiplexed button matrix (see attach - CN3 connector), I wanted to determine the frequency at which the matrix is being pulsed. I was expecting to see a steady frequency and steady duty cycle but got both parameters varying.
The scope pictures show the pulse at pin SW_SCAN0, the other three SW_SCANx pins produced similar varying waveforms.
Is this a result of bad circuit/code design, component malfunction, etc, or is this normal? btw, the GT6 works fine, I play guitar through it no prob.
Hi, this is a normal scan pulse. What you need to do is look at all the scans at the same time, you will find that the pulses occurr at different times.
What happen is, scan0 is made high, data0 thru to data5 is then checked to see if any of them is high, if so then it means that a particular key on the that scan has been pressed. Scan0 then goes back to low.
Scan1 is now made high and the data lines checked again.
Scan2 and Scan3 are addressed likewise.
So even though your pulses are the same, they are occuring at different times in sequence.
You could trigger off scan0, and look at scan 0, 1, 2, and then 3. You should see the pulses at different locations on the screen.
TomGeorge:
Hi, this is a normal scan pulse. What you need to do is look at all the scans at the same time, you will find that the pulses occur at different times.
I did look at other SCAN lines simultaneously, the SCAN pulses don't overlap and are taking place one after another so that's good, but the varying length and drifting clock is a bit strange for me. I mean if you have the scanning code it would probably have a set amount of ms for each SCAN pulse length while the DATA lines are being scanned, so since there are the same amount of DATA scans for each SCAN pulse I would expect the SCAN pulses to be pretty much of the same length.
Hi, the reason the pulses are not consistent in width and frequency is probably because it is software driven.
If say for example the scan0 goes high, if just after that an interrupt occurs, that suspends the scan program, the interrupt takes a small amount of time to execute, then control is moved back to the scan software which now continues its High time count before dropping it back to zero.
If the interrupt did not occur then the High time would appear shorter then if the interrupt did occur.
This does not cause a problem scanning and reading the switch matrix because the read side of the scan would also stop while the interrupt is executed.
If you are thinking of making an interface through the keyboard scan, your best bet is using opto-couplers for each of the keyboard contacts and let the scan software work on that.
TomGeorge:
If you are thinking of making an interface through the keyboard scan, your best bet is using opto-couplers for each of the keyboard contacts and let the scan software work on that.
Tom....
Well I want to duplicate some of those GT6 switches. My idea is to use a 4x4 keypad matrix.
The MCU will be connected to the SCAN and DATA lines, here is pseudo code as example,
this bit of code will replicate switch SW9 (OD/DS) on the button matrix of the GT6:
If keypad_matrix key 1 is HIGH then
if SCAN_3 is HIGH
digitalWrite DATA0 HIGH
if SCAN_3 is LOW
digitalWrite DATA0 LOW
the GT6 scans the button matrix at ca. 30-50 Hz, so pretty slow, I reckon the MCU wont have a problem scanning the 4 SCAN lines and setting them HIGH LOW fast enough so as not to disrupt the GT6.