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

HELP CODE

i am interested in writing a program in keil for humidity measurement can any body provide the code in C please it is uRgent

Parents
  • Since you didn't state which '51 derivative you are going to use, how exactly you are going to measure humitidy, and what you actually want to do with the data, one can only try to guess these details.

    I'll assume you will measure the humidity with a sensor that can send an interrupt signt, and want to transmit the humidity data to some upstream instance (for example, a PC)

    A very basic framework would look like this:

    extern void initialize();
    extern void process_measurement();
    extern void transmit_data();
    extern bit new_data_available;
    
    int main(void)
    {
        initialize();
    
        for(;;)
        {
            while(!new_data_available);
            process_measurement();
            transmit_data();
        }
    }
    

    Of course, it is lacking almost every detail. You will need to figure out what exactly needs to be done in initialize(), write an ISR that sets new_data_available every time a new value arrives, do some sort of post-processing of the data in process_measurement() and flesh out transmit_data() to send the new value to your chose upstream instance using your chosen type of interface.

Reply
  • Since you didn't state which '51 derivative you are going to use, how exactly you are going to measure humitidy, and what you actually want to do with the data, one can only try to guess these details.

    I'll assume you will measure the humidity with a sensor that can send an interrupt signt, and want to transmit the humidity data to some upstream instance (for example, a PC)

    A very basic framework would look like this:

    extern void initialize();
    extern void process_measurement();
    extern void transmit_data();
    extern bit new_data_available;
    
    int main(void)
    {
        initialize();
    
        for(;;)
        {
            while(!new_data_available);
            process_measurement();
            transmit_data();
        }
    }
    

    Of course, it is lacking almost every detail. You will need to figure out what exactly needs to be done in initialize(), write an ISR that sets new_data_available every time a new value arrives, do some sort of post-processing of the data in process_measurement() and flesh out transmit_data() to send the new value to your chose upstream instance using your chosen type of interface.

Children