arnab.bhaumik
Member level 5
- Joined
- Sep 20, 2006
- Messages
- 81
- Helped
- 6
- Reputation
- 12
- Reaction score
- 3
- Trophy points
- 1,288
- Location
- Kolkata, India
- Activity points
- 1,835
$regfile = "m8def.dat"
$crystal = 8000000
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0
Config Lcd = 16 * 2
Config Timer1 = Counter , Edge = Rising
Config Timer0 = Timer , Prescale = 1024
Enable Counter1
Enable Interrupts
Enable Timer0
Enable Timer1
On Ovf1 Int_counter1_1
On Ovf0 Int_timer_0
Dim Int_shomar As Long , A As Long , B As Byte , F As Single
B = 0
Cls
Start Timer0
Lcd "start..."
'******************************************************************************
Do
Loop
End
'******************************************************************************
Int_timer_0:
Incr Int_shomar
If Int_shomar > 30 Then
Stop Timer0
Cls : Home
A = B * 65536
A = A + Counter1
Lcd "frequency="
Lowerline
Lcd A ; "HZ"
B = 0
Int_shomar = 0 : Counter1 = 0
Start Timer0
End If
Return
'******************************************************************************
Int_counter1_1:
Incr B
Counter1 = 0
Return
May I have further information about PIC prescale external clock capability? Any links or documentations?using PIC circuits are ther, at atmega8 we cannot prescale external clock
Tahmid said:Hi arnab,
The Timer2 in AVR can be used for asynchronous counter, study the ASSR register and related Timer2 registers in the datasheet for that.
Hope this helps.
Tahmid.
my problem is to measure at least 30MHz(all HF band of ham radio ) without any costly external prescaler...........
i write this code prior . i hope it be helpul for u.its write under bascom avr
Code:$regfile = "m8def.dat" $crystal = 8000000 Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0 Config Lcd = 16 * 2 Config Timer1 = Counter , Edge = Rising Config Timer0 = Timer , Prescale = 1024 Enable Counter1 Enable Interrupts Enable Timer0 Enable Timer1 On Ovf1 Int_counter1_1 On Ovf0 Int_timer_0 Dim Int_shomar As Long , A As Long , B As Byte , F As Single B = 0 Cls Start Timer0 Lcd "start..." '****************************************************************************** Do Loop End '****************************************************************************** Int_timer_0: Incr Int_shomar If Int_shomar > 30 Then Stop Timer0 Cls : Home A = B * 65536 A = A + Counter1 Lcd "frequency=" Lowerline Lcd A ; "HZ" B = 0 Int_shomar = 0 : Counter1 = 0 Start Timer0 End If Return '****************************************************************************** Int_counter1_1: Incr B Counter1 = 0 Return
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?