Bynase Driver


The BynaseProtocol is easily implemented with a few instructions. However, we've writen most parts with these instructions wrapped into subroutines and factored out into files. We "include" one or another of these files into the startup initialization code of a part.

These drivers define two subroutines and a handfull of pre-allocated registers.

  • byop -- Subroutine to handle bynase input and output. Call byoup every 100 msec or so, more often for a stronger signal, less often for a weaker one.

  • bydle -- Subroutine to delay for a reasonable period between calls to byop.

  • byout -- Register that contains the value that will be output to pin po.

  • byin -- Register that contains the input value read from pin pi.

The two drivers vary in how byin is reset. The bynase.inc expects the caller to clear byin and byop up to, say, 255 times to accumulate a value between zero and, say, 255. The bynase2.inc driver handles this clear automatically (every 255th call to byop) and reloads byin with the most recent value in the process.

Example

Lots of useful parts can be written as simply as:

  reset: 
    .include bynase2.inc

main: (do something with byin and byout here) rcall byop rcall bydle rjmp main


Note: These include files are coded assuming that the processor is clocking at 8 MHz. See FuseOptions.

 

Last edited September 10, 2006
Return to WelcomeVisitors