I am trying to characterize my AS5311 linear magnetic encoders,
and I need to capture the encoder count value when certain pins
change state.  I've been studying hal comps, and it looks like a
variation on edge.comp and sample_hold.comp is about what I want.
Unfortunately, I can't seem to get edge, sample_hold, or my new
sample.comp functions to work, at least as viewed with "show configuration"
in Axis or halrun.  If I put a watch on all the pins of any of these components,
I can see the inputs change, but outputs do not.

There must be something simple and obvious that I'm missing.  Any
suggestions?

component sample "Sample";
pin in s32 in       "Value stored when desired edge detected";
pin in bit edge;
param rw bit in_edge=TRUE "TRUE means falling, FALSE means rising";
pin out s32 out;
function _ nofp;
license "GPL";
;;
FUNCTION(_) { 
    if (in_edge && (edge < last)) {
        out = in;
    }
    if (!in_edge && (last < edge)) {
        out = in;
    }
    last = edge;
}


Thanks,
-- Ralph

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to