I have a speed alert code which i need to modify with 3 extra push buttons (Used on a PIC16F886) - A ones, tens and hundreds placeholder to input the speed limit
Would you think it would be viable to have both a three button input and an up down input? If not how would i replace the up down counter with these three buttons.
If i keep the up down buttons - How could I add the ones, tens and hundreds placeholder buttons ontop of this? I will be using PORTC - (excluding PIN17 and PIN18 NEEDED FOR EUARTS (RC6 and RC7))
so I'm thinking i'll do the following
Code:
STATUS equ 03h
TRISA equ 87h
PORTC equ 07h
bsf STATUS,5
movlw 03h ; RC0,RC1, RC2 = inputs
; (Hundreds,Tens,Ones)
movwf TRISC
bcf STATUS,5
Register map is included here

(i'll play with RC6 and RC7 once i read up on EUSARTS )
I was planning on having a temp variable - templimit such that I can store the actual speed limit in it as follows:
templimit = (hundreds*100)+(tens*10) + ones.
This would set the speed limit then I'd use the serial EUSART to overwrite this if it needs to be automatically updated.
the locations for the up/down counter is:
*Polling for
- down button: Line 863
- up button: Line 869
* incrementing the speed
- line 925
* decrementing the speed
- line 936
Any help - whether theory or advice would be highly appreciated.
Bookmarks