I hope that's NOT the code you are using!!!!
What does the PIC do AFTER it executes Buzzer=1 ?
You must NEVER have the processor just run off the end of your program, because what it does thereafter is unpredictable.
If you're just testing your Buzzer, do something like...
Code:
Loop:
Buzzer=1
Pause 1000
Buzzer=0
Pause 1000
Goto Loop
End
Never just end your program... because there is no guarantee that the last thing you told your program to do is the last thing that happens. There's all kind of free and available memory locations in Program Codespace that could be executed that you don't know about. There's no guarantee that your unused memory is blank, or that your programmer erased it. So be safe and always terminate your program in some kind of loop... even if its just...
Code:
Loop:
Buzzer=1
Goto Loop
End
Oh, and I don't think ANSEL affects GPIO.5.
Finally, if your Buzzer still doesn't work after the above, you might need a driver Transistor if the current requirement is too high. Beware, some Buzzers are kinda nasty, and produce a back-emf which could kill a PIC's I/O.
Bookmarks