Searching \ for ' Help! Gotta a bug!' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=help+gotta+bug
Search entire site for: 'Help! Gotta a bug!'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] Help! Gotta a bug!'
2001\04\27@004342 by Mike Laurin

picon face
part 1 2916 bytes content-type:multipart/alternative; (decoded quoted-printable)


------ 2001\04\27@004756 by Mike Laurin
picon face
part 1 3876 bytes content-type:multipart/alternative; (decoded quoted-printable)


------ 2001\04\27@070157 by Quentin
flavicon
face
What do you mean locks up the program? Does the PIC stop working? Or
does it stay on one tone?

First, I don't see that you __CONFIG your PIC, so you are not switching
your Watchdog timer off and set your oscilator type (unless you do it in
another way).

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?
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. Tone 3 also has no value for ctr4.

Quentin

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\27@083131 by Drew Vassallo

picon face
>Hi everyone!
>I'm new to PICs and I'm working on my first "real"  project using a
>PIC16F84A.
>I'm building a circuit and writing the code to create a "Simon-Says" toy
>for my daughter. (You remember: the round toy with 4

I've already made a 16F84 Simon.  Check out:

http://www.piclist.com/techref/piclist/simon/index.htm

If it helps, great.  If not, and you still want the toy, just build up the
circuit :)  I'm sure I'm doing it quite differently, though, so it may not
solve your problem, as I'm doing asynchronous tone generation relative to
the user inputs.

One item to note is that I say you can use a 6V "N" size battery (which I
do).  There has been much discussion on this list concerning the fact that
6V is over spec for this chip.  You may want to run 4.8V if not use a 5V
regulator with a 9V battery.  Hasn't caused a problem for me, yet, but it's
worth noting.


--Andrew
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\27@100459 by Mike Laurin

picon face
----- Original Message -----
From: Quentin <spam_OUTqscTakeThisOuTspamICON.CO.ZA>
To: <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU>
Sent: Friday, April 27, 2001 4:01 AM
Subject: Re: [PIC]: Help! Gotta a bug!

Thanks for responding Quentin!


> What do you mean locks up the program? Does the PIC stop working? Or
> does it stay on one tone?

It stays on tone #2.

> First, I don't see that you __CONFIG your PIC, so you are not switching
> your Watchdog timer off and set your oscilator type (unless you do it in
> another way).

I set these in the programming software (PICALL):
XT, WDT off, PU on, CP off


{Quote hidden}

I copied this timer routine out of a beginners book.  If you have a better
suggestion, please let me know.

As I am new to programming any other suggestions would be greatly
appreciated!

Thanks.
Mike

> Quentin
>
> --
> http://www.piclist.com hint: PICList Posts must start with ONE topic:
> [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
>
>

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\27@190911 by Quentin

flavicon
face
Don't know if you got my last email or found help. Piclist seems to be
on the blink (dare I say again, James? hehe).
Found your problem. Your random thing does not work.
You generate a Seed in SEED.
Then you load the seed1 and seed2 into rand1 and rand2 in CYCLE
You do the Sonic thingy which takes you to Tone2, then you goto back to
CYCLE where you again load the same seed into rand, which will take you
again to Tone2. and so on.
You must randomize seed every time. Or not load rand with it. Which I
don't think will give you random. You would still have a set pattern.
Try this for some random number generators:
http://www.piclist.com/techref/microchip/rand8bit.htm

Quentin

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\28@004621 by Mike Laurin

picon face
> 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


2001\04\28@030805 by Quentin

flavicon
face
Earlier I've send this to Piclist, but it seems that it didn't get
through:

> I am not saying the delay is incorrect, I just tried to understand the
> way you using it and that the delay difference between tone 2 and 3 are
> very small as compared to 1 and 4.
> Also see after you called SONIC you call DLAY with out writing values
> into the registers first. Look out for things like that as you can loose
> track what delay times you use. Make a habit of always write to the
> registers even if you "think" you know what the values should be. will
> save you a lot of headaches later on.
But I guess with tone generation you would hear a difference.
Anyway, glad you got it worked. But testing your program in simulator I
found the problem with random generation that keeps on sending me back
to Tone2.

For code snippets and help with PIC's, James Newton collected
information from this list and put it on http://www.piclist.com

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


2001\04\30@051504 by Snail Instruments

flavicon
face
>>         movlw   0xf6            ;
>>         movwf   dlay1           ;
>>         movlw   0x03            ;
>>         movwf   dlay2           ;
>>         call    DLAY            ;
>>
>> DLAY    decfsz  dlay1, f        ;
>>         goto DLAY               ;
>>         decfsz  dlay2, f        ;
>>         goto DLAY               ;
>>         return
>
>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.

Hi Mike,

The above scheme produces sometimes desired, but sometimes undesired delay times. If you load dlay2, dlay1 with 0x0100, it will loop correctly 0x0100 times, but if you load it with 0x0101, it will loop only once.

Josef


=======================================================================
Electronical devices for chemical laboratory, custom electronics design
-----------------------------------------------------------------------
Snail Instruments                      Josef Hanzal, M. S.
Vojanova 615                           phone/fax: +420-311-624433
266 01 Beroun                          e-mail: snailspamKILLspamiol.cz
Czech Republic                         URL: http://www.vitrum.cz/snail/
GPS: 49deg58'28" North, 14deg 4'35" East
=======================================================================

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...