Search Forums by tag:
Serial, mbed, compiler, ethernet, USB, I2C, SPI, interrupt, LCD, library, bug, HTTPServer, CAN, adc, AnalogIn, memory, SD Card, InterruptIn, rpc, Power, SDFileSystem, Ticker, canbus, driver, editor, Error, LocalFileSystem, UART, libraries, TCP, GPS, PwmOut, timer, pwm, file, website, accelerometer, C++, reset, SDCard, RTC, interrupts, clock, DigitalIn, TCPSocket, frequency, led, Java, http, buffer, DMA, SD, flash, HTTPClient, pinball, MODSERIAL, problem, printf, filesystem, SerialPC, RFID, beta, LPC1768, rtos, newbie, compile, digitalOut, Servo, UDP, audio, LPC11U24, RPCFunction, EthernetNetIf, NetServices, m3pi, Download, write, socket, multiple, array, sensor, keil, MATLAB, Forum, debug, hardware, Board, I2S, dead, Sleep, xbee, Nokia6610, AnalogOut, tcp/ip, SPI Slave, code, voltage, wait, network, read, suggestion, dac, JTAG, string, pc, keyboard, copy, GPRS, offline, lwip, Speed, DHCP, Data Logging, windows, time, current, MODDMA, mp3, C, gcc, attach, fatfilesystem, USB Host, publish, assembly, stepper motor, WavePlayer, camera, size, VGA, import, documentation, baud, bluetooth, TextLCD, firmware, M0, pullup, Relay, timing, pololu, MIDI, compiler error codes, magjack, client, robot, Communication, stream, HID, breakout, FIFO, prototype, GPIO, sampling, api, binary, filter, ADXL345, program, DSP, help, sram, class, suggestions, email, PING, arduino, rs232, link, wifi, Nokia, browser, control, Host, Eagle, Modbus, ide, linux, port, updates, Cortex-M0, WiFly, DMX, files, scanf, protocol, PPP, FTP, integer, function, latency, serial port, modem, motors, for, monitor, malloc, Digital I/O, Production, FAT, classes, server, webserver, delay, variables, flashing, time-triggered, PCB, c programming, Analog, labview, watchdog, Encoder, post, math, LPCXpresso, MBED website, GSM, storage, nxp, mobileLCD, license, Terminal, int, counter, baseboard, rj45, EEPROM, E289, mac, Timeout, news, connect, pointers, Optocoupler, Robotics, search, USBMIDI, glitch, find, real-time, format, slave, driverlibrary, MODGPS, processing, networking, ID, umts, float, color, BUTTON, Images, wave, bin, const, OSX, supply, peripheral, sensors, RIT, character, bus, ARM, SRF08, heap, output, basic, piezo, pins, keypad, ID12, Pachube, player, DigitalInOut, object, capture, slow, PSP, OS, display, syntax, mbed.lib, EmbeddedArtists, NMEA, paste, project, GUI, UART0, firefox, motor, SQL, RAM, 3D, bugs, Temperature, not, I/O, Bidirectional, rss, resolved, Pin, Assembler, LED1, LIS302, getc, Safari, Vin, wiki, registers, PS2, fopen, BusOut, projects, RS485, pythonHi Dhaval,
I would also like a quadrature interface but alais there isn't one yet. I did play about with using hardware interupts to achieve this with limited sucess using a 2500 line encoder. The code was...
void PinChange() {
if(LastA!=PhaseA){ //A change on Phase A has occured
if(PhaseA==0){
if(PhaseB==1)
Count--;
else
Count++;}
else
if(PhaseB==0)
Count--;
else
Count++;}
else if(LastB!=PhaseB){ //A change on Phase B has occured
if(PhaseB==0){
if(PhaseA==0)
Count--;
else
Count++;}
else
if(PhaseA==1)
Count--;
else
Count++;}
LastA=PhaseA;
LastB=PhaseB;
}
I'm sure a good software guy could do a lot better but this did work, as long as you didn't spin the encoder too fast!
Hi Dhaval,
Assuming you know what you are doing, and don't expect any warranties etc, go for it! I'd love to see the results.Dhaval Shah wrote:
i was planning to remove the led's and give my encoder input's ......please suggest me if i am going wrong........
You are correct that there is no built in library for the quadrature encoder, but you can still have a go at writing one like you would other code; no real relation to being online/offline. In fact, all the mbed libraries were written in the mbed online compiler! Eat your own dogfood! So it obviously possible, unless I didn't understand a special requirement you have.Dhaval Shah wrote:
The online compiler doesnt support quadrature encoder interface(i mean no built in library for encoder) .......So suggest me any offline line compiler for the same......
The quadrature encoder register structure is already available in the mbed library as part of the CMSIS library. See:
#include "mbed.h"
int main() {
LPC_QEI->QEICON = 0;
} Does this makes sense and answer your question? It'd be great to see the quadrature encoder working, as we never had a chance to look at it.Hi Simon
Using a function like QEI that is not in the mbed library requires a little research, of which getting the CMSIS register names is just the first step. Getting QEI is on my to do list and so I have made a start by building this crib.
/*------------- Quadrature Encoder Interface (QEI) ---------------------------*/
CMSIS Name Handbook Name Function
572 typedef struct
573 {
574 __O uint32_t QEICON; // QEICON ( Control)
575 __I uint32_t QEISTAT; // QEISTAT ( Status)
576 __IO uint32_t QEICONF; // QEICONF ( Configure)
577 __I uint32_t QEIPOS; // QEIPOS ( Position)
578 __IO uint32_t QEIMAXPOS; // QEIMAXPOS ( Max Position)
579 __IO uint32_t CMPOS0; // CMPOS0 ( Position Compare 0)
580 __IO uint32_t CMPOS1; // CMPOS1 ( Position Compare 1)
581 __IO uint32_t CMPOS2; // CMPOS2 ( Position compare 2)
582 __I uint32_t INXCNT; // INXCNT ( Index Count)
583 __IO uint32_t INXCMP; // INXCMP ( Index Compare)
584 __IO uint32_t QEILOAD; // QEILOAD ( Velocity Timer Reload)
585 __I uint32_t QEITIME; // QEITIME ( Velocity Timer)
586 __I uint32_t QEIVEL; // QEIVEL ( Velocity Counter)
587 __I uint32_t QEICAP; // QEICAP ( Velocity Capture)
588 __IO uint32_t VELCOMP; // VELCOMP ( Velocity Compare)
589 __IO uint32_t FILTER; // FILTER ( Digital Filter)
590 uint32_t RESERVED0[998];
591 __O uint32_t QEIIEC; // QEIIEC ( Interrupt Enable Clear)
592 __O uint32_t QEIIES; // QEIIES ( Interrupt Enable Set)
593 __I uint32_t QEIINTSTAT; // QEINTSTAT ( Interrupt Status)
594 __I uint32_t QEIIE; // PCQIE ( QIE Interrupt Enable = 1 Disabled = 0)
595 __O uint32_t QEICLR; // QEICLR ( Interrupt Status Clear)
596 __O uint32_t QEISET; // QEISET ( Interrupt Status Set)
597 } LPC_QEI_TypeDef;
/*--------------------- Other Regs ----------------------------*/
LPC_SC->PCONP // PCONP ( Power Enable)
(not found) // PCLK_QEI
(PINSEL and PINMODE regs not found) //
(NVIC registers CMSIS name not found) The idea is to match the CMSIS register names with the names used in the User Manual and the register function. You will see that I still have some work to do in the Other Register part at the bottom of the table. With the table complete, writing code is a do-able task.
It is not exactly like decoding Linear B, but there are similarities.
Hi ,
Thank you all for your guidance . I have started the work on Red Suite 3 evaluation version provided by red code .
Please let me know if there are problems faced if any using the evalution version.
Regards,
Dhaval
does the QEI library that is available online use the native QEI interface or just hardware interrupts? Would the native QEI system be faster than the generic hardware interrupts?
Thanks
I think Rahul is correct, the cookbook example just uses interrupts. If you were able to use the built in QEI harware on the LPC1768 it would be much quicker and more reliable.
has anyone tried this? I thought I read that one of the encoder inputs was used as a blue LED? I am looking at creating a PID servo brushed motor controller and want the fastest encoder input whether thats interrupt based or built in QEI. I basically am using the library QEI encoder in and a small H-bridge output boardlet with a small brushed motor for testing. Anyone else doing a project like this??
Please log in to post a reply.

No tags
|

Hi,
The Led's which are connected to the board are pin no 34 & 37 (i am considering only two port pins ) which are also encoder i/p to the microcontroller.......i was planning to remove the led's and give my encoder input's ......please suggest me if i am going wrong........
The other issue is about the programming part . The online compiler doesnt support quadrature encoder interface(i mean no built in library for encoder) .......So suggest me any offline line compiler for the same......