Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 25th October 2009, 08:18 PM   #91
Default

This is my new temperature code:

Code:
      for(tmp=0;tmp<5;tmp++){
        ADCON0bits.GO = 1;          //Start the conversion
        while(ADCON0bits.DONE);     //Wait until it’s done
        result = ADRESH;            //Load ADRESH into result
        result <<= 8;               //Shift over Result 8 bits to the left
        result |= ADRESL;           //OR in our LOW byte to finish off out INT
        avg[tmp] = result;  
        if(KeyPORT == MENU) MainMenu();
        DelayMS(40);
      }       
        result = 0;
        for(tmp=0;tmp<5;tmp++){
            result += avg[tmp];
        }
        result /= 5;
        if(result==oldresult) goto tSame;
        
        DegC = (result*5)/10;
        DegC--;

        DegF = DegC * 9;
        DegF/=5;
        DegF+=32;
        //clear LCD temp buffer
        if(KeyPORT == MENU) MainMenu();
        for(tmp=0;tmp<16;tmp++)
            lcdtmp[tmp] = ' ';

    if(MyView == 'F'){
        lcdtmp[0] = DECtoASCII(DegF,'h');
        lcdtmp[1] = DECtoASCII(DegF,'l');
        lcdtmp[2] = 0xDF;
        lcdtmp[3] = 'F';
        lcdtmp[4] = ' ';
    } else {
        lcdtmp[0] = DECtoASCII(DegC,'h');
        lcdtmp[1] = DECtoASCII(DegC,'l');
        lcdtmp[2] = 0xDF;
        lcdtmp[3] = 'C';
        lcdtmp[4] = ' ';
    }
        if(KeyPORT == MENU) MainMenu();
        LCD_LINE(2);
        LCD_STR((unsigned rom char*)"Temp: ");

        LCD_STR2(lcdtmp);
        DelayMS(DelayTime);

        oldresult = result;
As you can see i test the button every now and then .. this way i have a better chance without interrupts

Last edited by AtomSoft; 25th October 2009 at 08:18 PM.
AtomSoft is offline  
Old 26th October 2009, 12:37 AM   #92
Default

ok, not sure if i understand all that lol, will have a look through what I have and try and figure out the rest.

Thanks again for all the help
dawson is offline  
Old 26th October 2009, 01:15 AM   #93
Default

heh no problem if you need help just ask ok
AtomSoft is offline  
Old 26th October 2009, 01:27 AM   #94
Default

Sure will, thanks you have taught me a lot rther than just saying do this... cause i said so.


Thanks
dawson is offline  
Old 26th October 2009, 01:43 AM   #95
Default

thanks for saying thanks! heh i like helpin
AtomSoft is offline  
Reply

Tags
lcd, menu

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
LCD menu in C? picstudent Micro Controllers 1 13th September 2009 04:48 AM
LCD+keypad interface -> menu structure. Concepts sought. Assembly. PIC. astronomerroyal Micro Controllers 23 29th August 2008 04:59 AM
LG CRT Repair and servce menu. dark666 General Electronics Chat 0 7th June 2008 06:17 PM
Electronic Music Menu cyprio7 General Electronics Chat 0 11th April 2008 04:50 PM
One menu, multiple pages. Anyone good at websites? ThermalRunaway Chit-Chat 6 25th June 2006 11:45 AM



All times are GMT. The time now is 06:07 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker