Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Register Button press PIC18F45K22

Status
Not open for further replies.

ahpan

New Member
Hi guys,

It is weird to ask but could you help me to register the button press. I am able to detect the button debounce. But what I am looking is once button pressed the mic take that button as pressed until I press other button.

The project is to display the received string(which is in terms of tonne) onto GLCD via EUSART . I have implemented the code to change the received string to kilo newton. Once button pressed I want to display only kilo newton value not the one I am receiving. To do so I have to register button press.

I will appreciate your help.

Cheers
 

Attachments

  • button.c
    3.4 KB · Views: 151
  • buttons.h
    414 bytes · Views: 131
Can't you just set a flag when a valid button press has been detected, then clear the flag when the other button press is detected?
 
Thanks for your reply;

I have implemented a Switch case to perform specific task when respective button has been pressed

Code:
unsigned int unit=1;

if (Button1()){
if (unit=4) unit=1;
unit +=1;
}

switch(unit){
case 1: PutChar('1'); break;
case 2: PutChar('2'); break;
case 3: PutChar('3'); break;
case 4: PutChar('4'); break;
}
}
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top