cyberian15
Joined: 18 Jul 2013 Posts: 1
|
QEI on DSPIC30F4011. Code not working!!! |
Posted: Thu Jul 18, 2013 3:25 pm |
|
|
I am trying to use the QEI module of DSPIC30F4011 to read the encoder counts. I am using MPLAB IDE to monitor the internal register POSCNT. On applying the sequence on QEA and QEB, the POSCNT is not changing at all. I am compiling the following code.
Code: |
#include <30F4011.h>
#fuses FRC_PLL16,NOWDT,PROTECT,PUT64
#use delay(clock=120000000)
void main(void)
{
int16 value;
set_tris_b(0xFFFF);
setup_adc_ports(no_analogs);
setup_qei(QEI_MODE_X2);
qei_set_count(0b1);
value=0;
while(1)
{
value=qei_get_count();
delay_us(10);
} | } |
|