CtrMode %01110; for detecting negative edges?
Harley
Posts: 997
I have a need to detect a very narrow pulse. It looks like the subject mode might be useful for a 'glitch catcher'.
I searched the Prop manual and the 'search Parallax' for info on this and it seems Graham's tutorial just touched on it without much details.
Would a very short negative pulse be detected if the duration were less than one clock period (1/80 MHz = 6.25 nsec)?
Is there a document which fully describes the edge detection limits? And where is the result held?
It would be nice (Oh, really?) if the edge detection works and could act like an interrupt. Or would a separate cog be required to implement such and 'bang' on another cog to signal the edge event? Hope not, there aren't many cogs left.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
I searched the Prop manual and the 'search Parallax' for info on this and it seems Graham's tutorial just touched on it without much details.
Would a very short negative pulse be detected if the duration were less than one clock period (1/80 MHz = 6.25 nsec)?
Is there a document which fully describes the edge detection limits? And where is the result held?
It would be nice (Oh, really?) if the edge detection works and could act like an interrupt. Or would a separate cog be required to implement such and 'bang' on another cog to signal the edge event? Hope not, there aren't many cogs left.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 7/16/2007 11:42:04 PM GMT
Thanks for the MCP23S08 reference. But really I'd to NOT use any additional hardware. Well, not if the Prop can hack it, and find a way to 'promptly' respond on an edge.
Guess I'm going to have to do some deep digging on the counters. Hadn't though I'd need them, but looks possible.
Amazing how much the Prop offers. Wish the documentation was complete. But realize that is one large task to really get deep. Already the manual is 438 pages. Just remembered, I've also the Hydra manual; time to do some reading on Counters this evening.
Thanks also Paul. Just saw your comments as I was about to preview this.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
details that may be omitted, but the information you asked for is already pretty much in there.
Graham
*Peter*
·
Looking at AN001, pg 18 and 19, this appears like it is getting quite close to what I have in mind. Except....
1. The example code was for a frequency counter. I would like to be able to detect a single event pulse (width would have to be greater than clock period of 80 MHz. It appears that one would set frqa to #1 and phsa to 0 and test for phsa being non-zero. Is this correct?____
2. Would the 'glitch catcher' code have to run in a separate cog?____ I would like to have it in the same assembly cog as what will make use of 'glitch caught' event.
3. In the freq counter example, how does 'freq' value get transferred into the Spin code to be displayed?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
2. No, best in the same cog; each cog can only access its own counter registers.
3. You can access the cog registers directly from spin just like you can from assembly.
Thank you for questions 1. and 2. response. But the example doesn't use 'freq' in the assembly portion, only in the Spin. Hence question 3.
But, what I don't understand is the 'hooks' between the two. Unless there is a correction/update to AN001 I'm not aware of.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
In Spin at COGNEW the PAR register gets the address of the freq variable.
But I think the example is not correct. Right would be: COGNEW(@entry, @freq).
In the Assembly section the measured frequency is written with WRLONG new,par into the freq variable.
The freq is a variable in MainRAM and the new, old, temp ... are variables in the CogRAM of the Assembly cog.
The frequency is measured in the cog with local Cog-variables and is then written in the MainRam, so that Spin can access it.
Andy
Sorry, my original post mentioned 6.25 µsec; I was thinking of Prop gen#2. Such anticipation!!! Should have been 12.5 µsec.
On studying AN001 and thinking about the counters a lot, it appears that the 'transition' modes (%0101x and 0111x) don't really detect the actual transition. But if the change of state exists for more than a system clock duration, then the PHSx value is incremented. Right? If so, then there could be a variable delay of up to 12.5µsec on detecting the transition. Just something to keep in mind if response is critical. Anything wrong in this thinking?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
The Input Pin is sampled with 80 MHz and the sampled state is compared to the state of the last sample. If they are not equal, a transition is detected, and the FRQx is added to PHSx.
If the Pulse is smaller then 12.5ns it can be detected, if it occures exactly at the sampling position, but this is an exeption.