I am using PIC16F777 and want to control its 3pwms using PBP and activate its hardware PWM's ,i.e.:"hpwm 3,duty, frequency" can anybody help me about it

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!!