This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dseq32_matrix [2006/08/13 23:56] mess |
dseq32_matrix [2006/09/23 00:53] mess |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | This page will contain the information about the combined lcd/button matrix | ||
- | [[http://www.midibox.org/forum/index.php?topic=7087.0|forum topic]]<sup>uCApps</sup> | ||
- | right now I'm using a modified version of the sm_simple C example\\ | ||
- | this code will be rewritten to make it more coherent | ||
- | |||
- | modifications to [[http://www.ucapps.de/mios/sm_example1_v2.zip|scan matrix example]] <sup>uCApps</sup>\\ | ||
- | |||
- | ==== Hardware ==== | ||
- | [[http://users.skynet.be/sky92755/DSEQ32_DOUT.pdf|DOUT wiring]]\\ | ||
- | \\ | ||
- | [[http://users.skynet.be/sky92755/DSEQ32_DIN.pdf|DIN wiring]]\\ | ||
- | |||
- | //*note: schematics not finished!//\\ | ||
- | ==== Software ==== | ||
- | in main.c:\\ | ||
- | |||
- | <code> | ||
- | ... | ||
- | //second shiftregister drives the leds | ||
- | #define LEDOUT 1 | ||
- | ... | ||
- | void LM_SetRow(){ | ||
- | MIOS_DOUT_SRSet(LEDOUT,ledtest[sm_col]); | ||
- | } | ||
- | |||
- | ///////////////////////////////////////////////////////////////////////////// | ||
- | // This function is called by MIOS before the shift register are loaded | ||
- | ///////////////////////////////////////////////////////////////////////////// | ||
- | void SR_Service_Prepare(void) __wparam | ||
- | { | ||
- | // call the Scan Matrix Driver | ||
- | SM_PrepareCol(); | ||
- | // call the Led Matrix Driver | ||
- | LM_SetRow(); | ||
- | } | ||
- | ... | ||
- | </code> | ||
- | \\ | ||
- | in sm_simple.asm: | ||
- | <code> | ||
- | |||
- | |||
- | ... | ||
- | global _sm_button_column | ||
- | global _sm_button_row | ||
- | global _sm_button_value | ||
- | global _sm_col | ||
- | |||
- | ;; import lables | ||
- | extern _SM_NotifyToggle | ||
- | |||
- | ; ========================================================================== | ||
- | |||
- | accessram udata ; (no access ram required, these variables can be located anywhere) | ||
- | |||
- | _sm_button_column res 1 ; exported to C, therefore an "_" has been added | ||
- | _sm_button_row res 1 | ||
- | _sm_button_value res 1 | ||
- | _sm_col res 1 | ||
- | |||
- | ... | ||
- | |||
- | SM_PrepareCol | ||
- | ;; select next DOUT register | ||
- | |||
- | ;; (current column + 1) & 0x07 | ||
- | SET_BSR sm_selected_column | ||
- | incf sm_selected_column, W, BANKED ; (* see note below) | ||
- | andlw 0x07 | ||
- | ;_sm_col is used by LM_SetRow() | ||
- | movwf _sm_col | ||
- | call MIOS_HLP_GetBitANDMask ; (inverted 1 of 8 code) | ||
- | ... | ||
- | </code> | ||
- | \\ | ||
- | and finally in sm_simple.h: | ||
- | <code> | ||
- | |||
- | ... | ||
- | extern unsigned char sm_button_value; | ||
- | extern unsigned char sm_col; | ||
- | ... | ||
- | </code> | ||
- | |||
- | back to [[DSEQ32]] |