PORT RA0 = 0 and goes high once push button is pressed to extend the cylinder. the problem is sometimes cylinder extend without pressing the push button. Please help me im just a begineer.
Thanks,
Thanks,
Thanks. Am I correct in assuming CON1 is a break-out connector to which your switch is attached? And the switch connects pin 17 to 16 when pressed?sorry im new here. and i dont know what should i put in my poll. i uploaded my schematic.
Try this network (and eliminate R2 and C7). It eats just about any noise you can throw at it, and protects the MCU at the same time.
Route "DIGIN0" to RA0, and the switch between pin 17 and ground. You'll have to add a ground to one of your free pins on CON1, as you don't seem to have one.
The circuit *will not* alleviate the need for software debouncing, if you haven't done it.
I don't know what flowcode is....so I can't help you there.Hi joey, your right for the CON1. R2 and C7 is my pulldown resistor and filter. i put this thinking that it will solve the issue for the noise problem.\
For the code. i used flowcode V5? should i post it?
You will continue to require R2 as the pullup (if you don't use the proffered network). I don't like putting caps on inputs -- I prefer sharp edges.Would it solve the problem if i put a debouncing in my software?IF yes?should i still eliminate R2 and C7?
Normally, I treat mechanical switches as "active low," meaning they pull an input to ground. This way I don't need my PCB's Vdd flying out into space risking shorts. In this case, I'd use a pullup resistor (or, the weak pullups incorporated into some of the MCU pins).Yes my flowcode have debouncing on it.but no idea how long the interval im gonna use. and for the R2?should i use it as a pullup?or a pulldown?
ok my project is about multiplexing. where using a one machine30ms is good for debouncing. Also the 16F877A has a weak pull-up option on PORTB. Ideal for pushbuttons. Any reason you're using the CD4017?
Ok thnx. To bad that i use most of my PORTA as input. and PORTB as output. the problem is that prototype is already running on the production line. CD4017 use as a switching of relay every time it receive signal from the machine. do you want me to explain how may project works?30ms is good for debouncing. Also the 16F877A has a weak pull-up option on PORTB. Ideal for pushbuttons. Any reason you're using the CD4017?
Normally, I treat mechanical switches as "active low," meaning they pull an input to ground. This way I don't need my PCB's Vdd flying out into space risking shorts. In this case, I'd use a pullup resistor (or, the weak pullups incorporated into some of the MCU pins).
You designed for "active high", which means you need pulldown resistors.
The network I showed you is active low from the point of view of the switch, *but* there is an inversion through the 2222. Therefore, the MCU input will see it as active high. No code changes will be necessary.
BTW, I prefer to call the network a "contact-closure" input. I'd usually have two pins on my break-out connector for each switch. One, naturally, would be tied to ground on the PCB, and the other to the input of the network. To activate, it is only necessary to cross the two wires -- i.e. close the contact. This prevents the possibility of inadvertently creating a ground-loop. In your case, if you had multiple switch inputs, you'd need to snake a ground (or, wrt your schematic, +5V) to lots of different places. This is asking for trouble down the road.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
P | How ADC value stores inside ADRESH and ADRESL register for pic16f877a .. #2 | Microcontrollers | 1 | |
microcontroller pic16f877a | Homework Help | 1 | ||
T | ARDUINO CODE TO PIC16F877A CODE | Microcontrollers | 1 | |
A | variable delay in PIC16F877A | Microcontrollers | 5 | |
Hx711 interfacing with PIC16F877A | Microcontrollers | 2 |
by Aaron Carman
by Aaron Carman
by Aaron Carman
by Jake Hertz