Hi everyone Someone posted a question on how to drive a speaker from a PIC for use as a siren or alarm output. I have designed an alarm which has been in production for 18 months and we use the following: ____ 8 Ohm Speaker to 12V ____ |/ | pin -> >--------| |-----|\_|/ ---- | |\ 3k9 \___ BD681 | | GND The BD681 is an NPN darlington and in our application requires no heatsink. We use a low cost horn speaker and it is very loud. I use the following code for a simple beep. beep movlw d'30' movwf beep_count beep_loop bsf Port_B, SIREN_OUT call delay_1ms bcf Port_B, SIREN_OUT call delay_1ms decfsz beep_count, same goto beep_loop return ; ; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ; I use the following code for a bee-bah when the car is locked. The code is written for a PIC16C84 running at 4MHz. short_beep1 clrf beep_count_1 movlw D'142' movwf tone goto short_beep_loop short_beep2 clrf beep_count_1 movlw D'190' movwf tone short_beep_loop bsf Port_B, SIREN_OUT movf tone, w call noise_delay bcf Port_B, SIREN_OUT movf tone, w call noise_delay incf beep_count_1, same movf beep_count_1, w addlw 0xf6 btfss STATUS, CARRY goto short_beep_loop bcf Port_B, SIREN_OUT return ; ; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ; noise_delay movwf noise_counter noise_delay_loop nop decf noise_counter, same movf noise_counter, w btfss STATUS, Z_bit goto noise_delay_loop return ; ; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ; lock_car call short_beep1 call delay_400ms call short_beep2 return The tones sound quite good. A lot can be achieved by modulating the delay between taking the output pin high and taking it low. Subjectively the beep sounds louder when the length of the beep is increased. As the frequency is increased the tones sound softer. Be very sure to set the output pin low at the end of each tone because the current through the speaker is limited only by its series resistance and it dies if the transistor is left on. The transistor also dies. We use the CCS compiler to prototype the more complex sounds and then disassemble the code and hand optimize it before including it in the final product. Hope this is of some help. Regards CdB