Comments on: Using Push Button Switch with PIC Microcontroller https://electrosome.com/push-button-switch-pic-microcontroller/ You Inspire.....We Create..... Sat, 11 Apr 2020 15:39:35 +0000 hourly 1 https://wordpress.org/?v=6.1.1 By: Idris https://electrosome.com/push-button-switch-pic-microcontroller/#comments/9596 Fri, 10 Apr 2020 00:20:58 +0000 https://electrosome.com/?p=4371#comment-9596 In reply to Ozan.

in that example he used pull up, the input received voltage from VCc, which make it 1,once the button pressed the input will become 0,that is why our boss instruct the machine that if(port of the input ==0),the port set to be output should be on.

]]>
By: saugata chatterjee https://electrosome.com/push-button-switch-pic-microcontroller/#comments/7230 Sun, 30 Dec 2018 11:13:46 +0000 https://electrosome.com/?p=4371#comment-7230 In reply to Aravind NA.

(LED) = (~LED);
__delay_ms(100);

]]>
By: Stalin AR https://electrosome.com/push-button-switch-pic-microcontroller/#comments/7174 Fri, 28 Sep 2018 07:25:55 +0000 https://electrosome.com/?p=4371#comment-7174 In reply to Ligo George.

Above tutorial is not working properly. I was not able to control LED by switch , LED is glowing like blinking. can you please write the code for that?

]]>
By: Ratnesh Kumar https://electrosome.com/push-button-switch-pic-microcontroller/#comments/7111 Sun, 17 Jun 2018 03:52:10 +0000 https://electrosome.com/?p=4371#comment-7111 hii sir, i want to program led as,
when i pressed 1st button then 1st led on.
when i pressed 2nd button then 1st led off,without realising the 1st button.

please sir tell me.

]]>
By: Ligo George https://electrosome.com/push-button-switch-pic-microcontroller/#comments/7051 Sat, 21 Apr 2018 02:50:36 +0000 https://electrosome.com/?p=4371#comment-7051 In reply to Adam Ubaid.

Better try some other PORTS. For PORTA you need to configure it as digital input first.

Don’t forget to configure TRIS register for setting whether a pin is Input/Output.

]]>
By: Adam Ubaid https://electrosome.com/push-button-switch-pic-microcontroller/#comments/7041 Tue, 10 Apr 2018 04:31:28 +0000 https://electrosome.com/?p=4371#comment-7041 SIR.. PLZ HELP..
I have measured volt+out volt on lcd but ,,i want to measure one button …if i press the button ,then if(PORTA.RA3 == 1) //If the switch is pressed
{
Lcd_Out(2,1,”OVERLOAD “);
overload should be showed on lcd,,
//
my program
float inputread,inputread2, inputmeasured,inputmeasured2, in2,in;
// Lcd module connections start
sbit LCD_RS at RC7_bit;
sbit LCD_EN at RD4_bit;
sbit LCD_D4 at RD5_bit;
sbit LCD_D5 at RD6_bit;
sbit LCD_D6 at RD7_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISC7_bit;
sbit LCD_EN_Direction at TRISD4_bit;
sbit LCD_D4_Direction at TRISD5_bit;
sbit LCD_D5_Direction at TRISD6_bit;
sbit LCD_D6_Direction at TRISD7_bit;
sbit LCD_D7_Direction at TRISB3_bit;

char txt[9]; // declare a char array
char txt2[11]; // declare a char array
void main(){
TRISA.RA1=1; // PORTA is input
TRISA.RA2=1; // PORTA is input
TRISA.RA3=1;
TRISB=0; // PORTC is Output
TRISC=0; // PORTC is Output
ADC_Init(); // Initialize ADC module with default settings
Lcd_Init(); // Initialize Lcd
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,7,”Welcome”); // dsiaplay the welcome logo on the LCD screen at position ROW=1 COLUMN=1
delay_ms(100); // keep displaying logo for 5s
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,3,”Adam Ubaid”);
delay_ms(100); // keep displaying logo for 5s
while(1){

inputread = ADC_Read(1);
inputread2 = ADC_Read(2);// Read analog value from channel 0
delay_ms(5);

inputmeasured=(inputread*4.88)/1000; // converting to value
in = (inputmeasured/0.005);
inputmeasured2=(inputread2*4.88)/1000; // converting to value
in2 = (inputmeasured2/50000.0);
floatToStr(in,txt);
floatToStr(in2,txt2);

Lcd_Out(3,1,”PV Volts”);
lcd_out(3,12,txt);
Lcd_Out(4,1,”OUTPUT V “);
lcd_out(4,12,txt2);
if(PORTA.RA3 == 1) //If the switch is pressed
{
Lcd_Out(2,1,”OVERLOAD “);

}
} }

]]>
By: adam https://electrosome.com/push-button-switch-pic-microcontroller/#comments/7006 Thu, 22 Feb 2018 05:47:03 +0000 https://electrosome.com/?p=4371#comment-7006 Hi sir..I want to interface 5 leds with 1 push button..plz help me!mail me

]]>
By: haziq syahmi https://electrosome.com/push-button-switch-pic-microcontroller/#comments/7001 Fri, 16 Feb 2018 08:52:46 +0000 https://electrosome.com/?p=4371#comment-7001 can help me draw PIC18F4550 AND CODE
MY QUESTION
exercise
Sw1 = led1 on,buz on
sw2 = led2 on,buz off

]]>
By: Ahmed https://electrosome.com/push-button-switch-pic-microcontroller/#comments/6843 Wed, 09 Aug 2017 14:55:00 +0000 https://electrosome.com/?p=4371#comment-6843 Hi, I have watched your tutorial on “Using Push Button Switch with PIC Microcontroller” and I am trying to make something similar, that is, output voltage “3.3V” if input is bigger than 1V using PIC24F16KL402. But initially I want to implement simple output voltage to turn an LED on. I’ve tried:

#include
#include
#include “trial.h”
#include

void main(void) {
TRISB = 0b00000000;
while(1){
PORTBbits.RB3 = 1;
}
}

But nothing is happening. I’m using mplab with pickit 3, everything seems to be fine, the code compiles and gets downloaded to the pic but not working.
Help! Thanks!

]]>
By: John Kaup https://electrosome.com/push-button-switch-pic-microcontroller/#comments/6836 Thu, 03 Aug 2017 10:09:00 +0000 https://electrosome.com/?p=4371#comment-6836 Hi Ligo
I loaded your schematic into proteus with the code and couldn’t get the simulation to run until I replaced the pull-up resistor with a simple diode.

I would like to use your example on a machine. It works like this:
1. I have to push 2 buttons together to get an input to the micro controller
2. Air cylinder 1 must move for a set time and then stop.
3 Air cylinder 2 must move for a set time and then stop.
4. Air cylinder 1 must continue.
5. Air cylinder 3 must move for a set time and then stop.
6. Air cylinder 1 must return to home position.

Am I able to do this or is there a better way?

thankyou in advance
John

]]>