Picsim project
Budget: ₹1,500 – ₹2,000 INR
count the number of times switch 1 was hit and display it on the seven segment when switch was hit redact it from the number of counts.
For this reason we need to initialize the relevant ports of portA as inputs (in the TRISA register), and the relevant ports of portB as outputs (in the TRISB register).
Inside the while loop check whether switch 1 or 2 were pushed. its wise to employ a debounce method so we don’t become to sensitive to short pushes – so keep checking whether the button was pushed for 100 consecutive times. (Note: the relevant bit is 0 when pushed).
Then write to portB 1’s where the segments should light.
It’s best to make a function a head of time that converts the digits to seven segment bits.
Count should be wrapped around
For this reason we need to initialize the relevant ports of portA as inputs (in the TRISA register), and the relevant ports of portB as outputs (in the TRISB register).
Inside the while loop check whether switch 1 or 2 were pushed. its wise to employ a debounce method so we don’t become to sensitive to short pushes – so keep checking whether the button was pushed for 100 consecutive times. (Note: the relevant bit is 0 when pushed).
Then write to portB 1’s where the segments should light.
It’s best to make a function a head of time that converts the digits to seven segment bits.
Count should be wrapped around