Hi,
The 18F series has an access bank with 128 GPR and SFRs. I personally store my frequently used variables here by:
Code:
variable var byte bankA SYSTEM
While coding you can select between the access_bank and the FSR for accessing variable. Usually you use it with a ",0" for the Access bank and ",1" for the BSR.
To locate any variable within the GPR area you can do this:
Code:
; Locate the PRICE ARRAY in GPR banks through FSR
movlw Low _PRICE ; Move lowbyte of "PRICE" address to W
movwf FSR0L ; Move W to lowbyte of FSR0
movlw High _PRICE ; Move highbyte of "PRICE" address to W
movwf FSR0H ; Move W to highbyte of FSR0
; now point to the array according to the index
movf _index_in, 0, 0 ; W holds the OFFSET for addressing array
movff _RXFIFO + 6, PLUSW0 ; Move Character to the train buffer(FSR0+W)
; FSR REMAINS UNCHANGED/ ACCESSED THROUGH INDF
In the above example the "PRICE" is a variable not within the system bank. In fact it is an array. So moving a byte to PLUSW0 offsets the FSR through INDF to access next locations. Although my skills are limited, I would like to work on your piece of code. That would increase my skills (I beleive) porting from a 16F to 18F and also improve my video generation routines. BTW I once asked a MICROCHIP guy at the Master's Conference that if a PIC can be overclocked. He answered that an 18F can be overclocked about 40% higher than its rated FOSC max.
Nice Idea to get video pixel clock.
Bookmarks