This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

doubts

hello everyone,
I am writing a code in which, a variable is used in interrupt routine as well as in while(1) loop
I am changing that variable value in interrupt and in while(1) loop
I am confused, while handling it
how can I avoid clashes occurred in interrupt as well as in while(1) loop

another doubt is, if in c language, I want to change the value in a certain location say 0x1234H then how is it possible?

thank you all
take care

Parents
  • thank you for reply,
    I will take care of it.
    in embedded program, we use bit datatype for accessing bit addressable memory of 20h to 2fh
    can I use Boolean in c to access the bits,
    I tried to use it but it gives me an error
    eg: bool flag = true;
    it doesnot recognize it. theni include stebool.h
    but it was of no use
    does Boolean is used in c if yes then how?
    I read about absolute addressing, but it didn’t help me in understanding the access of certain address location
    how can I access an address location say 0x2300H directly in c?
    thank you all
    take care

Reply
  • thank you for reply,
    I will take care of it.
    in embedded program, we use bit datatype for accessing bit addressable memory of 20h to 2fh
    can I use Boolean in c to access the bits,
    I tried to use it but it gives me an error
    eg: bool flag = true;
    it doesnot recognize it. theni include stebool.h
    but it was of no use
    does Boolean is used in c if yes then how?
    I read about absolute addressing, but it didn’t help me in understanding the access of certain address location
    how can I access an address location say 0x2300H directly in c?
    thank you all
    take care

Children
  • Have you spent any time with the example programs supplied with the compiler?

    If not, do so now.

    Have you spent any time with the manual for the compiler?

    If not, do so now.

    bool is a C++ data type. C != C++. C and C++ does not have a one-bit data type, other than as a bit-field in a struct.

    The Keil examples and the C51 manual will clearly inform you about the Keil-specific extention for using bit variables on the C51 architecture.

    Don't ask generic questions about absolute addressing of variables. Post a specific question, with a specific reason for requiring an absolute address.

    The include file for your processor should take care of how to address special function registers in your processor. Your own program should normally not need any variables with absolute address, unless you are implementing a boot loader or similar, or you have added external hardware (other than memory) that you need to access.

    The majority of people who ask about absolute addressing have made a bad design decision, and are doing their best to quickly complicate their lives.