CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

qei on 18f4620

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
raman00084@gmail.com



Joined: 28 Jul 2014
Posts: 38

View user's profile Send private message

qei on 18f4620
PostPosted: Mon Apr 15, 2019 10:30 pm     Reply with quote

How can i count qei pulses in 18f4620 ic ? It does not have in built qei module.
temtronic



Joined: 01 Jul 2010
Posts: 9120
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 16, 2019 5:47 am     Reply with quote

Use an external device ! US Digital make several. I used them 25 years ago for realtime control of a 3DOF helicopter among other things
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Tue Apr 16, 2019 7:47 am     Reply with quote

I've done something where I hooked up the two phases of the encoder to separate timer inputs before... Don't remember exactly what I did, but it worked.
Ttelmah



Joined: 11 Mar 2010
Posts: 19238

View user's profile Send private message

PostPosted: Tue Apr 16, 2019 11:29 am     Reply with quote

You have to add a little external logic to do this, but it can work well.
A web search will find the gates needed.
temtronic



Joined: 01 Jul 2010
Posts: 9120
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 16, 2019 2:56 pm     Reply with quote

depending on application, you can use a PS2 mouse.. Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 19238

View user's profile Send private message

PostPosted: Wed Apr 17, 2019 1:19 am     Reply with quote

Like most things in programming/PIC's, huge amounts depend on other
factors:

1) How fast the QEI pulses are going to be?.
2) Whether you need to decode all four phases or just one or two?.
3) What interrupts need to be handled on the chip at the same time?.
(this is vital - to decode QEI using interrupt on change for example,
requires this interrupt to be able to be accessed without fail on every
QEI edge - if there are other interrupts needed and any of the handlers
for these take noticeable time, this slows the maximum rate that can be
handled.....).
4) Clock speed of PIC?.

With these factors given, it allows you then to choose a number of
possible solutions:
1) Interrupt on change QEI decoding - simplest, but lowest performance.
2) 'Logic' QEI decoding. With this you add an external flip-flop and
can generate two pulse trains - one is the 'up' counts, and the other
the 'down'. These can then be fed into two PIC timers. Add timer overflow
interrupts, and your 'position', is the delta between these two counts.
There are also chips to do this logic on the market (LS7083/4).
3) Hardware QEI. Another poster has already mentioned in a recent
thread the US Digital chips, and these are very easy to use. Other
manufacturers also produce chips to do this.

Like most things 'PIC' there are a lot of 'answers'..... Very Happy
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group