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 CCS Technical Support

24bit Parallel Absolute Encoder Test Box
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dorinm



Joined: 07 Jan 2006
Posts: 38

View user's profile Send private message

Re: 24bit Parallel Absolute Encoder Test Box
PostPosted: Fri Feb 17, 2012 7:11 pm     Reply with quote

carl wrote:
Hi All,

OK I need your advice on a new project. It is for a 24bit Parallel Absolute Encoder Test Box.

The main idea is too take a 'snapshot' of the 24 input lines from parallel encoders, assess if the count is good (Compare the previous value against the current value, and if it is +/- 1 count then its good, if not then raise an alarm) and then output the count.

The main important question that is paramount is 'the amount of time available to perform the task'. The encoder will be running at max 20Khz - so each rising edge would take 1/20Khz = 50uS. Assuming I use a 40Mhz pic (10Mhz clock - so each instruction takes 0.1uS) do you think I would have enough time to do the following:

1) Wait for a pin/port change (from the LSB up - as these will always be changing).
2) Then take a 'snap-shot' of all 24input pins.
3) Then assess the current count against previous count.
4) If good then make make the previous count = current count. If bad raise alarm.
5) Write the value to the output. (spi would be good).
6) Wait for next pin/port change.

And all of the above in 50uS?????
Do you think this approach is feasable????

Any feedback would be much appreciated.
Carl


read above, yes it is possible and it should work...
asmallri



Joined: 12 Aug 2004
Posts: 1680
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat Feb 18, 2012 5:40 am     Reply with quote

There are lots of ways to do this and 50us is sufficient time. I would use a PIC with a large pin count instead of multiple latches and use SPI as the interface between PICs.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
carl



Joined: 06 Feb 2008
Posts: 240
Location: Chester

View user's profile Send private message

PostPosted: Sat Feb 18, 2012 11:17 am     Reply with quote

Thank you all for your replies.
I think the one thing you have all said is that using one pic would be an easier and better plan than using three pic's.

As for using the latch's or not, it seems that you are not all agreed as too which would be the best and quickest plan. ASM I am swayed with your opinions thank you, but others seem to say that using using all three ports would be acceptable.

Dorinm, apologies but I don't understand fully what you mean, and have not heard of 'pool' before. Could you kindly explain how and what this means.

Thanks All
Carl
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sat Feb 18, 2012 1:29 pm     Reply with quote

1- if your latch_read selector defaults to enabling the LSB latch AND you keep the common clock HIGH
AND
2- make the latchs be an HCT or AC 573 - ( it becomes a transparent latch ) -then you can LEAVE the the common clock HIGH - and simply direct read the D port to look for a change of value against the last read
then after change detected - just lower the clock to freeze all 3 bytes

and HOLD a detected change of value - then read the 3 latches
VERY VERY efficient and teh 3 new bytes
can be had with DAMNED few clock cycles - count them on your fingers
-- and not run out of fingers either
Very Happy Very Happy
carl



Joined: 06 Feb 2008
Posts: 240
Location: Chester

View user's profile Send private message

PostPosted: Mon Feb 20, 2012 8:10 am     Reply with quote

OK ASM,

I am going to try your plan.
Thanks for all your help.

Carl
dorinm



Joined: 07 Jan 2006
Posts: 38

View user's profile Send private message

PostPosted: Wed Mar 07, 2012 4:10 pm     Reply with quote

carl wrote:
apologies but I don't understand fully what you mean, and have not heard of 'pool' before. Could you kindly explain how and what this means.


sorry, typo Smile ... I meant "poll" Smile; or scanning as often as you can the inputs; it works for sure, I did it before for as many as ~27 inputs on 18f458 for ~3ms signals and I didn't miss one for 2 years now Smile) ...
bkamen



Joined: 07 Jan 2004
Posts: 1619
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Thu Mar 08, 2012 10:24 am     Reply with quote

To chime in as one more vote,

for real "same time" samples - go with the latch design.

Realistically, if super speed was needed, I would CPLD or FPGA the front end and have a PIC as a supervisor/comm device, but simple 74 series gates would do fine here..

Go with the latches... avoid multiple PIC's.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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