You are on page 1of 2

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

'* Name : freqcount.BAS *


'* Author : VK2TIM *
'* Notice : Copyriht !c" 2##$ %ame& Cut'er *
'* : A'' (iht& (e&er)e* *
'* +ate : 22,--,2##$ *
'* Ver&ion : -.# *
'* Note& : .requency counter for au*io frequencie& *
'* : a& u&e* in VK2TIM'& Au*io /enerator pro0ect *
'****************************************************************
Device = 16F88
@CONFIG_REQ
@__CONFIG _CONFIG1, HS_OSC & PWRTE_OFF & MCLR_ON & BODEN_OFF & LVP_OFF
& WRT_PROTECT_OFF & CPD_OFF & DEBUG_OFF & WDT_OFF & CCP1_RB0 &
FCMEN_OFF & IESO_OFF
XTAL 16
OSCCON = %01100000
TRISA = %11100011
TRISB = %00001111
ANSEL = %00000010
CCP1CON = 0
SSPCON = 0
RCSTA = 0
CMCON = 0!
CVRCON = 0
PORTB_PULLUPS TRUE '1u''up& 2N
Declare ADIN_RES 10 '+ec'are -# Bit re&o'ution on the A+C
Declare ADIN_TAD FRC '+ec'are that the A+C et& it'& time3a&e
from the (C o&ci''ator !42Kh5"
Declare ADIN_STIME 100 'Set the A+C &amp'e time 6 -## i& a &afe
)a'ue to put in here
Declare LCD_DTPIN PORTB"# 'Set& up the hih 7 3it& of 1ortB a& the
*ata pin& for the 8C+
Low PORTA"$ 'Set 1ortA.4 'o9 !(,: pin on the 8C+"
Declare LCD_ENPIN PORTA"# '+efine& 1ort A Bit 7 a& the 8C+'& ;na3'e
pin
Declare LCD_RSPIN PORTA"% '+efine& 1ort A Bit 2 a& the 8C+'& (S pin
Declare LCD_INTERFACE # 'Specify that 9e are ta'<in to the 8C+ in
7 3it mo*e
Declare LCD_LINES % ':e are u&in a 2 'ine *i&p'ay
Di &'( A! "or# ';&ta3'i&h )aria3'e =fre= an* &pecify that
it'& a 9or* &i5e* )aria3'e.
Di )*+ A! Floa$ ';&ta3'i&h )aria3'e =)'t= an* &pecify that
it'& a f'oatin point )aria3'e.
S%&ol ,-. PORTA"0 '12(TA.# 9i'' 3e refere* to a& =pin= for
the remain*er of the proram.
Cl! 'C'ear the 8C+
Pri'$ A$ 1,1,/A01-2 3(.('4+2'/ '+i&p'ay 9hat thi& i&
C(r!or %,1 '1'ace cur&or at 'ine 2
Pri'$ /56 V7%TIM/ '.....an* 9ho *i* it :"
Dela%MS %000 ':ait 2 &econ*&
Cl! 'C'ear the 8C+
*22,8 '8oop that mea&ure& an* *i&p'ay&
frequency an* )o't&
&'( = Co('$er ,-. , 1000 'Mea&ure frequency from pin an* put it
into )aria3'e fre
)*+ = ADI' 1 '+o A to + con)er&ion on 1ortA.-
)*+ = )*+ 9 6::$"6 'Turn the A+C re&u't into a )o'tae )a'ue
)*+ = )*+ ; 0"$ '#.4) off&et for the for9ar* *rop accro&&
the Shott<y *io*e
Pri'$ A$ 1 , 1 , Dec &'(,/ H< / '+i&p'ay .requency on the 8C+
Pri'$ A$ % , 1 , DEC1 )*+,/ V,=, / '+i&p'ay 1ea< to 1ea< )o'tae
at the output on the 8C+
)oTo *22, '/o 3ac< to 'oop aain
!in*efinate'y"

You might also like