473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

if in a interrupt rountine with a 80c51

hi there,

i have got a problem with a 80c51 processor and Keil C Compiler:

when i use a "if"-structure in a interrupt routine, it is ignored: the
part inside the if-structure will always be executed, even if the
state is false. Can anyone help me?Here a code example:

if (CCF1 = 1)
{
CCF1 = 0;

P0_5 = 1;
}

the code inside is always executed, even if CCF1 = 0.

???why

Jul 27 '07 #1
3 1232
zw**********@yahoo.de writes:
i have got a problem with a 80c51 processor and Keil C Compiler:

when i use a "if"-structure in a interrupt routine, it is ignored: the
part inside the if-structure will always be executed, even if the
state is false. Can anyone help me?Here a code example:

if (CCF1 = 1)
{
CCF1 = 0;

P0_5 = 1;
}

the code inside is always executed, even if CCF1 = 0.
Consider the difference between '=' and '=='.

The comp.lang.c FAQ is at <http://www.c-faq.com/>. See question 20.22.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 27 '07 #2
zw**********@yahoo.de wrote:
hi there,

i have got a problem with a 80c51 processor and Keil C Compiler:

when i use a "if"-structure in a interrupt routine, it is ignored: the
part inside the if-structure will always be executed, even if the
state is false. Can anyone help me?Here a code example:

if (CCF1 = 1)
{
CCF1 = 0;

P0_5 = 1;
}

the code inside is always executed, even if CCF1 = 0.

???why
You are assigning 1 to CCF1, not testing for equality!!!
Then, since the result of the assignment is 1, the
if always succeeds and you always execute the if part.
Jul 27 '07 #3
On 27 Jul., 09:27, zweitakt1...@yahoo.de wrote:
hi there,

i have got a problem with a 80c51 processor and Keil C Compiler:

when i use a "if"-structure in a interrupt routine, it is ignored: the
part inside the if-structure will always be executed, even if the
state is false. Can anyone help me?Here a code example:

if (CCF1 = 1)
{
CCF1 = 0;

P0_5 = 1;

}

the code inside is always executed, even if CCF1 = 0.

???why
Thank you for answers. You helped me a lot!

Jul 27 '07 #4

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

Similar topics

19
by: Jane Austine | last post by:
As far as I know python's threading module models after Java's. However, I can't find something equivalent to Java's interrupt and isInterrupted methods, along with InterruptedException....
2
by: Marco | last post by:
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...
2
by: anil | last post by:
Hi Friends!! Does any body know the interrupt no. of the CD-Rom device to make it function like opening and reading etc..If any body knoow tell me ..I want to learn hardware programming through...
0
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...
2
by: bvermeersch | last post by:
Hi, Here I am again, just learning C# and always wanting to learn the hard things first. As you might already know from other posts I'm trying to convert c++ code to C#. The problem I'm...
27
by: tomhr | last post by:
I have a Borland Turbo C++ compiler (though I never use the "plus-plus" part), copyright 1990. I use this compiler to write simple programs, one of which I am quite dependent on. A month ago, my...
2
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...
5
by: mysli | last post by:
Hi all, I need to write a ISR using Microsoft VC++ 2005. The proplem is I did not found any hint on how to do it. I can register any function as a ISR and it will be called by the hardware...
2
by: =?Utf-8?B?QnJ1Y2UgSFM=?= | last post by:
I'm using VS2005 Winforms. I want a method to allow the user to be able to interrupt an SQL query if he decides he doesn't want to wait for it any longer. I've used IAsyncResult to open an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.