Jump to content

[SOLVED]Matrix Scanning issues...


buhler
 Share

Recommended Posts

Heya guys, I put together a little DINx1(breadboarded), DOUTx1(breadboarded), Core(18f452, MIOS 1.9g) combo to scan my 61 key Fatar keyboard. I compiled and uploaded a .hex file using the ASM version of the sm_fast example which has JimHenry's name credited. Anyhow, I chose this one because it prints out the row/column and note # on the LCD. I have the swap function set to 0. So the issue is, the app only responds to the 'odd' keys i.e. C,D,E,F#,G#,A#,C etc... The 'Lowest' key which is D0 on both shift registers(DIN,DOUT) is the C key which is what I'm counting as 1. Anyhow, I've looked over the sm_fast.inc and main.asm files and just can't quite figure out how this app works. This is my first trek into the ASM camp as I usually am scripting in C# and C++. Any insight you guys have is much appreciated. I've thoroughly checked over all the hardware and connections and I am 99.9% sure there are no issues there. Thanks in advance!

buhler

[edit] I would like to add a small update... I realized after going over the SM schematic that I had the 'rows' connected to the DOUT and the 'columns' connected to the DIN... Seeing as the anodes of the diodes are all connected... DOUT -> anode, cathode -> DIN. Anyhow, I switched them around as they are in the schematic and now I've got no response from the keyboard!!! I'm even worse off than when I started! Why would the anodes be connected to the DIN shift register and cathodes to the DOUT? Well, I guess the question is, do I go back to a barely working state or continue on with what should be the 'right' way...?

Edited by buhler
Link to comment
Share on other sites

It seems that the wrong code is selected by default which was inserted by Jim for scanning a Panasonic keyboard.

Could you please try the application with the #if switch in SM_NotifyToggle set to 1?

I would like to add a small update... I realized after going over the SM schematic that I had the 'rows' connected to the DOUT and the 'columns' connected to the DIN... Seeing as the anodes of the diodes are all connected... DOUT -> anode, cathode -> DIN. Anyhow, I switched them around as they are in the schematic and now I've got no response from the keyboard!!!

No problem, just swap again.

As stated in this schematic: http://www.ucapps.de/mbhp/mbhp_scan_matrix1.pdf

rows/columns have to be swapped if the cathodes of your hardware are connected together.

In the software, SM_SWAP_CR has to be set to 1 (so, a second change is required in sm_fast.inc)

I'm even worse off than when I started! Why would the anodes be connected to the DIN shift register and cathodes to the DOUT? Well, I guess the question is, do I go back to a barely working state or continue on with what should be the 'right' way...?

Are the cathodes or anodes connected together on your keyboard?

Best Regards, Thorsten.

P.S.: I uploaded an updated version where the right decoding is selected: sm_example2_v1d.zip under http://www.ucapps.de/mios_download.html

Press the refresh button of your webbrowser if you see the previous version.

Link to comment
Share on other sites

Hey T.K.! Thanks for the reply and the updated app! So, I've reverted back to my original setup i.e. exactly as you have it in the mbhp_scan_matrix1.pdf EXCEPT(!) I have the 'Rows' connected to DOUT and the 'Columns' connected to the DIN register.

No problem, just swap again.

As stated in this schematic: http://www.ucapps.de/mbhp/mbhp_scan_matrix1.pdf

rows/columns have to be swapped if the cathodes of your hardware are connected together.

In the software, SM_SWAP_CR has to be set to 1 (so, a second change is required in sm_fast.inc)

Are the cathodes or anodes connected together on your keyboard?

The issue is, the anodes are connected together on my keyboard but it only responds if i have the DIN and DOUT registers swapped. i.e. opposite the scan matrix pdf... ? I've tried both the updated app you gave me and I've set SM_SWAP_CR to both 0 and then tried 1 and I still run into the same issues... C0 is read fine, but C#0 is not read and D0 is read as C# and so on skipping ever other key (reading odds only). I can't figure it out! My core is working perfectly, my DIN and DOUT are working as far as I can tell, no cold solder joints. Another interesting problem I've noticed is that when I press a key that seems to be working it also sends a Note On event a tritone above!...? Basically, every key that works is also giving me a second note on event! Very strange. Once again, just to clarify, my keyboard's matrix is set up exactly as you have it in the mbhp_scan_matrix1.pdf but I have the DIN and DOUT connections swapped. This keyboard also has a redundant second matrix(for velocity I assume) that i have left unconnected... Could that be part of the issue? Also, the keyboard is split in half between two circuit boards... The 'Columns' or Cathodes of the diodes(the side the actual switch is on) are shared between the two halves. Basically, in order to treat this keyboard as one giant matrix, I had to take the columns from both halves and combine each one. Does that make sense? I've also uploaded a schematic of the entire keyboard that I've cannibalized. It's a Korg N364, non functioning of course. Anyhow, hopefully all this helps!

[edit] the circuit diagram with the keyboard and what not is on Page 8 of this PDF. :)

[edit #2] I've also uploaded the exact schematic of just my model of Fatar keyboard. It's the 61 key(5 octave) tp/9.

[edit #3] Just for the hell of it, I'm going to clarify even more. :) Using the schematic I uploaded in [edit #2], I have T0 -T7(x2) connected to D0 -D7 of my DOUTx1 and I have only the MK0-MK7connected to D0 - D7 of my DINx1. Hopefully that will help my explanation above!

KORG_N264_N364_Service_Manual.pdf

post-5402-126315706964_thumb.gif

Edited by buhler
Link to comment
Share on other sites

The issue is, the anodes are connected together on my keyboard but it only responds if i have the DIN and DOUT registers swapped. i.e. opposite the scan matrix pdf... ?

Thats really strange - I suppose an electrical issue or wrong documentation which is hard to solve remotely.

To troubleshoot this by yourself, you could control the matrix manually - I will take the terms of my schematic as reference:

Connect R0-R7 to the DIN module, connect C0 to ground, let C1..C7 unconnected.

Now the buttons of C0 column should trigger a note, all others shouldn't generate a event.

Now connect C1..C7 to +5V and repeat - nothing should change (and this should especially not cause a short circuit)

Repeat with only C1, C2, ... C7 connected to ground, all other columns even unconnected or to +5V (shouldn't cause a difference)

Results?

Best Regards, Thorsten.

Link to comment
Share on other sites

Thats really strange - I suppose an electrical issue or wrong documentation which is hard to solve remotely.

To troubleshoot this by yourself, you could control the matrix manually - I will take the terms of my schematic as reference:

Connect R0-R7 to the DIN module, connect C0 to ground, let C1..C7 unconnected.

Now the buttons of C0 column should trigger a note, all others shouldn't generate a event.

Now connect C1..C7 to +5V and repeat - nothing should change (and this should especially not cause a short circuit)

Repeat with only C1, C2, ... C7 connected to ground, all other columns even unconnected or to +5V (shouldn't cause a difference)

Results?

Best Regards, Thorsten.

Thanks T.K.! I'll give this a shot. I can't rule out the possibility that my DIN/DOUT modules are faulty as well... I'll just take this one step at a time and let you know the results.

Link to comment
Share on other sites

Heya T.K! I got it working! I used the sm_example2_v1d.zip you uploaded and went C0+R0 and so on all the way up to C7+R7. I found a few shorts/broken leads etc (this keyboard had seen better days) as well as a few mistakes on my part... :blush: I ended up rushing a little too quickly and mixed a few R/C lines! Anyhow, the keyboard is working perfectly now, no missed notes, no extra events! NOW, I need to work out an Octave UP/DOWN algorithm and at some point, I want to incorporate the second matrix to work out the velocity sensing. Thanks for all your help T.K!

[edit] I also want to add that on the schematic I uploaded above, with the 61 key matrix, the pinout diagram for the two sections is from the *solder side* of the circuit board. I was having issues partly due to the fact that I was reading the pinout as from the pin side... :thumbsup: The ribbon cable had no indication of "pin 1" nor did the actual pins on the circuit board.

Edited by buhler
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...