Handling interrupt

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hallo,
I have made a microcontroller with keyboard (16 key).

I have a C function to handle interrupt that comes from keyboard when a key
is
pressed.

I should make a C software (not graphic) with a menu.

Every key must corresponds to a option of the menu and when I push one key
the software must load the appropriate function.

In what way can be realized in C?

Thanks
Marco



Re: Handling interrupt

Quoted text here. Click to load it
key
Maybe make an array of 16 pointers to appropriate functions?
Regards, Alex.



Re: Handling interrupt

Quoted text here. Click to load it
key

A good idea!

Many Thanks
Marco





Re: Handling interrupt

Quoted text here. Click to load it
a

That is the way we do it to. Just index the array of function pointers with
a button number. Then all you have to change is the order of items in the
array to change the buttons, simple and effective.



Re: Handling interrupt
Quoted text here. Click to load it

I'd be wary of doing major functional state changes in an interrupt. You
might do better to set a flag, and have the top-level roundrobin pick up and
act upon it.

Steve
http://www.fivetrees.com



Re: Handling interrupt
Quoted text here. Click to load it

Really, that's all there is to it.

You'd be wise to consider the interrupt layer as a signalling layer. Leave
all the major decisions to the top level. Communicate between the two with
flags (specifically, semaphores).

Do you know what a round-robin is? (Briefly: it's top-level code that loops
looking for changes, and acts upon them.)

Steve
http://www.fivetrees.com



Site Timeline