473,491 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Handling interrupt

Hallo,
I have made a microcontroller with keyboard (16 key).
I have a function to handle interrupt that comes from keyboard when a key is
pressed.

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

I thought to make into main.c a cicle like this:

while (1)
interrupt_handler
"interrupt_handler" is a function that handles interrupt and tell which key
was pressed.

It contains also a "switch case... case... case..."

where I have assigned a function to every key.

Is it correct?

Thanks
Marco
Nov 14 '05 #1
2 2434
I would know if, when the processor is executing a function called from
"switch case" and I press a key, it stops executing code and read the
function "interrupt_handler" ???
"Marco" <ma*****************@email.it> wrote in message
news:d6**********@news.ngi.it...
Hallo,
I have made a microcontroller with keyboard (16 key).
I have a function to handle interrupt that comes from keyboard when a key is pressed.

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

I thought to make into main.c a cicle like this:

while (1)
interrupt_handler
"interrupt_handler" is a function that handles interrupt and tell which key was pressed.

It contains also a "switch case... case... case..."

where I have assigned a function to every key.

Is it correct?

Thanks
Marco

Nov 14 '05 #2
Marco <ma*****************@email.it> wrote:
I have made a microcontroller with keyboard (16 key).
I have a function to handle interrupt that comes from keyboard when a key is
pressed. I should make a C software (not graphic) with a menu. I thought to make into main.c a cicle like this: while (1)
interrupt_handler "interrupt_handler" is a function that handles interrupt and tell which key
was pressed. It contains also a "switch case... case... case..." where I have assigned a function to every key. Is it correct?


First of all, this isn't really on-topic here in clc, I guess the
newsgroup comp.arch.embedded would be more appropriate. Moreover,
interrupts by their very nature are asynchronous, so they usually
aren't dealt with in a tight loop (maybe unless your program is
supposed to go into the ROM or whatever of the microcontroller of
the keyboard) but there typically are some ways to install handlers
for them (e.g. in a table of function addresses for each possible
interrupt). These get invoked automatically once an interrupt hap-
pens, interrupting the normal flow of the program and for example
pushing information about the newly pressed (or released) key into
some system-internal structure, from where it can be fetched by the
program (either directly or by nicely asking the OS). Of course, how
all of this is done is extremely system dependent and has hardly
anything to do with the language C, which is the topic of this news-
group, so I stop here right now;-)

Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
24798
by: Phui Hock | last post by:
Hi, How do I generate an event and got it handled by a handler? I know how to do it in C++ or Java but I got no idea how to do it in C. What is the best approach to write a function that will take...
5
2553
by: juergen perlinger | last post by:
Hello out there. sometimes I need to have proper control of the floating point arithmetic of the C(and C++) runtime system, and using the f.p. exception handling of the C99 standard is quite...
7
1989
by: siliconwafer | last post by:
Hi All, I am using C on linux and performed a 1/0 operation i.e a divide by zero using integer variables/constants.it gives me a floating point exceptionand the program terminates. I want to...
0
1731
by: LordHog | last post by:
Hello all, I have a little application that will be used for test environment that utilizes the CAN Messaging. The application will capture and then decode the CAN message that are received. In...
12
4102
by: Jack Russell | last post by:
My unstanding of all VB up to and including vb6 is that an event could not "interrupt" itself. For instance if you had a timer event containing a msgbox then you would only get one message. ...
7
2190
by: Stanley S | last post by:
Hi, Are Signal Handling part of ANSI C? I am not able to find any reference of Sig Handling in Stephen Prata's "C Primer Plus". The usage of signals is to trap errors I guess. (It looks...
2
4043
by: Hartmut | last post by:
Hi guys out there..., I am not shure if this is the right forum for my Question. Have a problem using my own Keyboard interrupt handler. The handler works fine as long as i do not press keys...
13
431
by: Speed | last post by:
Hi, I was wondering if there is any way to catch exceptions without knowing in advance what errors may occur. What I mean to say is that is it possible to use try {} on a bunch of lines and...
2
3991
by: anon856525 | last post by:
Hi, I'm trying to write a keyboard handle with Borland. I think the code below should work, but it doesn't compile. The problem is I cannot set the return of getvect() to a void interrupt...
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.