I meant: toggle GP4 and GP5 to drive the pi‘zo and keep GP0-GP2 unchanged. So I will try your second solution. But, being a beginner, What is meant with: MASK equ GP4 | GP5 > -----Oorspronkelijk bericht----- > Van: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]Namens Scott Dattalo > Verzonden: zondag 12 september 1999 17:08 > Aan: PICLIST@MITVMA.MIT.EDU > Onderwerp: Re: Driving a pi‘zo sounder > > > On Sun, 12 Sep 1999, leo van Loon wrote: > > > I want to drive a pi‘zo sounder on pin GP4 and GP5 in > counter phase with > > leds driven on GP0 to GP2 > > How can I toggle these two pins with minimum code? > > GPn == 1< > MASK equ GP0 | GP2 | GP4 | GP5 > > movlw GP0 | GP4 > movwf GPIO > > loop > movlw MASK > xorwf GPIO,f > goto loop > > This code toggles the LEDs and the piezo. But I'm not sure if > that's what > you're asking. > > MASK equ GP4 | GP5 > > movlw GP4 > movwf GPIO > > loop > movlw MASK > xorwf GPIO,f > goto loop > > This code toggles the piezo without affecting the LEDs. > > Scott >