Maybe I am wrong. But I think that the increase and decrease problem is on this code part:
Jesus
Jesus,
If you keep the frequency up (or down) button pressed by holding the button down for a while
then you will see change in the on board LED frequency. It just take a little time to see. Also
if you have a o-scope you can scope the pulse output. There is nothing wrong with the code
because I have checked it before you got the board.
The frequency is a delay subroutine and uses two 8 bit register to form a 16 bit word.
So if you want to increase (or decrease) the frequency by 10 then you need to subtract 10
from the 16 bit word to increase frequency and add 10 to the 16 bit word to decrease the frequency.
The PIC16F88 is a 8 bit micro controller so you will need to make a subroutine that you want
to name add16 and you need a subroutine named sub16. Like this:
;***********************************************************************************
;* 16 bit add
;* adds a 2-byte value with a 2-byte value.
;* Input : AARGB0, AARGB1 + BARGB0, BARGB1
;* Output: AARGB0, AARGB1 17. bit in STATUS,0
;***********************************************************************************
add16 MOVF BARGB1,W ; Get low byte
ADDWF AARGB1,F ; Add to destination
MOVF BARGB0,W ; Get high byte
BTFSC STATUS,0 ; Check for carry
INCF BARGB0,W ; Add one for carry
ADDWF AARGB0,F ; Add high byte into DST
RETURN
;***********************************************************************************
;*****************************************************************************
;* 16 bit sub
;* subs a 2-byte value with a 2-byte value.
;* Input : AARGB0, AARGB1 - BARGB0, BARGB1
;* Output: AARGB0, AARGB1 IF STATUS,0 is set then carry.
;*****************************************************************************
sub16 movf BARGB1,W ; Get low byte of subtrahend
subwf AARGB1,F ; Subtract DST(low) - SRC(low)
movf BARGB0,W ; Now get high byte of subtrahend
btfss STATUS,0 ; If there was a borrow, rather than
incf BARGB0,W ; decrement high byte of dst we inc src
subwf AARGB0,F ; Subtract the high byte and we're done.
return
;*****************************************************************************
Now, these two subroutines uses some new byte variables (RAM variables) that need to be
declared in the top of the program in the CBLOCK part.
Insert:
AARGB0
AARGB1
BARGB0
BARGB1
Now the two new subroutines is ready to be used. Now you can mov the two 8 bit counters
into the match variables, call the sub16 or add16, and then mov the result back into the two
delay registers. This will increase the frequency by 10 or decrease the frequency by 10.
How to do that I leave to you because you need to learn how to make programs.
Groundloop.