Siren

●●●Flotulopex & Co.

 

| Home | What is it? | Code |

 

 

 

 

Menu

 

 

Morse

REMI

SIMON

FairTime

24VDC Charger

T+T Tester

K2000

TZR Stop Light

PIC

T50 Code Lock

Clignotant

Buzzer "Deluxe"

OPTO-Coupler

SPI DOGM LCD

SPI DOGL GLCD

DCF77

GPS

Cook’s Timer

RF Ringer

Siren

PCB Making

Tools

Miscellanous

 

Downloads

 

Contact

 

 

 

 

 

What is it?

 

Siren is a code made for PIC microcontroller 12F683 generating a sound like an american police car.

 

It is using the PIC’s specific PWM capacity.

 

 

 

 

Code (PICBasic)

 

'****************************************************************

'*  Name    : Siren-Sound_HPWM_12F683.pbp

'*  Author  : FLOTUL

'*  Notice  : Copyright (c) 2015 Flotulopex & Co.

'*          : All Rights Reserved

'*  Date    : 10.03.2015

'*  Version : 1.0

'*  Notes   :

'*          :

'****************************************************************

 

 

' Fuses

'@ DEVICE PIC12F683,FCMEN_OFF

'@ DEVICE PIC12F683,IESO_OFF

'@ DEVICE PIC12F683,BOD_OFF

'@ DEVICE PIC12F683,CPD_OFF

'@ DEVICE PIC12F683,PROTECT_OFF

'@ DEVICE PIC12F683,MCLR_OFF

'@ DEVICE PIC12F683,WDT_OFF

'@ DEVICE PIC12F683,INTRC_OSC_NOCLKOUT

 

@ __CONFIG _FCMEN_OFF &_IESO_OFF &_BOD_OFF &_CPD_OFF &_CP_OFF &_MCLRE_OFF &_PWRTE_OFF &_WDT_OFF &_INTRC_OSC_NOCLKOUT

 

'-------------------------------------------------------------------------------

' Registers   76543210

OSCCON     = %01110000  'Internal 8MHz osc

ANSEL      = %00000000  'Disable analog inputs

ADCON0     = %00000000  'ADC is OFF

CMCON0     = %00000111  'Comparator is OFF

OPTION_REG = %10000000  'Pull-Ups disabled

TRISIO     = %00000000  'All PORTBs are Outputs

GPIO       = %00000000  'All PORTBs are Low

 

'-------------------------------------------------------------------------------

' Defines

DEFINE OSC 8

 

'-------------------------------------------------------------------------------

' Variables

Tone    VAR WORD

Tone    = 500

'Speed   var byte

'Speed   = 1

 

'-------------------------------------------------------------------------------

' Program

MAIN:

 

    WHILE Tone < 1200

        HPWM 1,127,Tone

        'pause Speed

        Tone = Tone + 1

    WEND

    WHILE Tone > 500

        HPWM 1,127,Tone

        'pause Speed

        Tone = Tone - 1

    WEND

 

    GOTO MAIN

END