;********************************************************************* ; ; Filename: TDOA 519 ; Date: 2009-08-26 ; Software Version: 1.0 ; ; Author: Rich Harrington ; Company: KN6FW ; ;********************************************************************* ;****************** Files required *********************************** ; ; 12F519.lkr ; P12F519.INC ; ;********************************************************************* ;****************** Notes ******************************************** ; ; 2 Outputs ; _________________________________ __ ;__________| |_______________________________| ;___________ 500 HZ _________________________________ ; |_______________________________| |__ ; ; |<----------- 1 mS ------------>||<------------- 1mS ----------->| ; -->||<--- 5 uS ; ; The 1mS should be programable from 250, to 4000 HZ ; 2 mS 125 uS ; __ __ ; +5 1|o \/ |8 Gnd ; Output 1 GP5 2| |7 GP0 Pull-up Input 1 inc ; Output 2 GP4 3| |6 GP1 Pull-up Input 2 dec ; Input only GP3 4|______|5 GP2 ; ; ; ; ;********************************************************************* #include ; processor specific variable definitions list p=12F519 ; list directive to define processor ; P12F519.INC Standard Header File, Version 1.03 Microchip Technology, Inc. NOLIST ; This header file defines configurations, registers, and other useful bits of ; information for the PIC12F519 microcontroller. These names are taken to match ; the data sheets as closely as possible. ; Note that the processor must be selected before this file is ; included. The processor may be selected the following ways: ; 1. Command line switch: ; C:\ MPASM MYFILE.ASM /P12F519 ; 2. LIST directive in the source file ; LIST P=12F519 ; 3. Processor Type entry in the MPASM full-screen interface ;========================================================================== ; ; Revision History ; ;========================================================================== ;Rev: Date: Reason: ;1.03 08/26/09 Change from 12C508 to 12F519 ;1.02 05/12/97 Correct STATUS and OPTION register bits ;1.01 08/21/96 Removed VCLMP fuse, corrected oscillators ;1.00 04/10/96 Initial Release ;========================================================================== ; ; Verify Processor ; ;========================================================================== IFNDEF __12F519 MESSG "Processor-header file mismatch. Verify selected processor." ENDIF List __CONFIG _WDT_OFF & _IntRC_OSC & _MCLRE_ON & _IOSCFS_4MHZ ;***** VARIABLE DEFINITIONS ******************************************* ; EQU 0x010 PRF_time EQU 0x011 delay EQU 0x012 loopcnt EQU 0x013 ; EQU 0x014 ; EQU 0x015 ; EQU 0x016 ; EQU 0x017 ;********************************************************************** RESET_VECTOR: ; processor reset vector movwf OSCCAL ; ; Loop: ; Set Output 1 ; 5 uS delay ; Reset Output 2 ; 120 uS delay ; Inc Button Pushed? ; No Yes ; | | ; Read PRF inc PRF_time ; Set delay counter ; | _________ ; |/ | ; Dec Delay | ; Zero ^ ; Yes No | ; | |____| ; | ; Set Output 2 ; 5 uS delay ; Reset Output 1 ; 120 uS delay ; Dec Button Pushed? ; No Yes ; | | ; Read PRF dec PRF_time ; Set delay counter ; | _________ ; |/ | ; Dec Delay | ; Zero ^ ; Yes No | ; | |____| ; Goto Loop ; ; start: movlw 0x00B ; PORT 0,1,3 inputs tris 6 movlw 0x000 ; Turn on pull-ups option movlw 0x7b ; Start PRF at about 800 HZ movwf PRF_time loop: bsf GPIO,4 nop nop nop nop bcf GPIO,5 movlw 0x3c ; 60 movwf delay delay3: decfsz delay,f goto delay3 movf loopcnt,f btfsc GPIO,0 ; Inc Button pushed goto contin1 decfsz loopcnt,f goto contin1 movlw 0x10 movwf loopcnt incf PRF_time,f contin1: movf PRF_time,w movwf delay ; 10 uS !! min should be 120 uS delayl: nop ; 5 uS per loop nop nop decfsz delay,f goto delayl bsf GPIO,5 nop nop nop nop bcf GPIO,4 movlw 0x3c ; 60 movwf delay delay4: decfsz delay,f goto delay4 btfsc GPIO,1 ; Button pushed goto contin2 decfsz loopcnt,f goto contin2 comf PRF_time,w movwf loopcnt decf PRF_time,f contin2: movf PRF_time,w movwf delay delay2: nop ; 5 uS per loop nop nop decfsz delay,f goto delay2 goto loop END ; directive 'end of program'