working with buttons in microcontroller

Thread Starter

sk8ergirl

Joined Jan 22, 2014
8
Hi,
I'm new to c language for PIC microcontroller using mplab. I have this assignment for embedded system and part of the assignment is that in the circuit there are two buttons (switch) when the user press the click once the action start and when the user click the second button once the action stop I'm getting confusesd with all there terms in microcontroller and c :confused: :confused: I've looked for books in the library but they are all theoretical no explaining for codes or anything I also looked at some sites in google but there weren't much of help

could you help me please
 

shteii01

Joined Feb 19, 2010
4,644
Pro Tip: One of your future assignments will be 9-12 button keypad. If you can not figure out 2 buttons now, what are you going to do in the future?
 

Thread Starter

sk8ergirl

Joined Jan 22, 2014
8
how can I know the name of the button
for eg in java when you want to program a button if the button name is btnDoThis then you would do something like this btnDoThis(java.awt.event.MouseEvent evt)

what about c how do you call button
 

takao21203

Joined Apr 28, 2012
3,702
Hi,
I'm new to c language for PIC microcontroller using mplab. I have this assignment for embedded system and part of the assignment is that in the circuit there are two buttons (switch) when the user press the click once the action start and when the user click the second button once the action stop I'm getting confusesd with all there terms in microcontroller and c :confused: :confused: I've looked for books in the library but they are all theoretical no explaining for codes or anything I also looked at some sites in google but there weren't much of help

could you help me please
i never used books for my microcontroller circuits. But it tooks me some years to get to know them.

With books it takes you only some months
 

shteii01

Joined Feb 19, 2010
4,644
how can I know the name of the button
for eg in java when you want to program a button if the button name is btnDoThis then you would do something like this btnDoThis(java.awt.event.MouseEvent evt)

what about c how do you call button
Did the instructor provide you with the schematic of the circuit?
 

shteii01

Joined Feb 19, 2010
4,644
yes she provided the circuit schematic
The schematic should have a picture of the PIC (usually a rectangle). On that picture there will be labels of the individual pins. The buttons will be connected to these pins. That is how you know the names of the buttons.

Furthermore. Your program should have header files in the very beginning of the program. One of these header files contains the detailed "description" of the pins. You don't really need to dig that deep, but you need to know why you are including these header files.


Post the picture of the schematic. Otherwise this is going to turn into Game of 101 Questions and I am not interested in playing this game.
 

t06afre

Joined May 11, 2009
5,934
To read a button in the microcontroller world is the same as checking the status of a single bit in a port register is it High or Low. The header file for the PIC you are using will give the correct naming. It differs some from the 16F and 18F series PICs. Let us start in that end. Then you can add debouncing later if needed
 

Thread Starter

sk8ergirl

Joined Jan 22, 2014
8
The schematic should have a picture of the PIC (usually a rectangle). On that picture there will be labels of the individual pins. The buttons will be connected to these pins. That is how you know the names of the buttons.

Furthermore. Your program should have header files in the very beginning of the program. One of these header files contains the detailed "description" of the pins. You don't really need to dig that deep, but you need to know why you are including these header files.


Post the picture of the schematic. Otherwise this is going to turn into Game of 101 Questions and I am not interested in playing this game.
Thank you for your help I will post pic of the circuit tomorrow cuz I can't access the lab now :(
thank u again for ur help
 

shteii01

Joined Feb 19, 2010
4,644
Thank you for your help I will post pic of the circuit tomorrow cuz I can't access the lab now :(
thank u again for ur help
No problem. When I was taking microcontroller class, we had our circuits simulated in Proteus, just take a screen shot of the simulated circuit, maybe zoom in on the section where microcontroller and the buttons both shown. So we would have two pictures, the circuit overall and the more specific part of it.
 
Top