In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Zoot wrote: Yes, I see what you mean.... The idea of the host being able to use the serial line to cancel printing crossed my mind, but: - I would still need an ISR or would need to check (manually) during phases of the entire print loop (some of which are I2C transactions) for the pin state change. - I wanted to also leverage the ability to fill the 64 byte print buffer for the next print *while the current print is in progress) - my host is a BS2, and the chances of missing a pin state change from the module are pretty high, and I wouldn't want to have main execution "waiting" on the print finished signal (that's the lease of it though). - I've been thinking about the idea of the host "canceling" a print in progress and immediately starting another while still rolling; this would let the 'bot print dynamic text in "real-time" depending on quickly changing conditions. In any case, someone PM'ed me last night suggesting the isrFlag delay trick... that won't work because the minimum delay I would get would be 3.5us or so with an ISR running 307khz, and I'd prefer to run at half that, plus the time could be off from 3.5us depending on when the RTCC rolled over before the flag is cleared/checked. But that got me thinking -- the driver basically runs like this: [code] loop through chars fetch character fetch bitmap for character loop through columns of char prep hinoz map prep lonoz map fire hinoz pause 3us fire lonoz pause 100us-25ms (in my case this is never less than 7-15ms) next next [/code] The fire noz code is short, and the delay between whole column firings is relatively long, so I had the idea of clearing/checking an isrFlag right before firing the nozzles -- this would let me know the interrupt *just ran* and at an ISR rate of 153600 would give the mainline approx 6.49us or so to fire the nozzles, pause 3us, fire the other nozzles, before the next interrupt rolls around... that would add -- at most -- 6.5us to the 10ms pause after the column, which is negligible, but leave my 3us pause accurate AND take a minimum hit in the ISR.... e.g. [code] FIRE_NOZL nozLo \CLR isrFlag ' clear flag \JNB isrFlag, $ ' wait till it's set, no longer than 6.49us from now ' then we have ~6.49us of "uninterrupted" time (pun intended) ' to take care of pause; about 120 instructions, which is plenty FIRE_NOZL nozLo \MOV __PARAM1, #30 ' 3us * 20mhz / 2 instructions :waithere \DECSZ __PARAM1 ' pause 3us \JMP :waithere FIRE_NOZL nozHi [/code] I *think* something like that would work... the ISR will be very brief -- just serial rx/tx and buffer handling, plus the flag and an ms timing counter. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=323625#m323723 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)