Am 06.11.2010 19:33, schrieb Kirk Wallace:
> Thanks Ulf. This is what I have so far:
> http://www.wallacecompany.com/machine_shop/EMC2/AVR/strobe-1a.jpg
> http://www.wallacecompany.com/machine_shop/EMC2/AVR/ServoPStart.comp
>
> It requires charge-pump to be loaded in the servo thread while the
> strobe component is in the base thread. I need to clean up my component,
> variable and pin names to make this component clean, lean and generic. I
> was hoping to have this component stand on its own, but I'll just add
> the it needs charge-pump in the documentation.
Try this:

component ServoPStart      "This component is part of a parport 
interface to an AVR ATtiny2313.(2010/11/05 kwall...@wallacecompany.com)";

pin out bit ServoStart     "This is the output which goes high for one 
period at the input toggle.";
pin out bit strobe "foobar";
pin out unsigned PCount=0  "";

//variable unsigned PCount=0;       // Holds the number of periods since 
the toggle.

//SCount variable counts how many times the counter function is called
variable unsigned SCount=0;

function dostrobe nofp;
function docount nofp;
license "GPL";

;;

FUNCTION(docount) {
   if (SCount) SCount--; //tick
}

FUNCTION(dostrobe) {
   strobe=0;
   ServoStart=0;

   if (SCount) return;
   if (PCount==0) ServoStart=1;
   if (++PCount>=3) { //tack
     //foobar
     strobe=1;
     //reset
     SCount=10;
     PCount=0;
   }
}


------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to