1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

16F628 projects?

Discussion in 'Microcontrollers' started by epilot, Jan 1, 2006.

  1. epilot

    epilot Member

    Joined:
    Jul 7, 2005
    Messages:
    487
    Likes:
    0
    Location:
    middle east
    hi there after some of post about 16F84 PIC some of friends here invented me using from 16F628 and today i got a few but can not fond any circuit or project with them in the net!?
    does anyone know any link please?

    i will check tomorrow but before can someone please tell me if 16f628 pins are the same with 16f84? it seems they are not?

    thanks
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,228
    Likes:
    641
    Location:
    Derbyshire, UK
    Check my tutorials, they use the 16F628 - the 16F628 is a direct pin for pin replacement for the 16F84 (or the even older 16C84).
     
  3. epilot

    epilot Member

    Joined:
    Jul 7, 2005
    Messages:
    487
    Likes:
    0
    Location:
    middle east
    i have a program based 16F84 and i used 16F628 instead, the pic becames programmed with my pic programmer but it did not work on the circuit!

    which part of your tutorial? i cheked it but i could not find any project based 16f628!?

    thanks
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. csaba911

    csaba911 Member

    Joined:
    Jul 2, 2003
    Messages:
    242
    Likes:
    2
    Location:
    Canada

    1-7 &9,10
     
  6. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,228
    Likes:
    641
    Location:
    Derbyshire, UK
    You can't just use the same HEX file, you need to reasseble it for the 16F628, the migration document at MicroChip explains the simple steps required.

     
  7. epilot

    epilot Member

    Joined:
    Jul 7, 2005
    Messages:
    487
    Likes:
    0
    Location:
    middle east
     
  8. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,228
    Likes:
    641
    Location:
    Derbyshire, UK
    You can't (easily) alter the HEX files, but it's simple to alter the ASM file and reassemble it - you need to change the GPR start address (0x0C for 16F84 and 0x20 for 16F628), you need to add two lines turning off the comparator module (see my tutorials which all do this), and alter the config fuse settings to be as you want them - not forgetting to change the processor and include names at the top of the assembler file. Then assemble the code, this produces a 16F628 compatible HEX file.

    If you've got a short program, then post it (using the CODE button to keep it formatted correctly), and I'll post it back with the required mods.

    It's really VERY easy!.
     
  9. epilot

    epilot Member

    Joined:
    Jul 7, 2005
    Messages:
    487
    Likes:
    0
    Location:
    middle east
    thanks Nigel i'll try it and if i had a peroblem then let you know

    thanks alot again
     
  10. sweetadam

    sweetadam New Member

    Joined:
    Feb 18, 2007
    Messages:
    1
    Likes:
    0
  11. @rt

    @rt New Member

    Joined:
    Apr 14, 2008
    Messages:
    4
    Likes:
    0
    Hi Guys, First time here :)
    I completed this project a few years ago:
    http://www.freewebs.com/defxev/player.htm
    based on the btc sound algo by Roman Black, but considerable work of my own
    went into the project, as speed/playback control was implemented, and there
    weren't any methods to load the EEPROM at the time, and I had to write a conversion
    program of my own. This was done with a 16f84A, but years later,
    I'm having trouble porting it fro the 16f628, or even understanding it at all after
    a couple of years programming with C.

    I was hoping to use the internal clock of the 16f628, and have a talking
    greeting card ready in time for Mother's Day! :D
    Any help with this would be greatly appreciated.
    Cheers,Art.
     

    Attached Files:

  12. @rt

    @rt New Member

    Joined:
    Apr 14, 2008
    Messages:
    4
    Likes:
    0
    No takers? I thought it was supposed to be dead easy?

    I've tried pasting the 16f628 include file right at the top of my program,
    and setting CMCON to 0x07, which is all that I thought the migration involved,
    but the generated compiler errors are huge.

    Any tips on what I'm not doing?
    This source compiles and runs fine for 16f84A.
    The frustrating thing is that I've written other programs for the 16f628 that work fine,
    it's just been so long since I've touched them. This would probably have been a snap
    a couple of years ago.
     
  13. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    Well you have to change portb to PORTB and the RAM starts at 0x20 on the 16F628
     
  14. @rt

    @rt New Member

    Joined:
    Apr 14, 2008
    Messages:
    4
    Likes:
    0
    Thanks, I've already gotten it working :)
    Once i turned off case sensitivity in the project, the only errors were
    bad RAM addresses, and I soon figured it out from the datasheet.
    Great that you replied though.

    Now I can lower the part count by using internal clock,
    internal pullup resistors, and disable MCLR to save another resistor.
    Pretty crucial when trying to fit it in a greeting card.
    Cheers, Art.
     
  15. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    Good luck, be careful with MCLR & INTOSC, some programmers can't get the chip back into programming mode when those are set.
     
  16. donniedj

    donniedj Banned

    Joined:
    Jan 16, 2004
    Messages:
    336
    Likes:
    3
    Location:
    So Cal
    This is a nice project. I too used that BTC application. What I did different was to use the program flash memory of the, yes its me and my 24F again, 24F family. This way I got rid of the external EEPROM, its price, its slow speed, and its volume consumption :) Made my own vb app to read from the BTC output of retlw 'xxxxxxxx' and convert them to a series of .pword 0x000000 for the 24F family. The resulting file is included in the MPLAB project as an include so that every time I hit build, the micro would automatically be burned with the 1-bit encoding sound fresh out the oven.

    So tell me, how do the asterisks in the words "f**cking" sound, like bleep bleep?
     
  17. @rt

    @rt New Member

    Joined:
    Apr 14, 2008
    Messages:
    4
    Likes:
    0
    Cartman's "F**cking" is censored because the original was recorded from TV in
    Australia where it was censored. I could have used a download, but I sort of
    wanted it that way so I could show it to a wider audience without offending too many people.

    I wrote a program for the Playstation Portable to convert the retlw instructions
    to a bin file. It just looked at the hex values that are in the comment at the end of every line.
    Then I figured out RB's application produces the same bin file directly,
    so it was a waste of time :D

    I still like the EEPROM idea, as the next step is to fit it into a pic wafer card so
    the whole thing is the size of a credit card.
    Also, in a large circuit, it might be desirable to add more EEPROMs on the same I2C bus,
    and run the whole thing faster for better sound quality.

    Each to his own though. I'm sure your version was done to suit your own needs :)
    Cheers, Art.
     

Share This Page