why program memory disable uic00b

Programmer, In-Circuit Debugger, PIC Start-Up Kit, Memory Interface...

why program memory disable uic00b

Postby bear » Wed May 23, 2012 7:46 am

the problem is

pickit2 dspic.JPG


is this mean the program wont execute??
how to enable it??

what about the eeprom data??
bear
Apprentice
 
Posts: 46
Joined: Tue Oct 05, 2010 2:11 am

Re: why program memory disable uic00b

Postby yonghui » Wed May 23, 2012 9:58 am

hi, not sure what is your problem.

what i see is program sucessfully and you set code protect for the thing
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: why program memory disable uic00b

Postby bear » Wed May 23, 2012 10:52 am

yup..
when i disable.. the same thing happen..

may be my circuit is wrong.. thats why my program doesnt execute..
do you have sample circuit for dspic 28 pins..
bear
Apprentice
 
Posts: 46
Joined: Tue Oct 05, 2010 2:11 am

Re: why program memory disable uic00b

Postby mec » Wed May 23, 2012 4:02 pm

why not u post your circuit/schematic here .. :lol:
The mistake in your code may also make your circuit doesn't work. For example wrong declaration of Input and Output pins. Just my 2 cent.
mec
Newbie
 
Posts: 12
Joined: Thu Sep 02, 2010 8:03 pm

Re: why program memory disable uic00b

Postby bear » Wed May 23, 2012 9:48 pm

this is my code... i put led at RF2 n RF3...
CODE: SELECT_ALL_CODE
// Include the neccesary header files
#include <p30F2012.h>
#include <libpic30.h>


/*******************************************************************************
* DEVICE CONFIGURATION WORDS                                                 *
*******************************************************************************/
// Primary Oscillator Mode = HS.
// Clock Switching and Monitor = Off.
_FOSC(CSW_FSCM_OFF & HS);

// Watchdog Timer = Off.
_FWDT(WDT_OFF);

// Brown Out Reset = Off.
// POR Timer Value = Off.
// Master Clear = Enabled.
_FBORPOR(PBOR_OFF & PWRT_OFF & MCLR_EN);

// Code Protection = On.
_FGS(CODE_PROT_ON);

// Debug = Off.
_FICD(GWRP_OFF);

#define   _XTAL_FREQ      80000000



// I/O Connections.
#define sw2            PORTDbits.RD0

#define led1         LATFbits.LATF2
#define led2         LATFbits.LATF3


/*******************************************************************************
* FUNCTION PROTOTYPE                                                           *
*******************************************************************************/
void led_blink(void);
void init(void);
void delay_ms(unsigned int ui_value);


/*******************************************************************************
* Global Variables                                                             *
*******************************************************************************/
unsigned char flag_1 = 0;
unsigned char flag_2 = 0;
unsigned char flag_3 = 0;
unsigned char flag_4 = 0;

/*******************************************************************************
* MAIN FUNCTION                                                                *
*******************************************************************************/
int main(void)
{   init();while(1);{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////START PROGRAM/////////////////////////////////

   LATFbits.LATF2=1;   delay_ms(5000);
   LATFbits.LATF2=0;   delay_ms(5000);
   LATFbits.LATF3=1;   delay_ms(5000);
   LATFbits.LATF3=0;   delay_ms(5000);


}//////////////////////////////////END PROGRAM//////////////////////////////////
}///////////////////////////////////////////////////////////////////////////////


void led_blink(void)
{

   led1=1;delay_ms(5000);
   led1=0;delay_ms(5000);
   led2=1;delay_ms(5000);
   led2=0;delay_ms(5000);

}
void init(void)
{

   // Clear all ports.
   LATB = 0;
   LATC = 0;
   LATD = 0;
   LATF = 0;


   // Initialize I/O directions.
   TRISB = 0;
   TRISC = 0;
   TRISD = 0;
   TRISF = 0;

   TRISFbits.TRISF2 = 0;
   TRISFbits.TRISF3 = 0;

}
void delay_ms(unsigned int ui_value)
{

   __delay32(_XTAL_FREQ/4000 * ui_value);

}
bear
Apprentice
 
Posts: 46
Joined: Tue Oct 05, 2010 2:11 am

Re: why program memory disable uic00b

Postby sich » Wed May 23, 2012 11:35 pm

Of course the code seems not working, you've put a while(1); after init();. It loops forever in this while(1);.
I guess what you want is this:

CODE: SELECT_ALL_CODE
while(1)
{
//your code here...
}
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: why program memory disable uic00b

Postby bear » Wed May 23, 2012 11:48 pm

i didnt see that...

it works now...

thax vm... jazakallah...
bear
Apprentice
 
Posts: 46
Joined: Tue Oct 05, 2010 2:11 am


Return to PIC Development Tool

Who is online

Users browsing this forum: No registered users and 19 guests