Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Frekvencmetar u PB. Nikako da ozivi
#7
Evo probao sam da ubacim nesto (oznacio sam isprekidanim linijama) i posle bezbroj pokusaja nista,samo menja neki broj na displeju bezveze.Sta bi jos trebalo da se uradi? neznam sta jos da probam.


DEFINE LCD_BITS 4
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 0
DEFINE LCD_RWREG PORTB
DEFINE LCD_RWBIT 3
DEFINE LCD_LINES 2
pause 100
lcdout $FE, 2
lcdout $FE, $80, "BROJ="

trisc.2=1
capture VAR PIR1.2 ' CCP1 capture flag
overflow VAR PIR1.0 ' Timer1 overflow flag
period VAR WORD ' Word variable that stores the value
broj var word
TMR1_Vred Var word
TMR1_Vred = 64535


CCP1CON = %00000100 ' Enable the CCP1 capture, falling edge
T1CON = %00000001 ' TMR1 prescale=1, and turn it on (1uS per count)

mainloop:

pie1.0=1---------------
pie1.2=1---------------
intcon.7=1----------------

IF (capture = 0) Then mainloop ' Wait here until captured


TMR1L = TMR1_Vred.lowbyte 'Postavi TMR1 na 64536
TMR1H = TMR1_Vred.highbyte
period.lowbyte = CCPR1L ' Store the captured value in
period.highbyte = CCPR1H ' period variable

IF overflow = 0 Then ' Skip the output if the timer overflowed
lcdout $FE, $80, "BROJ=",#period
EndIF
capture = 0 ' Clear the capture flag

reset:
IF (capture = 0) Then reset ' Wait for beginning of next period
TMR1L = 0 ' Clear Timer1 low register
TMR1H = 0 ' Clear Timer1 high register
capture = 0 ' Clear capture flag
overflow = 0 ' Clear overflow flag


intcon.7=0-----------------
pie1.0=0---------------------
pie1.2=0-----------------

GoTo mainloop ' Do it forever

End
Reply


Messages In This Thread
Frekvencmetar u PB. Nikako da ozivi - by MILANNN - 10-11-2020, 08:31 AM
RE: Frekvencmetar u PB. Nikako da ozivi - by MILANNN - 10-12-2020, 05:43 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)