Convert from 16f877a to 18f458


Closed Thread
Results 1 to 6 of 6
  1. #1
    svein97's Avatar
    svein97 Guest

    Default Convert from 16f877a to 18f458

    I have reached the memorylimit, and wants to convert the program to a 458-device.
    I have selected the 18f458 in Microcodestudio, and compiled.
    In MPLAB I select the config. bits and set osc to HS( Like I did for 877a).
    The oscillator does not start, and the device is not working at all.

    Hints?

  2. #2
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by svein97
    I have reached the memorylimit, and wants to convert the program to a 458-device.
    I have selected the 18f458 in Microcodestudio, and compiled.
    In MPLAB I select the config. bits and set osc to HS( Like I did for 877a).
    The oscillator does not start, and the device is not working at all.

    Hints?
    I've used the 452 for quite some time now.I have had no issues. Are you using a crystal or resonator? Have you tried a simple loop program to flash a LED or make a sound? There are different registers to config at start up, and there could be a number of mechanical reasons it doesn't work either. Have you tried substituting the processor with a spare?

    Ron

  3. #3
    svein97's Avatar
    svein97 Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ron Marcus
    I've used the 452 for quite some time now.I have had no issues. Are you using a crystal or resonator? Have you tried a simple loop program to flash a LED or make a sound? There are different registers to config at start up, and there could be a number of mechanical reasons it doesn't work either. Have you tried substituting the processor with a spare?

    Ron
    Same prog.Same osc. (20 mc crystal). Spares is the same...
    That is... the same circuit, same program. The 877a works fine.
    Last edited by svein97; - 30th November 2005 at 21:08.

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    svein97, I have also changed from 16F877 to 18F452 without any problems. Down load the data sheet and make sure the oscillator settings are correct and the RA6 pin is set correctly. It can be used as an I/O line with this processor unlike the 16F877. Also make sure the oscillator switch is disabled as it can be changed within the operating software. Attached is one of the configuration sequences I use. Look at the registers I set and read the data sheet to see if they affect the way you configure your old code for the 16F877.

    OSCCON = 0 'SET SYSTEM CLOCK SWITCH BIT
    RCON = %00011111 'CLEAR IPEN,RI,TO,PD,POR,BOR
    INTCON2 = %11000000 'NO PULL-UPS,INTEDG0 RISING,INTEDG1,INTEDG2,TMR01P,RBIP
    INTCON3 = %00000000 'CLEAR INT2IP,INT1IP,INT2IE,INT1IE,INT2IF,INT1IF
    ' PIE1 = %00100000 'CLEAR ALL INTERRUPT ENABLE BITS(EXCEPT RCIE)
    PIE2 = %00000000 'CLEAR ALL INTERRUPT ENABLE BITS
    IPR1 = %00000000 'SET ALL INTERRUPT PRIORITY BITS TO LOW
    IPR2 = %00000000 'SET ALL INTERRUPT PRIORITY BITS TO LOW
    PIR1 = %00000000 'CLEAR ALL INTERRUPT FLAGS
    PIR2 = %00000000 'CLEAR ALL INTERRUPT FLAGS
    ADCON0 = %10000001 'FOSC/64,AN0,A/DONE,A/D OFF
    ADCON1 = %11000010 'RIGHT JUST,A/D CLOCK SELECT,RA0:RA3,RA5 ANALOG PINS, RE0:RE2 DIGITAL PINS
    LVDCON = %00001111 'CLEAR IRVST,LVDEN,AND SELECT LVDIN
    WDTCON = %00000000 'DISABLE WATCH DOG TIMER

    TRISA = %101111 'INITIALIZE PORT DIRECTIONS
    TRISB = %01101111
    TRISC = %10101001
    TRISD = %00000011
    TRISE = %00000111

    T0CON = %00000000 'PRESCALER,WRITE PRESCALER 1/2, TURN OFF TIMER 0
    ' T1CON = %10000100 'WRITE PRESCALER 1/1, TURN OFF TIMER 1
    T2CON = %00000100 'WRITE PRESCALER 1/1, TURN ON TIMER 2
    T3CON = %10000100 'WRITE PRESCALER 1/1, TURN OFF TIMER 3
    TMR2 = 0 'CLEAR TMR2 MODULE REGISTER
    PR2 = $FF 'SET PERIOD (1/1 PRESCALE * 256 PR2 * 1/40,000,000 * 4 = 39.06 Khz.
    CCPR1L = $00 'CLEAR UPPER 8 BITS
    CCPR2L = $00 'CLEAR UPPER 8 BITS
    CCP1CON = $0C 'PLACE CCP1 INTO PWM MODE
    CCP2CON = $0C 'PLACE CCP2 INTO PWM MODE


    Dave Purola,
    N8NTA

  5. #5
    svein97's Avatar
    svein97 Guest


    Did you find this post helpful? Yes | No

    Default

    Tried to load with the same... wont work! The PIC doesn't start!!!!! Not at all!!
    Uses the MPLAB, Osc= HS, osc.sw=disble,pwrup timer=dis,brown....enable 2,4v...WDT enable...wdtPs=128 StackOF=En.

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    svein97, Are you using a crystal or a resonator? I only use resonators as they are cheaper and have had no problems with them in the last 10 years even at high baud rates. I wonder about your choice of caps to ground at the crystal. They should be no more than about 12pF and should be as close to the VSS pin as possible. I did notice that you are enabling the watchdog timer option. Are you using it within your code? Also I use a 10k resistor to VDD thru a 1N4148 to the RESET/VPP pin on the PIC for the reset circuit as I have provisions for ICSP on my boards. If you have access to an oscilloscope with a 1pF 10x probe look at the OSCout pin and see if it is in oscillation after power is applied. Also make sure that BOTH VSS pins are tied to ground of your supply. LOL

    Dave Purola,
    N8NTA

Similar Threads

  1. 16F877 vs. 16F877A
    By DavyJones in forum General
    Replies: 12
    Last Post: - 11th April 2009, 18:22
  2. help my bluetooth and PIC 16F877A?
    By slimpeng in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th March 2008, 06:52
  3. 16F877A problem: "coupled" digital values
    By Lupo83 in forum General
    Replies: 16
    Last Post: - 4th December 2007, 12:46
  4. Clock connection to DS1802 from 16F877A
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd January 2006, 18:52
  5. 1st 16F877A program in PICBasic
    By Borisw37 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th January 2005, 04:46

Members who have read this thread : 0

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