Overunity.com Archives is Temporarily on Read Mode Only!



Free Energy will change the World - Free Energy will stop Climate Change - Free Energy will give us hope
and we will not surrender until free energy will be enabled all over the world, to power planes, cars, ships and trains.
Free energy will help the poor to become independent of needing expensive fuels.
So all in all Free energy will bring far more peace to the world than any other invention has already brought to the world.
Those beautiful words were written by Stefan Hartmann/Owner/Admin at overunity.com
Unfortunately now, Stefan Hartmann is very ill and He needs our help
Stefan wanted that I have all these massive data to get it back online
even being as ill as Stefan is, he transferred all databases and folders
that without his help, this Forum Archives would have never been published here
so, please, as the Webmaster and Creator of these Archives, I am asking that you help him
by making a donation on the Paypal Button above.
You can visit us or register at my main site at:
Overunity Machines Forum



Feedback To Source

Started by nievesoliveras, December 21, 2008, 11:28:28 AM

Previous topic - Next topic

0 Members and 29 Guests are viewing this topic.

nievesoliveras

Maybe I am wrong. But I think that the increase and decrease problem is on this code part:

Jesus

Groundloop

Quote from: nievesoliveras on April 28, 2011, 08:42:51 AM
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.

nievesoliveras

Thank you @groundloop!

It is one of my goals, to learn to write useful programs.

Jesus

nievesoliveras

Using @groundloop's code for the two outputs board, with basic and without using the hyperterminal I made this program in order to use the board without a PC.

The simulation gif file can be downloaded here: http://www.overunity.com/index.php?action=downloads;sa=view;down=468

Jesus

nievesoliveras

I have found problems to get the right parts.

Jesus