PIC12F629, useing all I/O pins


Closed Thread
Results 1 to 17 of 17
  1. #1
    Jcee324's Avatar
    Jcee324 Guest

    Default PIC12F629, useing all I/O pins

    Hello

    I am trying to use all the I/O pins on a PIC12F629 (all six of them). I have tried the program code on a PIC16F627 and it workes fine but it is the configuration of the I/O pins of the 12F629 I am worried about. My code is:


    @ DEVICE pic12F629, MCLR_OFF
    @ DEVICE pic12F629, INTRC_OSC_NOCLKOUT

    'Port
    trisio = %001100

    'Variabler
    Ra0 VAR GPIO.2 'Puls Y-axel 5
    Ra1 VAR GPIO.3 'Rotationsriktning Y-axel 4

    Rb4 VAR GPIO.0 'Utgång Y-Axel lila 7
    Rb5 VAR GPIO.1 'Utgång Y-Axel rosa 6
    Rb6 VAR GPIO.4 'Utgång Y-Axel röd 3
    Rb7 VAR GPIO.5 'Utgång Y-Axel svart 2


    I want to use the internal clock and use the mclr-pin as an input. Have I missed something? I hope I have because the program don't work very good.

    I am glad for all the help I can get.
    \Jonas
    http://www.geocities.com/jcee324

  2. #2
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Post

    Tjena Jonas,

    You don't show the rest of your program. You need "CMCON = 7" somewhere in the beginning of your program. I would also recommend you to write something to the two missing bits in "trisio = %001100", just to make sure PBP gets everything aligned correctly. You should also add "DEFINE OSCCAL_1K 1" to calibrate the internal oscillator. You also need to make sure that your programmer actually sets the configuration to what you want, not all programmers do. If this won't make it work you'll need to post all of your code.

    Harebra
    /Ingvar

  3. #3
    Jcee324's Avatar
    Jcee324 Guest


    Did you find this post helpful? Yes | No

    Default

    Hejsan Ingvar!

    Well, once again I had forgot the "cmcon=7". Now my program seems to work. But!!! Now when I have programmed my 12F629 with the working program I can't reprogram it. The programmer answer that there is no pic connected. Why??? I have tried to reconnect the pic (thought it may be loose) but it wont help. I can't erase the pic either.

    Does anyone know what to do????

    \Jonas
    http://www.geocities.com/jcee324

  4. #4
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Jcee,

    J>>Now my program seems to work. But!!! Now when I have programmed my 12F629 with the working program I can't reprogram it. The programmer answer that there is no pic connected. Why??? <<

    A couple of things. Make sure all pins are making contact.
    and make sure you erase the chip before reprogramming. If you are trying to do serial programming ICSP, you will have to disconnect the pins that use the ICSP.

    Another thing, you do not need the define OSC for the 629. It defaults to 4 MHZ.

    DWayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  5. #5
    Jcee324's Avatar
    Jcee324 Guest


    Did you find this post helpful? Yes | No

    Unhappy

    Hello

    Well, the problem is that I can't erase the pic (or program it). Everytime I tries to erase or program it the programmer says that there isn't any pic connected.

    Can the pic been codeprotected? Is there any way to remove a codeprotection if that is the case?

    \Jonas
    http://www.geocities.com/jcee324

  6. #6
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Question

    What programmer and software are you using?

  7. #7


    Did you find this post helpful? Yes | No

    Default missed something important!!!

    Your code refers to Rb ports. The ports on 12F PIC's are GPIO ports.

  8. #8
    Jcee324's Avatar
    Jcee324 Guest


    Did you find this post helpful? Yes | No

    Unhappy

    Hello

    The Rb and Ra ports I refer to is just that I have labeled my I/Os Ra and Rb, that has "nothing" with the program to do. The program workes fine now when I have added "CMCON=7". My problem now is that I can't reprogram or erase the pic. I have to reprogram it because I have to do some small changes in the program.

    I am using Velleman's K8048 programmer and ProgPIC 2. I writes the code in MicroCode Studio Plus.

    \Jonas
    http://www.geocities.com/jcee324

  9. #9
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Post

    1. Make sure your powersupply can deliver a minimum of 13,5V when programming(erasing). 12V is too low for some pics.
    2. Make sure that your COMport is not sharing IRQ with anything else.
    3. Make sure your programmer works with another type pic like PIC16F627.
    4. Try changing the programming speed(high,normal,low).
    5. If you're doing ICSP, try programming the pic directly in the programmer with no ICSP cable attached.
    6. Try another 12F629, just to make sure you didn't fry it on your first testrun.

    /Ingvar

    PS. Don't forget that SW5 should be in the "PROG" position. DS.

  10. #10
    Jcee324's Avatar
    Jcee324 Guest


    Did you find this post helpful? Yes | No

    Unhappy

    I have tried all on your list Ingvar but I still have the same problem. I can drive the program that is on the pic but I can't reprogram or erase it. I have tried two pics, I could erase one of them useing the program "IC-prog" and then reprogram it with ProgPIC2 but not the other one. Is there anyway to reset/erase the pic "manually" by puting voltage on some pins? Or does anyone know another program that I could try?

    \Jonas
    http://www.geocities.com/jcee324

  11. #11
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Question

    Have you tried a different PC?

  12. #12
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Jcee,

    J>>I could erase one of them useing the program "IC-prog" and then reprogram it with ProgPIC2 but not the other one. Is there anyway to reset/erase the pic "manually" by puting voltage on some pins? Or does anyone know another program that I could try?<<

    Whoa there my friend!!!! If you can erase one chip, but not the other...You could very well have a blown chip.

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Lightbulb

    I Agree with Ingvar, maybe the supply line is unsufficient. Can you try.. if available LVP.

    trying another PC can be also a solution, but try adding Buffer/driver(lets say opamp or voltage comparator) on DBs pins

    that's really weird... is your supply line neat, without any noise, can 0.1uf ceramic and 10uF tantalum(47uF electrolytic) be add-on.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    Jcee324's Avatar
    Jcee324 Guest


    Did you find this post helpful? Yes | No

    Unhappy

    Hello

    But, if the chip was blown the program that is on it wouldn't work? Or am I wrong? I can run the program that is on the chip that I can't erase.

    When I tries to erase/reprogram the chip with "ProgPIC2" the program answer that there are no chip connected. The same happens with the other chip (the one that workes) as soon as I programmed it. But after I erased it with "IC Prog" I could reprogram it again. And when I did reprogram it again the same message appears. I know that the chip is connected and that isn't loose.

    I have also tried another power supply. It didn't work.

    \Jonas
    http://www.geocities.com/jcee324

  15. #15
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    for sur if the chip is blown, nothing else will give him the life back.

    The only thing i can see, this chip is now in code protect... but not sure... it looks like so. In this case you ICPROG must return code protected device or something, but no... that's weird

    is it in ICSP???

    what about your schematic on board? is by any chance you can post it??

    trying to help here
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #16
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Jcee,

    J>>But, if the chip was blown the program that is on it wouldn't work? Or am I wrong? I can run the program that is on the chip that I can't erase.<<

    Not necessarily...the part that programs the chip may be blown...*if* that is the only chip it does it on. if your other chips work, then there is something else wrong. Voltages, ICSP pins not disconnected from circuit, or something...

    I once blew a PWM on a 648A.... everything on the chip worked, except the PWM. <g>. So I converted that chip into a Serial LCD chip... <g>.

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  17. #17
    Jcee324's Avatar
    Jcee324 Guest


    Did you find this post helpful? Yes | No

    Talking

    Hello

    I have solved my problem!!! I build myself a JDM-programmer and programmed my 12F629 with it. It worked fine. So there is something with my program that does so the Velleman-programmer can't find the 12F629.

    I want to thank everybody that has tried to help my with my problem. Thanks!

    \Jonas
    http://www.geocities.com/jcee324

Similar Threads

  1. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  2. Aliasing a port with arbitrary I/O pins?
    By Jayhovah in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th May 2008, 15:09
  3. Help Rqd - Driving 5Volt Relay using two pins
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 5th October 2005, 01:54
  4. How to address I/O pins on 12F509?
    By Len in forum General
    Replies: 3
    Last Post: - 25th February 2005, 17:04
  5. Funky I/O pin behavior on PIC12F629???
    By charliez in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th July 2004, 00:29

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