4-bit binary counter (using 4 LEDs) that counts from 0 to 15 (0000-1111 binary). four LEDs are connected to RB0 through RB3 port pins of PIC18F2520. A push button switch is connected to pin RA1 to provide input for the counter. The counter starts from 0, and increase by 1 every time the button is pressed. When the counter reaches 15 (all LEDs on), it will reset to 0 on the next press of the button.
pls explain how to do in ccs c compiler?
- - - Updated - - -
This is i ve tried in CCS c compiler. please correct me if wrong
my program works fine with certain changes. when i pressed the button once, corresponding LED must glow. but due to switch bouncing, i've got some problem. i have reduced with some delays in the program. but still i want a perfect solution. how to do debouncing program in ccs c compiler? please help me.