
Originally Posted by
Insane
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.
Bookmarks