Upgrading 16F to 18F


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373

    Default Upgrading 16F to 18F

    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

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Probably its simpler.

    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.
    Attached Images Attached Images  
    Regards

    Sougata

Similar Threads

  1. USB in PIC16Xxx and PIC18Xxx
    By asterix in forum General
    Replies: 1
    Last Post: - 2nd March 2009, 21:45
  2. 16F to 18F transition pains
    By lurker in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2008, 01:35
  3. changing code from 16F to 18F microprocessor
    By SCC_699 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 14th May 2008, 13:27
  4. 16F to 18F context saving differences
    By brittons in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st April 2007, 03:40
  5. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th December 2005, 23:30

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts