PDA

View Full Version : Upgrading 16F to 18F



Ron Marcus
- 28th March 2006, 22:00
I am working with an OSD module which displays GPS info in a video stream. It uses a 16F819 and is being clocked externally at about 28 MHz. Since this is outside of spec for this chip (it has worked fine on a dozen chips so far), I'd like to upgrade to a 18F1320. Here's the problem...It's written in assembly, and uses some bank switching and table lookups with indirect addressing. In looking over the 18F manual, it is confusing where the physical start of the RAM is, and what type of bank switching, if any, will be necessary. Has anyone re written a 16F ML program for a 18F series and what will I need to look out for?

Thanks,
Ron

sougata
- 29th March 2006, 09:44
Hi,

The 18F series has an access bank with 128 GPR and SFRs. I personally store my frequently used variables here by:



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:



; 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.