----- Original Message ----- From: Quentin To: 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 > 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. 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