avatar_efeworld

18f4620 de tmr0 kesmesi oluşturma

Başlatan efeworld, 01 Eylül 2019, 17:33:32

efeworld

sevgili hocam ben bir programda tmr0 kesmesi oluşturup saat devresi yapmak istiyorum.16f877 ile microcode studio derleme yapıyor ama 18f4620 ile syntax error hatası veriyor derleme yapmıyor.18 serisi için register kullanımları farklımı acaba.yardımlarınızı bekliyorum iyi günler
         PORTA=0:portb=0
TRISB=%00000000
TRISA=%00000000
trisc=0
trisd=0
trise=0
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
define LCD RWREG PORTB
define LCD_RWBIT 2
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
ON INTERRUPT GoTo KESME 
 OPTION_REG=%10000101
INTCON=%10100000
TMR0=0
adcon1=15
SAYAC VAR BYTE
SN VAR BYTE
DAK VAR BYTE
SAAT VAR BYTE
GUN VAR BYTE
CLEAR
PAUSE 200
LCDOUT $FE,1
LOW PORTB.2
BASLA:
LCDOUT $FE,$84,DEC2 SAAT,":",DEC2 DAK,":",DEC2 SN
GOTO BASLA

DISABLE
KESME:
SAYAC=SAYAC+1
IF SAYAC=61 then
SAYAC=0
SN=SN+1
IF SN=60 THEN
SN=0
DAK=DAK+1
IF DAK=60 THEN
DAK=0
SAAT=SAAT+1
IF SAAT=24 THEN
SAAT=0
GUN=GUN+1
IF GUN=365 THEN GUN=0
ENDIF
ENDIF
ENDIF
ENDIF
INTCON.2=0
RESUME
ENABLE

efeworld

18f4620 datasheet e baktım t0con diye bir register var
REGISTER 11-1: T0CON: TIMER0 CONTROL REGISTER
R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1
TMR0ON T08BIT T0CS T0SE PSA T0PS2 T0PS1 T0PS0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as '0'
-n = Value at POR '1' = Bit is set '0' = Bit is cleared x = Bit is unknown
bit 7 TMR0ON: Timer0 On/Off Control bit
1 = Enables Timer0
0 = Stops Timer0
bit 6 T08BIT: Timer0 8-Bit/16-Bit Control bit
1 = Timer0 is configured as an 8-bit timer/counter
0 = Timer0 is configured as a 16-bit timer/counter
bit 5 T0CS: Timer0 Clock Source Select bit
1 = Transition on T0CKI pin
0 = Internal instruction cycle clock (CLKO)
bit 4 T0SE: Timer0 Source Edge Select bit
1 = Increment on high-to-low transition on T0CKI pin
0 = Increment on low-to-high transition on T0CKI pin
bit 3 PSA: Timer0 Prescaler Assignment bit
1 = TImer0 prescaler is not assigned. Timer0 clock input bypasses prescaler.
0 = Timer0 prescaler is assigned. Timer0 clock input comes from prescaler output.
bit 2-0 T0PS2:T0PS0: Timer0 Prescaler Select bits
111 = 1:256 Prescale value
110 = 1:128 Prescale value
101 = 1:64 Prescale value
100 = 1:32 Prescale value
011 = 1:16 Prescale value
010 = 1:8 Prescale value
001 = 1:4 Prescale value
000 = 1:2 Prescale value

t0con=%11010101 yaptım çalıştırdım

Powered by EzPortal