PIC30f4012 Problems


Closed Thread
Results 1 to 5 of 5
  1. #1
    Insane's Avatar
    Insane Guest

    Default PIC30f4012 Problems

    Hi,

    Were a group doing a final year project.
    Part of this project is to get a BLDC Motor spinning.
    The story goes as follows...

    We had the motor running ... all sweet, usually we could have the motor running whilst interupting for a few seconds to program the chip with a slightly modified code, and then the motor would continue to run.

    However.... one day when programming the chip, the motor stopped and has never spun since. We had PWM working as outputs when the hall sensors were in specific positions and after this download of the code, we had NOTHING.

    We swapped chips to another on which had the working code on it... motor working all sweet again... reprogrammed it .... FAIL.

    Now after checking over everything for the last week still to no avail, we cannot even write and produce a simple "Turn on a Port" program and have it working on a breadboard.

    Weve tried different chips, computers, PICKITS(Another PICKIT3 aswell as another PICKIT2).

    The program builds fine and the program is verified after programming... everything happens as it should except for any sort of output at the pins..

    Were using PIC30f4012 with PICKIT3, running MPLAB IDE v8.30 with C30 compiler.

    At the moment all weve got is the In-Circuit-Programming and the chip on the breadboard.

    The basic code is below for tuning on an LED at each port listed in the code.

    ----------------------------------------
    #include "htc.h"
    #include "p30f4012.h"
    #include "stdlib.h"

    void init(void)
    {
    ADPCFG = 0xFFFC;
    TRISB = 0b000000;
    TRISD = 0b00;

    TRISC = 0x9fff; // RC13 and RC14 are outputs

    TRISD = 0xfffc; // RD0 & RD1 are outputs

    TRISE = 0xffc0; // RE0 - RE5 (PWMs) are outputs

    PORTF = 0;
    TRISF = 0xffff;
    }


    void main(void)
    {
    init();
    while(1){

    PORTBbits.RB1 = 1;
    PORTDbits.RD1 = 1;
    PORTDbits.RD0 = 1;

    }
    }


    --------------------------------------



    Thanks all, hope you can state the obvious!!

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Insane View Post
    Hi,

    Were a group doing a final year project.
    Part of this project is to get a BLDC Motor spinning.
    The story goes as follows...

    We had the motor running ... all sweet, usually we could have the motor running whilst interupting for a few seconds to program the chip with a slightly modified code, and then the motor would continue to run.

    However.... one day when programming the chip, the motor stopped and has never spun since. We had PWM working as outputs when the hall sensors were in specific positions and after this download of the code, we had NOTHING.

    We swapped chips to another on which had the working code on it... motor working all sweet again... reprogrammed it .... FAIL.

    Now after checking over everything for the last week still to no avail, we cannot even write and produce a simple "Turn on a Port" program and have it working on a breadboard.

    Weve tried different chips, computers, PICKITS(Another PICKIT3 aswell as another PICKIT2).

    The program builds fine and the program is verified after programming... everything happens as it should except for any sort of output at the pins..

    Were using PIC30f4012 with PICKIT3, running MPLAB IDE v8.30 with C30 compiler.

    At the moment all weve got is the In-Circuit-Programming and the chip on the breadboard.

    The basic code is below for tuning on an LED at each port listed in the code.

    ----------------------------------------
    #include "htc.h"
    #include "p30f4012.h"
    #include "stdlib.h"

    void init(void)
    {
    ADPCFG = 0xFFFC;
    TRISB = 0b000000;
    TRISD = 0b00;

    TRISC = 0x9fff; // RC13 and RC14 are outputs

    TRISD = 0xfffc; // RD0 & RD1 are outputs

    TRISE = 0xffc0; // RE0 - RE5 (PWMs) are outputs

    PORTF = 0;
    TRISF = 0xffff;
    }


    void main(void)
    {
    init();
    while(1){

    PORTBbits.RB1 = 1;
    PORTDbits.RD1 = 1;
    PORTDbits.RD0 = 1;

    }
    }


    --------------------------------------



    Thanks all, hope you can state the obvious!!
    Wow, where do I start? The obvious, PIC BASIC & PBP is not "C", PIC Basic & PBP does not do 16 or 32 bit PICs, Don't want to send anyone away still hungry . . . Sounds like your "NEW" code has a very glaring problem, I would concentrate on what is different from what worked. Have you changed the configs without realizing it ? Did you upgrade the compiler ?
    Last edited by Archangel; - 28th July 2009 at 08:43.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    Well while we're totally off the topic of the whole forum,
    My car has this problem where the engine stutters when it's idling,
    and the gear change is slack. I wonder if they are two separate problems or the same thing??

    Seriously,
    @ Insane, I just got started with Microchip's C30, but since I haven't had to begin a program,
    (just modify one), I haven't had to configure chips, and pin outputs, etc.

    However, I can see that your while(1) loop turns ports on, and that's all it does.
    Nothing ever changes after that.
    Have you set up the clock properly? some of the dsPics have a PLL that needs to be configured
    even though you've connected the crystal.

    Maybe you should start out with a Microchip development board so you can begin with
    both hardware and software that you know is correct, and then go about changing things.

    Maybe join Microchip's forum:
    http://www.microchip.com/forums/tm.a...55678;�
    where they have a section that specifically deals with their C30 compiler.

    Now about my car.....
    Last edited by Art; - 17th June 2010 at 12:39.

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


    Did you find this post helpful? Yes | No

    Default

    Hi, Art

    I wonder ...

    Doesn't your car clock have a problem too ... ???

    Let's Hope Insane has got an answer ... since last year ...

    Alain
    Last edited by Acetronics2; - 17th June 2010 at 13:17.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  5. #5
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    Ah, is the picbasic section that slow or did I find the thread in a search???

    Apologies

Similar Threads

  1. Problems programming
    By Lionheart in forum General
    Replies: 4
    Last Post: - 7th December 2008, 16:51
  2. 2 PWM in 16F690 problems
    By ciendavila in forum mel PIC BASIC
    Replies: 9
    Last Post: - 27th April 2008, 09:03
  3. bootloader Freqout problems
    By handgio in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2007, 13:38
  4. Input problems
    By ALFRED in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd July 2006, 21:02
  5. HSEROUT Problems
    By SergioRM in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th April 2005, 23:17

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