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 24th October 2009, 09:06 PM   #31
Default

The code you just posted only displays the temprature it does not seem to register any button presses
dawson is offline  
Old 24th October 2009, 09:40 PM   #32
Default

Are your buttons Pulled low? Aka a resistor tied to gnd and when you press button it pushes VDD to pin..

I finished my entire menu and its working perfect. Here is my complete code ... everything is in a ZIP so i dont have to upload like 6 files heh... you can learn more from see everything i got here:

http://atomsofttech.info/code/LM35_menu.zip
AtomSoft is offline  
Old 24th October 2009, 09:44 PM   #33
Default

no my buttons r tied high like this:



Thanks for your code I will take a look through it.
dawson is offline  
Old 24th October 2009, 09:51 PM   #34
Default

There the issue heh. Try changing that define to

#define KeyPORT (~((PORTA>>2)&0x0F))

the. ~. Symbol means opposite I think

Last edited by AtomSoft; 24th October 2009 at 09:53 PM. Reason: Additional info
AtomSoft is offline  
Old 24th October 2009, 10:00 PM   #35
Default

still does not register any button press, I will take a look through your zip to try and work out where I went wrong
dawson is offline  
Old 24th October 2009, 10:01 PM   #36
Default

how are you checking for a button press?
AtomSoft is offline  
Old 24th October 2009, 10:41 PM   #37
Default

doesnt your code check for button press?

Code:
unsigned char WaitForInput(void){

	unsigned char temp1;	//TEMP DATA HOLDER
	unsigned char done = 0; //DONE Var will determine if done

	while(!done){				  //while done == 0
		if(KeyPORT>0){			  //if KeyPORT aka PORTB&0x0F.. the &0x0f will make sure we 
								  //return the lower part of port only RB0 to RB3
			temp1 = KeyPORT;	  //Place the lower part of port into temp variable
			while(KeyPORT==temp1);//Like a debounce for button press
			done = 0xFF;		  //Set DONE Var so we know we are complete
		}
	}
	return temp1;				  //Return our temp1 var
}

Last edited by dawson; 24th October 2009 at 10:42 PM.
dawson is offline  
Old 24th October 2009, 11:00 PM   #38
Default

yeah but when you are going to press menu/enter to show main menu how are you doing it?
AtomSoft is offline  
Old 24th October 2009, 11:19 PM   #39
Default

Take a look:

http://atomsofttech.info/code/menulm35.avi
AtomSoft is offline  
Old 24th October 2009, 11:52 PM   #40
Default

Im not sure what you mean? and your video does not play
dawson is offline  
Old 25th October 2009, 12:01 AM   #41
Default

This code wont work:

Code:
  //--- main loop
  do {
    if(Button(&PORTA,2, 1, 0)) {
             MainMenu();
             }
    else {
            read_temp();
          }
    } while (1);
Change it to :
Code:
  //--- main loop
  do {
    if(KeyPORT == ENTER) {
             MainMenu();
             }
    else {
            read_temp();
          }
    } while (1);
I say it wont work because its always high since pulled high so you have to check for low. Did you change the definition to:

#define KeyPORT (~((PORTA>>2)&0x0F))

Last edited by AtomSoft; 25th October 2009 at 12:03 AM.
AtomSoft is offline  
Old 25th October 2009, 12:03 AM   #42
Default

media player says it's "missing media rights"
bryan is offline  
Old 25th October 2009, 12:05 AM   #43
Default

yes I have changed both those things but it does not recognise button press
dawson is offline  
Old 25th October 2009, 12:08 AM   #44
Default

darn i dont know why its giving you a issue. Can you try making a simple project just to turn a LED on with a button? This way we can see if its the code or what...

Im putting video on youtube now:
YouTube - LM35 Temp Sensor With Menu
AtomSoft is offline  
Old 25th October 2009, 12:10 AM   #45
Default

ok will give it a try
dawson 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:26 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker