| View previous topic :: View next topic |
| Author |
Message |
dorinm
Joined: 07 Jan 2006 Posts: 38
|
| Re: 24bit Parallel Absolute Encoder Test Box |
Posted: Fri Feb 17, 2012 7:11 pm |
|
|
| 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
|
|
Posted: Sat Feb 18, 2012 5:40 am |
|
|
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
|
|
Posted: Sat Feb 18, 2012 11:17 am |
|
|
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
|
|
Posted: Sat Feb 18, 2012 1:29 pm |
|
|
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
 |
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Mon Feb 20, 2012 8:10 am |
|
|
OK ASM,
I am going to try your plan.
Thanks for all your help.
Carl |
|
 |
dorinm
Joined: 07 Jan 2006 Posts: 38
|
|
Posted: Wed Mar 07, 2012 4:10 pm |
|
|
| 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 ... I meant "poll" ; 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 ) ... |
|
 |
bkamen
Joined: 07 Jan 2004 Posts: 1619 Location: Central Illinois, USA
|
|
Posted: Thu Mar 08, 2012 10:24 am |
|
|
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 |
|
 |
|