This is a group for folks designing and programming embedded systems using the Rabbit Semiconductor C-programmable microcontroller. Rabbit Semi is a spin-off from Z-World who makes a variety of embedded modules and tools. This group is not affiliated with either Rabbit or Z-World, but is a user forum for sharing ideas, asking questions,
flaunting knowledge, and other typical user group stuff. The Rabbit is a powerful uC, supported by a full-featured C-compiler.
TimerB - rmoore007ri - Jun 29 14:37:10 2009
Hi All
Below is a simple implementation of Scott Henion's TimerB library. It worked very well to
alternate two LEDs with great precision. Then I wanted to turn one of them off, while
keeping the other flashing. That is where I introduced the "mode" argument. But I cannot
change the value of "mode" in the calling program. if I use a construction like:
nodebug root void TimerBRoutine(mode)
I wind up with errors like:
Old style function declaration missing parameter declaration list.
I know there is something simple I'm missing with respect to syntax. But I have not been
able to solve this.
regards
bob moore
_________________________________________________________________
nodebug root void TimerBRoutine(void)
{
static int BL_ch, GR_ch, ledstate;
static char mode;
#GLOBAL_INIT{BL_ch = 0; GR_ch = 1; ledstate = 0; mode = 'C'; };
ledstate=!ledstate;
digOut (LED1, !ledstate); // LED1 on/off
if (mode == 'C')
{
digOut (LED2, 0); // LED2 off
}
else
{
digOut (LED2, ledstate); // LED2 off/on
}
}
------------------------------------
______________________________
TI's C2000 microcontrollers controlSUITE Desktop gives you instant access to all supporting software libraries, training, collateral, and more!
(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )
Re: TimerB - rmoore007ri - Jul 1 21:46:31 2009
um, syntax. Had to move the type declarations outside of, and before, the ISR. Now that
it's solved it sure seems simple ;-)
_______________________________________________________
static int BL_ch, GR_ch, ledstate, mode;
nodebug root void TimerBRoutine(void)
{
#GLOBAL_INIT{chA = 0; chB = 1; ledstate = 0, mode = 1;}
ledstate=!ledstate;
digOut (chB, !ledstate); // chB on/off
if (mode == 0)
{
digOut (chA, 0); // chA off
return;
}
digOut (chA, ledstate); // chA off/on
}
_______________________________________________________
--- In r...@yahoogroups.com, "rmoore007ri"
wrote:
>
> Hi All
>
> Below is a simple implementation of Scott Henion's TimerB library. It worked very well
to alternate two LEDs with great precision. Then I wanted to turn one of them off, while
keeping the other flashing. That is where I introduced the "mode" argument. But I cannot
change the value of "mode" in the calling program. if I use a construction like:
> nodebug root void TimerBRoutine(mode)
> I wind up with errors like:
> Old style function declaration missing parameter declaration list.
>
> I know there is something simple I'm missing with respect to syntax. But I have not been
able to solve this.
>
> regards
>
> bob moore
>
> _________________________________________________________________
> nodebug root void TimerBRoutine(void)
> {
> static int BL_ch, GR_ch, ledstate;
> static char mode;
> #GLOBAL_INIT{BL_ch = 0; GR_ch = 1; ledstate = 0; mode = 'C'; };
> ledstate=!ledstate;
> digOut (LED1, !ledstate); // LED1 on/off
> if (mode == 'C')
> {
> digOut (LED2, 0); // LED2 off
> }
> else
> {
> digOut (LED2, ledstate); // LED2 off/on
> }
> }
>
------------------------------------
______________________________
Have a look at the new TI MCU Center on EmbeddedRelated.com!

(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )