Phatline Posted November 10, 2017 Report Share Posted November 10, 2017 i want to connect one Encoder directly to J5a i know that in my Code i have to initalize this pins: // initialize pin 2 of J5A, as Digital input with internal Pull-UP //connect to ground MIOS32_BOARD_J5_PinInit(0, MIOS32_BOARD_PIN_MODE_INPUT_PU); MIOS32_BOARD_J5_PinInit(1, MIOS32_BOARD_PIN_MODE_INPUT_PU); and i also can observe the state of the J5a pin by putting following code into APP_Background: MIOS32_BOARD_J5_PinGet(0) MIOS32_BOARD_J5_PinGet(1) all clear so far, and working good with buttons (with hardware debouncing ): debouce-circuit how does a Encoder-Code look like (without any Acceleration), and how does Hardware debouncing look like (the same like for buttons?), i want to use as less code then possible... thx 4 any tips Quote Link to comment Share on other sites More sharing options...
TK. Posted November 10, 2017 Report Share Posted November 10, 2017 Explained in detail in following tutorials: http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fapps%2Ftutorials%2F014b_enc_j5_relative%2F http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fapps%2Ftutorials%2F015b_enc_j5_absolute%2F Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Phatline Posted November 11, 2017 Author Report Share Posted November 11, 2017 thx Quote Link to comment Share on other sites More sharing options...
kmargos Posted May 6, 2018 Report Share Posted May 6, 2018 Hi!!! Leveraging the topic. I use the LCP1769 I'm testing the example "014b_enc_j5_relative". It only works J5A (A0 ... A3) and J5B (A4 ... A7) does not work. This example tests all inputs A0 ..... A7 on the J5A and J5B connector? How do I set up so that all inputs A0 .... A7? I tested J5A / B as analog inputs and they all worked. I just set "#define MIOS32_AIN_CHANNEL_MASK 0x00ff" Quote Link to comment Share on other sites More sharing options...
Phatline Posted May 7, 2018 Author Report Share Posted May 7, 2018 (edited) This Settings in "mios32_config.h" are working for 0-7A (5a,5b) - i am on a stm32f4 #define MIOS32_AIN_CHANNEL_MASK 0x00ff // AIN define the deadband (min. difference to report a change to the application hook) #define MIOS32_AIN_DEADBAND 31 //7Bit Edited May 7, 2018 by Phatline Quote Link to comment Share on other sites More sharing options...
kmargos Posted May 7, 2018 Report Share Posted May 7, 2018 Hi !! Strange, would not that just be for analog inputs? A0 .... A3 work fine without setting "#define MIOS32_AIN_CHANNEL_MASK 0x00ff". I do not want analog inputs. I want 4 encoders Tks Marco. Quote Link to comment Share on other sites More sharing options...
Phatline Posted May 7, 2018 Author Report Share Posted May 7, 2018 ahhh sorry, may fault... what i have done with J10A-B (if you replace J10 with J5 i think its the same) @top of programm (declaration) // ENCODER SR begin with 1, ENC with 0) // setup the Pinout of Encoders const mios32_enc_config_t encoders[1] = {{ .cfg.type=DETENTED2, .cfg.speed=FAST, .cfg.speed_par=3, .cfg.sr=7, .cfg.pos=0 }}; void APP_Init(void){ BLM_SCALAR_Init(0); // initialize BLM_SCALAR driver // Set GPIO @ J10A+B int pin; for(pin=0; pin<16; ++pin){ MIOS32_BOARD_J10_PinInit(pin, MIOS32_BOARD_PIN_MODE_INPUT_PU);} // Set Menue Encoder int enc; for(enc=0; enc<4; ++enc) { mios32_enc_config_t enc_config = MIOS32_ENC_ConfigGet(enc); enc_config.cfg.type = DETENTED3; // see mios32_enc.h for available types enc_config.cfg.sr = 0; // must be 0 if controlled from application enc_config.cfg.pos = 0; // doesn't matter if controlled from application enc_config.cfg.speed = FAST; enc_config.cfg.speed_par = 0; MIOS32_ENC_ConfigSet(enc, enc_config);} } void APP_SRIO_ServicePrepare(void) { // get current J10B value and update all encoder states int enc; u16 state = MIOS32_BOARD_J10B_Get(); for(enc=0; enc<4; ++enc) { MIOS32_ENC_StateSet(enc, state & 3); // two pins state >>= 2; // shift to next two pins } } Quote Link to comment Share on other sites More sharing options...
kmargos Posted May 7, 2018 Report Share Posted May 7, 2018 Hi , this example should work the 4 encoders?Im mine LPC dont work, only 2 encoders(j5A). http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fapps%2Ftutorials%2F014b_enc_j5_relative%2F Tks, Marco. Quote Link to comment Share on other sites More sharing options...
TK. Posted May 7, 2018 Report Share Posted May 7, 2018 Just got a flashback: this is actually a known issue and I thought that I fixed this some years ago... somehow the change didn't find it's way into the repository. I updated mios32/LPC17xx/mios32_board.c, please update your repository Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
kmargos Posted May 7, 2018 Report Share Posted May 7, 2018 (edited) 1 hour ago, TK. said: Acabei de receber um flashback: este é realmente um problema conhecido e achei que consertei isso há alguns anos ... de alguma forma, a mudança não encontrou o caminho para o repositório. Eu atualizei o mios32 / LPC17xx / mios32_board.c, atualize seu repositório Atenciosamente, Thorsten. Hi TK, Thank you so much!!! Now it works !!!! I've been looking for where the bug would be for two days and today I would look at "mios32_board.c". Thanks for the quick help !!! Marco. Edited May 7, 2018 by kmargos Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.