miguelzea35 0 Posted October 15, 2019 Share Posted October 15, 2019 I want know why my code isn't work, I used to use in TM4C129 and edit the code to used in TM4C123GXL, but it doesn't work. #include <stdint.h> #include "driverlib/sysctl.h" #include "driverlib/qei.h" int pos; void setup() { Serial.begin(9600); // Setup QEI Module SysCtlPeripheralEnable(SYSCTL_PERIPH_QEI0); GPIOPinConfigure(0x00031806); //GPIO_PD6_PHA0 GPIOPinConfigure(0x00031C06); //GPIO_PD7_PHB0 GPIOPinTypeQEI(GPIO_PORTL_BASE, GPIO_PIN_1 | GPIO_PIN_2); // Configure and Enable QEI QEIConfigure(QEI0_BASE, (QEI_CONFIG_CAPTURE_A_B | QEI_CONFIG_NO_RESET | QEI_CONFIG_QUADRATURE | QEI_CONFIG_NO_SWAP), 2147483648); QEIVelocityConfigure(QEI0_BASE, QEI_VELDIV_1, SysCtlClockGet()); // Divide by clock speed to get counts/sec QEIEnable(QEI0_BASE); QEIVelocityEnable(QEI0_BASE); } void loop() { // Report Position & Velocity of Encoder to Serial Terminal Serial.print(QEIPositionGet(QEI0_BASE)); Serial.print(','); Serial.println(QEIVelocityGet(QEI0_BASE)); delay(10); } Quote Link to post Share on other sites
Rei Vilo 695 Posted October 15, 2019 Share Posted October 15, 2019 Perform a search with quadrature https://forum.43oh.com/search/?&q=quadrature See http://forum.43oh.com/topic/7170-using-harware-qei-on-tiva-launchpad/ Quote Link to post Share on other sites
miguelzea35 0 Posted October 15, 2019 Author Share Posted October 15, 2019 I tried the codes that they use but didn´t work Quote Link to post Share on other sites
Rei Vilo 695 Posted October 15, 2019 Share Posted October 15, 2019 The code I mentioned actually works for me. I went through the well-written TivaWare™ Peripheral Driver Library for C Series User's Guide (Rev. D). As an option, you can start from scratch and develop your own library. Quote Link to post Share on other sites
energia 484 Posted November 20, 2019 Share Posted November 20, 2019 Alternatively you could use https://github.com/energia-libraries/RotaryEncoder Quote Link to post Share on other sites
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.