Hi there !! Name here is Bart, and i have got some problems with my LUTs (lookup tables) & PIC16C73A or 16C76. I have to implement 10 tables of 127 bytes and the problem is that when an interrupt occurs the program counter jumps somewhere in space ... lost in space ... I don't understand the program counter mechanism very well ... Can someone reserve some time to have a look at my experiments I have included 2 files, the main program file and the LUT-file Thanks a lot ... and enjoy ! Main Program: ----------------------- list p=16C76 ; select controller include "P16C76.INC" ; include this file where ; all initialisation of Registers ; are defined. __CONFIG _HS_OSC&_WDT_OFF&_PWRTE_OFF; pointadres equ 0x020 pointvalue equ 0x021 WBACKUP equ 0x022 WBACKUPINT equ 0x023 STATUSBACKUPINT equ 0x024 ;+++++++++++++++++++++++++++++++++++++++++++++++++++ GoSub MACRO Subrtn ; Performa "call subroutine" anywhere in memory. ;+++++++++++++++++++++++++++++++++++++++++++++++++++ movwf WBACKUP movlw HIGH Subrtn movwf PCLATH movfw WBACKUP call Subrtn movwf WBACKUP movlw HIGH $ movwf PCLATH movfw WBACKUP ENDM Startup org 0x000 goto Init ; reset vector address org 0x004 ; interrupt vector address goto ServiceInt org 0x010 Init movlw 0x000 ; pointerwaarden 0..127 movwf pointadres bsf STATUS,RP0 ; PAGE1 bcf STATUS,RP1 ; PAGE1 movlw 0x000 ; PAGE1 movwf TRISB ; PAGE1 movwf TRISC ; PAGE1 movlw 0x007 ; PAGE1 movwf OPTION_REG ; PAGE1 bcf STATUS,RP0 ; PAGE1 bcf STATUS,RP1 ; PAGE1 clrf TMR0 movlw 0x0E0 movwf INTCON Main movfw pointadres ;1 GoSub M_ONTime movwf PORTB movfw pointadres ;2 GoSub L_ONTime movwf PORTB movfw pointadres ;3 GoSub M_PWM movwf PORTB movfw pointadres ;4 GoSub L_PWM movwf PORTB movfw pointadres ;5 GoSub M_MSB movwf PORTB movfw pointadres ;6 GoSub L_MSB movwf PORTB movfw pointadres ;7 GoSub M_Mid movwf PORTB movfw pointadres ;8 GoSub L_Mid movwf PORTB movfw pointadres ;9 GoSub M_LSB movwf PORTB movfw pointadres ;10 GoSub L_LSB movwf PORTB goto Main include "e:\firmware\hbtable.h" ; ServiceInt ServiceInt movwf WBACKUPINT movfw STATUS movwf STATUSBACKUPINT btfss INTCON,T0IF goto ServiceIntEnd Timer0Int bcf STATUS,RP0 bcf INTCON,T0IF bsf PORTC,7 clrf TMR0 bsf INTCON,T0IE ServiceIntEnd movfw STATUSBACKUPINT movwf STATUS movfw WBACKUPINT retfie END Table file: ----------------- ;filename HBTABLE.H ; ; LOOK-UP Table definition ; ; ON_Time adres ; M_ONTime 1600 ; L_ONTime 1700 ; ; PWM_Freq ; M_PWM 1800 ; L_PWM 1900 ; ; 24bconv ; M_MSB 1A00 ; L_MSB 1B00 ; M_Mid 1C00 ; L_Mid 1D00 ; M_LSB 1E00 ; L_LSB 1F00 ; ;*********************************************************************** ****** ;*********************************************************************** ****** ; ; LOOK-UP Table ON_Time ; ;*********************************************************************** ****** org 0x1600 de "M_ONTime",0 M_ONTime ; High part ON_Time addwf PCL,f retlw 0x001 retlw 0x019 *****127 values***** org 0x1700 de "L_ONTime",0 L_ONTime ; Low part ON_Time addwf PCL,f retlw 0x002 retlw 0x032 *****127 values***** org 0x1800 de "H_PWM ",0 M_PWM ; High part PWM frequency addwf PCL,f retlw 0x004 retlw 0x04B *****127 values***** org 0x1900 de "L_PWM ",0 L_PWM ; Low part PWM frequency addwf PCL,f retlw 0x008 retlw 0x064 *****127 values***** org 0x1A00 de "M_MSB ",0 M_MSB ; High part MSB 24bit word addwf PCL,f retlw 0x001 retlw 0x07D *****127 values***** org 0x1B00 de "L_MSB ",0 L_MSB ; Low part MSB 24bit word addwf PCL,f retlw 0x002 retlw 0x096 *****127 values***** org 0x1C00 de "M_Mid ",0 M_Mid ; High part Mid 24bit word addwf PCL,f retlw 0x004 retlw 0x0AF *****127 values***** org 0x1D00 de "L_Mid ",0 L_Mid ; Low part Mid 24bit word addwf PCL,f retlw 0x008 retlw 0x0C8 *****127 values***** org 0x1E00 de "M_LSB ",0 M_LSB ; High part LSB 24bit word addwf PCL,f retlw 0x001 retlw 0x0E1 *****127 values***** org 0x1F00 de "L_LSB ",0 L_LSB ; Low part LSB 24bit word addwf PCL,f retlw 0x002 retlw 0x0FA *****127 values***** Tnx ! , Bart Bart Stofferis Development Engineer Barco Display Systems Labo Rugged & Industrial Displays Theodoor Sevenslaan 106 8500 Kortrijk, Belgium tel. +32 (0)56 233424 fax. +32 (0)56 233013 email: mailto:bart.stofferis@barco.com http://www.barco.com