saludos este es el prog original
bueno el circuito no lo tengo pero me parece que no hay ningun problema por que esta claramente
en el programa que pines se esta utilizando y en que
bueno la verdad se ensamblador asi que no ando perdido para nada solo que me
con tanto tiempo
invertido , y en cuanto a bascom ya estoy aprendiendo asi que tampoco ando perdido ya tengo un libro pepa para estudiar
aunque recien inicie ayer ese libro me aclara todo con todo lo he de publicar para todos
---------------------------
para este proyecto quiero utilizar componentes que tengo (atmega16,sensores de efecto hall,lcd, creo que es lo basico y si es el caso un cristal 4 8 16 o 20 mhz o usar el oscilador interno O ME CONVIENE USAR OTRO TIPO DE CRISTAL POR QUE ES SEGURO QUE NO LO ENCUENTRE )
------
bueno eeste es codigo original hice algunos cambios pero
en los calculos ayudame en eso
------------
sabes q tambien se basic en PIC y existe una instruccion
count portb.0,2000,servo que asumi que tambien lo tenia bascom pero a la hora de la hora naranjas
-----------
EN CUANTO AL CIRCUITO QUE ME DICES ME GUSTARIA VERLO PA VER QUE NOMAS TIENE
TE AGRADEZCO TU AYUDA Y ADJUNTO EL LINK DEL LIBRO EN BASCOM CON EJEMPLOS CHEVERES LES RECOMIENDO
'------------------------------------------------------------------
' Title Block
' Author: B.Collis
' Date: 14 Aug 2003
' File Name: RevCtr1.bas
'------------------------------------------------------------------
' Program Description:
' Display RPM revs per minute on the LCD
' Program Features:
' outer do-loop
' for-next control
' Timer 1 is setup to count clock pulses between interruptions on this pin
' Timer1 is a 16 bit counter and will count up to 65535
' A second overflow interrupt is triggered if the counter overflows 65535
' this is tracked also
' The calculation for rpm
' = clock frequency *60 / number of counted clock pulses
' The calculation for number of counted clock pulses is
' = T1Capture + OverflowCounter*65536
' Note the clock frequency may be different to the crystal frequency
' there is a prescaler or divider which can be set to 1,8,64,256 or ,1024
' Hardware Features:
' LCD on portc - note the use of 4 bit mode and only 2 control lines
' Opto reflector on ICP portd.6
'------------------------------------------------------------------
' Compiler Directives (these tell Bascom things about our hardware)
$crystal = 8000000 'the crystal we are using
$regfile = "m8535.dat" 'the micro we are using
'------------------------------------------------------------------
' Hardware Setups
' setup ICP
Config Timer1 = Timer , Prescale = 8 , Capture Edge = Rising , Noice Cancel = 1
On Capture1 Isr_cap1
On Ovf1 Isr_ovf1
Enable Capture1
Enable Ovf1
Enable Interrupts
' setup LCD
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.2 , Rs = Portc.0
Config Lcd = 40 * 2 'configure lcd screen
' Harware Aliases
' Initialise ports so hardware starts correctly
'------------------------------------------------------------------
' Declare Constants
'------------------------------------------------------------------
' Declare Variables
Dim Clks_per_min As Long
Dim Overflow As Long
Dim Clks_cntd As Long
Dim Rpm As Long
Dim T1overflow_ctr As Byte
'dimension word variable to hold the value of the capture register
Dim T1capture As Word , Oldcount As Word
' 11. Initialise Variables
T1overflow_ctr = 0
'------------------------------------------------------------------
' 12. Program starts here
Waitms 250
Cursor Off Noblink
Cls
Lcd "rev ctr ver1 B.Collis 2003"
Wait 2
Cls
Clks_per_min = 1000000 * 60 ' clock freq = crystal freq / prescale *60
Clks_cntd = 1 ' just make sure we never divide by 0
Do
Locate 2 , 30
Lcd "Revctr"
If T1capture <> Oldcount Then ' only update if the data is new
Oldcount = T1capture ' get the counted pulses
Clks_cntd = Oldcount ' put into 32 bit variable
Locate 1 , 1
Lcd Overflow ; "* "
Overflow = Overflow * 65536 ' any over flow
Locate 1 , 10
Lcd Clks_cntd ; "* "
Clks_cntd = Clks_cntd + Overflow 'add overflow to counted pulses
Locate 1 , 20
Lcd Clks_cntd ; "* "
Rpm = Clks_per_min / Clks_cntd
Locate 2 , 1
Lcd Rpm ; "* "
Waitms 255 ' only check 4 times per second
End If
Loop
End
'------------------------------------------------------------------
' Subroutines
'------------------------------------------------------------------
' Interrupts' first save the counter value and reset counter
' then save the overflow count and reset it
Isr_cap1:
T1capture = Capture1 ' get the value in the timer
Timer1 = 0 ' clear the timer value
Overflow = T1overflow_ctr ' get the overflowcounter value
T1overflow_ctr = 0 ' reset overflow counter
Return
Isr_ovf1:
Incr T1overflow_ctr ' increment our counter
Return