<p>I think you are right, they kind of each need a chip.  I was hoping to be smart enough to not to need more hardware. <br>
Does the tiny sport two interrupts?  Or maybe i can tie them together?</p>
<p>I guess i need to learn more about days sheets, too.<br>
Joe</p>
<div class="gmail_quote">On Jul 30, 2014 10:09 PM, "Jon Wolfe" <<a href="mailto:jonjwolfe@yahoo.com">jonjwolfe@yahoo.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:10pt"><div><span>I agree with the others, it sounds like the trigger should get the interrupt.</span></div>
<div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal"><br><span></span></div><div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal">
<span>Like Jeff said, you want your interrupt to execute in as short of a time as possible. One approach might be to just set a flag on trigger presses then process the action in the main
 loop. That could still leave you with 1 sec latency if you are detecting IR hits, which would probably be pretty noticeable.</span></div><div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal">
<br><span></span></div><div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal"><span>I have never tried this on a tiny, but I'm making it a personal mission to find a use case for it, but you could use an RTOS, like <a href="http://www.femtoos.org/" target="_blank">http://www.femtoos.org/</a>  Looks promising. I've used ChibiOS on Cortex M3/4's and found it pretty nice to work with, YMMV. <br>
</span></div><div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal"><span><br></span></div><div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal">
<span>The other alternative approaches might be to try to reduce the 1 second detection loop. Or, to try to architect your own "cooperative multitasking" or coroutines. In short, write your detect loop so that instead of looping for 1 second, it just does a little bit of work and returns to the main loop, remembering where is was in the loop between each call. I use this approach a lot.</span></div>
<div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal"><br><span></span></div><div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal">
<span>I will say that you should try to handle debouncing the trigger in hardware as much as you can. I've tried software debouncing mechanical encoders in interrupt driven routines, and I can attest that it is maddening.</span></div>
<div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal"><br><span></span></div><div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal">
<span>Lastly, you *could* always just buy a separate tiny for the detection, but I have no ulterior motive or bias there ;)</span></div><div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal">
<br><span></span></div><div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal"><br><span></span></div>
<div style="color:rgb(0,0,0);font-size:13.3333px;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:transparent;font-style:normal"><span><br></span></div><div><br></div>  <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:10pt">
 <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt"> <div dir="ltr"> <hr size="1">  <font face="Arial"> <b><span style="font-weight:bold">From:</span></b> Joe Fair <<a href="mailto:joe@fairanswers.com" target="_blank">joe@fairanswers.com</a>><br>
 <b><span style="font-weight:bold">To:</span></b> <a href="mailto:triembed@triembed.org" target="_blank">triembed@triembed.org</a> <br> <b><span style="font-weight:bold">Sent:</span></b> Saturday, July 26, 2014 4:09 PM<br>
 <b><span style="font-weight:bold">Subject:</span></b> [TriEmbed] IR sensor vs trigger<br> </font> </div> <div><br><div><div>Ok.  I'm pretty close on getting my home made laser tag with at tiny 85s going, but now i have a question about design.</div>

<div>The loop I'm using detects a trigger pull, then a hit on the sensors.  however, The pulse in function I'm using to sense IR ha a timeout of 1 second.  If there is no inbound signal it is only checking got a trigger pull once a second.</div>


<div>So i need to use an interrupt, but does it matter if i use one on the trigger pull or the ir sensor? </div>
<div>Joe<br>
</div></div><br>_______________________________________________<br>Triangle, NC Embedded Computing mailing list<br><a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a><br><a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://triembed.org/" target="_blank">http://TriEmbed.org</a><br><br><br></div> </div> </div>  </div></div></blockquote></div>