mess Posted August 23, 2006 Report Posted August 23, 2006 Hi,I'm trying to use a rotary encoder connected to pin 6 and 7 of my second din register...I've tried to use this encoder with this line in init(): // set encoder speed mode of datawheel MIOS_ENC_SpeedSet(14, DATAWHEEL_SPEED_MODE, DATAWHEEL_SPEED_DIVIDER); and this code in ENC_NotifyChange(...) if (encoder == 14) { unsigned int value; if (cs_layer == CS_LAYER_SFB) { CS_GetSFB(cs_sfb_mode); value = SFB_val; SFB_val = (MIOS_HLP_16bitAddSaturate(incrementer, &value, SFB_max))&0xFF; } else { //if no special function is selected the encoder changes the current bpm value = MCLOCK_BPMGet(); MCLOCK_BPMSet(MIOS_HLP_16bitAddSaturate(incrementer, &value, 255)&0xFF); } app_flags.DISPLAY_UPDATE_REQ = 1; } but the code seems to do nothing :(
stryd_one Posted August 23, 2006 Report Posted August 23, 2006 What if you replace the if statement with something simple like sending a midi CC, does that work? You got that encoder in the table? Does it work with normal encoder speed? Sorry for the barrage of questions... I'm trying to pinpoint the source of the fault, and your answers will give me the hints I need :)
audiocommander Posted August 23, 2006 Report Posted August 23, 2006 have you added the Encoder to the table in mios_tables.inc ?if you did so, try to call an easy function to determine if everthing is wired right, eg:on ENC_NotifyChange():MIOS_LCD_Cursor_Set(0x0);MIOS_LCD_PrintCString("Encoder down");Cheers,Michael
audiocommander Posted August 23, 2006 Report Posted August 23, 2006 Sorry for the barrage of questions...;D now even more...
mess Posted August 23, 2006 Author Report Posted August 23, 2006 ;D now even more...Thank you guys for your help :) :Dif you did so, try to call an easy function to determine if everthing is wired right, eg:on ENC_NotifyChange():I tried this already, same resultYou got that encoder in the table?-> this seems to be the solution, since I have no MIOS asm backgroundI was even unaware of this table (always seemed a mystery how MIOS identified encoders ::))so if I summarise encoder handling in MIOS C:- connect encoder to shift register, first pin on an even pin number- add an encoder entry in mios_tables.inc- add a line in Init() in main.c: // set encoder speed mode of datawheel MIOS_ENC_SpeedSet(ENCODER_NR, DATAWHEEL_SPEED_MODE, DATAWHEEL_SPEED_DIVIDER); - handle encoder events in ENC_NotifyChange(...)I will try this when I get home tonight...
stryd_one Posted August 23, 2006 Report Posted August 23, 2006 (always seemed a mystery how MIOS identified encoders ::))Hehehehe I know what you mean! It's one of many little mysteries :)
TK. Posted August 23, 2006 Report Posted August 23, 2006 This info is documented here:http://www.ucapps.de/mios_c_send_enc_rel.htmljust for the case you missed the examplesBest Regards, Thorsten.
mess Posted August 23, 2006 Author Report Posted August 23, 2006 just for the case you missed the examplesI guess I did miss the encoder example, thanks TK ;D
mess Posted August 25, 2006 Author Report Posted August 25, 2006 Everything works now,I made some stupid errors on my veroboard din module ::)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now