Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

LED blink beginner problem

Status
Not open for further replies.

Slayer986

Newbie level 2
Newbie level 2
Joined
Aug 12, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,295
Hi to you all!

I have one small problem with my dsPIC33. I have successfuly programmed the PIC (uploaded the hex into it) but when i try it on my breadboard, nothing hapens! All of the pins neded to be connected (Vss, Vdd, AVss and AVdd) are connected and powered corectly but mu LED still doesnt flash! Does anybody knows the solution to my problem? Once again, my programm is OK (it compiles without any errors) and the algorithm itself is okay.
Thanks in advance!
 

Just because your code compiles without error doesn't mean it's going to do anything useful. You don't give us any information that can help us figure out what you've got.

Maybe your led is in backwards.
Maybe your crystal is broken.
Maybe your reset is being asserted.
 

Barry,

LED is right way in, i am not using external crystal but an internal one (properly configured), not sure what do you mean by "reset being asserted". Thank you for your reply!
PS: here is the code:
Code:
#include <xc.h> 

#pragma config FNOSC = FRCPLL 
#pragma config PWMLOCK = OFF 
#pragma config FWDTEN = OFF 
#pragma config JTAGEN = OFF 
#pragma config ICS = PGD3 

void __attribute__((__interrupt__, __auto_psv__)) _T2Interrupt(void);


void __attribute__((__interrupt__, __auto_psv__)) _T2Interrupt(void) {


    _T2IF = 0;


    _LATB5 = 1 - _LATB5;

}


int main(void)
{
   
    
    _PLLDIV = 256;
    _PLLPOST = 1;
    _PLLPRE = 2;

   
    while(_LOCK == 0);
    
    
    TRISBbits.TRISB5 = 0; 

    
    _LATB5 = 0;

    /* -------------- TIMER2  -------------------------- */
    T2CON = 0;            // Clear Timer 2 configuration
    T2CONbits.TCKPS = 3;  // Set timer 2 prescaler (0=1:1, 1=1:8, 2=1:64, 3=1:256)

    PR2 = 58594;          // Set Timer 2 period (max value is 65535)

    _T2IP = 3;            // Set Timer 2 interrupt priority
    _T2IF = 0;            // Clear Timer 2 interrupt flag
    _T2IE = 1;            // Enable Timer 2 interrupt
    T2CONbits.TON = 1;    // Turn on Timer 2


    while(1)
    {
        
    }
}
 

I'm not really a good C programmer, nor am I familiar with the DSPIC3, but where is your output to the LED in your code? Are you mapping the timer output to a pin? Where do you assign your port directions?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top