interapt na prekoracenje tmr0 za 16f877

Rasprava o PIC mikrokontrolerima, PIC projekti i drugo vezano za PIC-eve...

Moderators: pedja089, stojke369, [eDo], trax

Post Reply
zoligen
Posts: 16
Joined: 12-08-2006, 06:40

interapt na prekoracenje tmr0 za 16f877

Post by zoligen »

Molim nekog genija za pomoc oko koriscenja interapta na prekoracenje TMR0 na pic16f877 samo jedan primer sam nasao na netu ( slican ovom dole ) medjutim kao sto se iz listinga vidi tu se interapt rutina poziva iz bank1 i koristi u bank1 a ja bih zeleo da koristim interapt rutinu u bank0.
Pokusavao sam da predjem u bank0 pre odlaska u beskonacnu petlju, pokusavao sam da sacuvam vrednost vaznih registara i jos nekoliko stvari ali ne ide.
Evo listinga:

Code: Select all

;	PROCESSOR PIC16F877

Z		EQU     2
E		EQU     3
RP1		EQU     6
RP0		EQU     5
RS		EQU	2
TRISA		EQU	5
TRISB		EQU	6
PORTA		EQU	5
PORTB		EQU	6
STATUS		EQU     3
INTCON		EQU     D'11'
OPTION_REG	EQU     1
PCL		EQU	2
CON		EQU	0x20
TEMP_W 		EQU	0x2C
CHAR		EQU	0x2D
TEMP		EQU	0x2E

_CP_ON                       EQU     H'000F'
_CP_OFF                      EQU     H'3FFF'
_PWRTE_ON                    EQU     H'3FF7'
_PWRTE_OFF                   EQU     H'3FFF'
_WDT_ON                      EQU     H'3FFF'
_WDT_OFF                     EQU     H'3FFB'
_LP_OSC                      EQU     H'3FFC'
_XT_OSC                      EQU     H'3FFD'
_HS_OSC                      EQU     H'3FFE'
_RC_OSC                      EQU     H'3FFF'
 __CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON &_WDT_OFF	
							
	ORG 0X00		
	GOTO MAIN	
	ORG 0X04		
	GOTO PREKID

MAIN	BSF	STATUS,RP0
	BCF	STATUS,RP1	
	MOVLW	B'00000010'	
	MOVWF	TRISA
	BCF	STATUS,RP0
	BCF	STATUS,RP1	

	BSF	PORTA,1	

	BSF	STATUS,RP0
	BCF	STATUS,RP1		

	MOVLW	B'00000100'	
	MOVWF	OPTION_REG	
	MOVLW	B'10100000'	
	MOVWF	INTCON
	CLRF	CON
PETLJA	GOTO	PETLJA		

PREKID	MOVLW	B'10100000'	
	MOVWF	INTCON
	INCF	CON
	MOVLW	D'244'		
	SUBWF	CON,W
	BTFSC	STATUS,Z
	CALL	SEK2
	RETFIE

SEK2	SWAPF	TRISA,F
	RETURN

	END

HVALA UNAPRED!
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Post by trax »

zoligen
Posts: 16
Joined: 12-08-2006, 06:40

16f877 tmr0 interapt

Post by zoligen »

Stvarno radi. Hvala Trax. Mozda bi mogao da preporucis neku literaturu za bolje upoznavanje pic16f877.
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Post by trax »

Ma sta ja znam, procitaj iz tehnicke dokumentacije sve i eto. Garant ima nekih tutoriala po internetu...
zoligen
Posts: 16
Joined: 12-08-2006, 06:40

16f877

Post by zoligen »

O.K.
Post Reply