Jump to content
Sign in to follow this  
cry_viem

QEI module

Recommended Posts

hi! everyone,

i have a lm4f120h5qr, i try to code for QEI but it didn't work, may i was wrong or lmf4120h5qr have no QEI module ?

help me please, i'm newbie so i may not know a lot of thing.

here is my code


#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "inc/hw_gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/pin_map.h"
#include "driverlib/gpio.h"
#include "driverlib/qei.h"

 int pos;

void main(void)
{
	//set system clock
	SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

	//enable qei0 module
	SysCtlPeripheralEnable(SYSCTL_PERIPH_QEI0);
	//enable portD
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);	
	//
	GPIOPinTypeQEI(GPIO_PORTD_BASE, GPIO_PIN_6);

	//
	GPIOPinConfigure(0x00031806);// i could found GPIO_PD6_PHA0 in PART LMF4120H5QR					     //  so i fill direct hex code from other PART ???
	
	//--------------------------------------------------------------------

	QEIDisable(QEI0_BASE);
	QEIIntDisable(QEI0_BASE,QEI_INTERROR | QEI_INTDIR | QEI_INTTIMER | QEI_INTINDEX);

	QEIConfigure(QEI0_BASE, QEI_CONFIG_CAPTURE_A | QEI_CONFIG_NO_RESET | QEI_CONFIG_QUADRATURE | QEI_CONFIG_NO_SWAP,1000);

	QEIPositionSet(QEI0_BASE, 500);

	QEIEnable(QEI0_BASE);

	while (1)
		{
                        //i set breakpoint at here to update view pos
			pos = QEIPositionGet(QEI0_BASE);
			SysCtlDelay (1000);
		}



}

the variable "pos" = 0 all time of debugging ????? 

thank all? @@'

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...