i do not know how so please cane you teach me how......??
Here is a picture showing the differences between an active high and an active low push button arrangement.
The 100KΩ resistor and the 33nF capacitor are for debouncing. There are many different ways to debounce a switch. Using an RC filter is just one of them. If you don't know what debouncing is, you can read about it
here.
the color is RED for all the three 7-segment.
A pretty standard forward voltage drop for a red LED is 2V. However, I don't know if the specific 7 segment displays you are using have 1 LED or 2 LEDs per segment. 2 LEDs would be a forward voltage drop of 4V.
There are two things you need to protect for when sizing the resistors.
- You have to ensure that you don't allow too much current to flow through the LED.
- You have to ensure that you don't source too much current from the PIC.
A fairly safe value to use for maximum current draw of most normal red LEDs is 20 mA. So, the maximum current draw you would ever want for the entire display would be:
7 x 20 mA = 140 mA.
However, in section 9.0 on page 49 of the
data sheet for the PIC16F84A it shows that the maximum current sourced by PORTB should not exceed 100 mA. So, the PIC is our limiting factor in this case not the LEDs.
Therefore, the maximum current per segment should not exceed:
100 mA / 7 ≈ 14 mA
To size the resistors for 14 mA per segment use Ohm's Law.
V
s= Supply voltage (5V)
R = Resistor value
I = Current through each segment (14 mA or .014 A)
V
f = Forward voltage of each segment (either 2V or 4V)
V = IR
R = V/I
R = (V
s - V
f)/I
If you aren't sure whether or not your displays have a forward voltage of 2V or 4V assume 2V. That will give you the more conservative result. If the segments are too dim using 2V, gradually decrease the resistance value until the brightness is where you want it but
DO NOT exceed 14 mA per segment.