changing code from 16F to 18F microprocessor


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    May 2008
    Posts
    4


    Did you find this post helpful? Yes | No

    Default 16f different than 18f

    Do I need to define / configure all of the ports on the chip or just the ports used in the program? I don't recall defining the ports that way for the 16f and it seemed to compile fine and run well except for the wide range in the counts from the timer loop.

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


    Did you find this post helpful? Yes | No

    Default Have you tried with MPASM

    Hi,

    Have you tried with MPASM ? Could you actually locate the "18F2620.INC" . Default configurations are always there. So I seriously doubt why the program would not compile and issue configuration error. Here it does compile okay.
    Regards

    Sougata

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by SCC_699 View Post
    Do I need to define / configure all of the ports on the chip or just the ports used in the program? I don't recall defining the ports that way for the 16f and it seemed to compile fine and run well except for the wide range in the counts from the timer loop.
    Hi,

    The compiler did it for you ... as your first projects were using the DEFAULT config provided !!!
    For "bigger" chips the compiler DEFAULT config lines are not so numerous as the offered features ... it's you to define what you want !!!

    You, of course, have to define all ports as I or Os , and initialize them ... if you do not want to get unexpected behaviour.

    May be a "midrange" series chip as a second one ( if i understood your post ...) as a 16F628, 16F648 ,16F876a or 16F877a could help for the transition ... with their "limited bunch" ( lol ! ) of peripherals ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    May 2008
    Posts
    4


    Did you find this post helpful? Yes | No

    Default midrange chip

    Alain Thanks for the reply. I would like to use the pic16f877 (since I have a few onhand) but I was concerned it would behave similar to the 16f84a that I am currently using.

    I was experiencing a large variation in the incremented variable despite the fact that the time between the sensors was very precise. (I use the raw counts in a flow calculation.) The actual time between the sensors varies from 2 - 5 seconds depending on the flow. The raw counts for the variable (value) are approximately 33,000 for 1 ml/min flow. The variablity was more than 25% between successive measurements and I also observe a decay in the counts.

    I thought a chip with more capacity would help. I realize now that it is a large leap from one to the other since I will have to rewire the processor board to the 18f pinout.

    If there is a chip you could recommend that would meet the data and calculation needs while trimming down the unused peripherals that would be appreciated as well.

    Thanks

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,139


    Did you find this post helpful? Yes | No

    Default

    I think the closest to F877 is the 18F452. It is pin to pin compatible and has twice the memory. Once I remember porting the almost 7,5K of program directly to the F452 with a couple of DEFINEs on top. Piece of cake.

    Ioannis

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    I think the closest to F877 is the 18F452. It is pin to pin compatible and has twice the memory. Once I remember porting the almost 7,5K of program directly to the F452 with a couple of DEFINEs on top. Piece of cake.
    Ioannis
    Agreed 100%.
    Started out a project a long time ago on a 16F877A. Ran out of memory, plugged in an 18F452, changed a couple of define's, a few register settings, ran great. Ran out of memory again, plugged in an 18F4620, changed a few more register settings...Same program, ran like a champ (then ran out of code space again, built up an 80pin TQFP-> 40 pin DIP adapter for an 18F8722, plugged it in, changed 1 or 2 register settings, doubled the code space, ran great again).

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,139


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Agreed 100%.
    Started out a project a long time ago on a 16F877A. Ran out of memory, plugged in an 18F452, changed a couple of define's, a few register settings, ran great. Ran out of memory again, plugged in an 18F4620, changed a few more register settings...Same program, ran like a champ (then ran out of code space again, built up an 80pin TQFP-> 40 pin DIP adapter for an 18F8722, plugged it in, changed 1 or 2 register settings, doubled the code space, ran great again).
    ... then run out of memory again and plugged a ... x86 core 2 with 2gb of memory!

    Ioannis

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    ... then run out of memory again and plugged a ... x86 core 2 with 2gb of memory!
    Ioannis
    I could run the 18F8722 in external mode and 2GB of flash....and skip the Core2 altogether

    But that's what I get when I kept adding crap on top of crap on top of crap
    I went thru the code awhile back and tried a fair amount of optimizing. Turns out I could've stuck with the '452 if I'd have just been a bit more diligent in the code writing in the first place.

  9. #9
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by SCC_699 View Post

    I thought a chip with more capacity would help. I realize now that it is a large leap from one to the other since I will have to rewire the processor board to the 18f pinout.

    If there is a chip you could recommend that would meet the data and calculation needs while trimming down the unused peripherals that would be appreciated as well.

    Thanks
    Hi, You can try the 18F1320 instead of a 16F84 ... pinout is COMPATIBLE ( care ... pins names are not the same !!! ... so you only have to rename them . )

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. 16F to 18F transition pains
    By lurker in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2008, 01:35
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Changing Swordfish code to PBP
    By Ron Marcus in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th April 2008, 01:28

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