piclist 2001\04\28\004621a >
Thread: Help! Gotta a bug!
picon face BY : Mike Laurin email (remove spam text)

> What seems strange to me is the way you do your delay routines:
>         movlw   0xf6            ;
>         movwf   dlay1           ;
>         movlw   0x03            ;
>         movwf   dlay2           ;
>         call    DLAY            ;
> DLAY    decfsz  dlay1, f        ;
>         goto DLAY               ;
>         decfsz  dlay2, f        ;
>         goto DLAY               ;
>         return
> The first time you decfsz dlay1 you decrease from 0x0f6 to 0x0. Then you
> decfsz dlay2 once and goto back to decfsz dlay1, which will now decrease
> from 0x0 to 0x0ff and then loop back to decrease dlay1 until 0x0 and
> then decrease dlay2 again once.
> Is this the way you wanted it to work?

Yes. I'm counting down from 0x03F6 to 0x00.  I'm using dlay1 and dlay2 to
count down the 16 bit number.  Is there a better way to do it?  I know there
is a way to use TMR0, but I'm not that "advanced" yet.

> Doing it this way there is not much difference in delay between tone 2
> and 3 (few hunderd microsecs or so).
> You do the same with ctr3 and ctr4.

The dlay values produce the desired tones ( a couple of whole tones apart
from each other) and ctr3 controls how long each tone is played.  I
calculated it so that each tone plays for the same duration.  When I run the
program it seems to work as planned.

>Tone 3 also has no value for ctr4.

This was the (stupid) mistake!:
Thats what I get for staying up way too late to program!
Thanks for your help Quentin.

http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

<000a01c0cf9b$4cb3b4a0$79ecd03f@d5b6n0> 7bit

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Help! Gotta a bug!

month overview.

new search...