Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

12f1840 config bits - hi-tech c

Status
Not open for further replies.

DirtyLude

Well-Known Member
What's up with this? Latest MPLAB X with HI-TECH picc. Just trying for a blinky program and I receive a mangled error message for my config bits setup.

Code:
The requested operation cannot continue with the following configuration bit setting(s):




Please fix the setting(s) and try the operation again.
Failed to program device

That's the error message I get with blanks and everything. There should be something telling me what the error actually is, but nothing. I stole this config from some other program, and I stepped through the settings against the datasheet and didn't find anything that stands out to me, but this is my first time with this.

Code:
#define _XTAL_FREQ 32000000

#include <stdio.h>
#include <stdlib.h>
#include <htc.h>

__CONFIG(FOSC_INTOSC & WDTE_OFF & PWRTE_OFF & MCLRE_ON & CP_OFF & CPD_OFF & BOREN_OFF & CLKOUTEN_OFF & IESO_OFF & FCMEN_OFF);
__CONFIG(WRT_OFF & PLLEN_OFF & STVREN_ON & BORV_25 & LVP_OFF);
__IDLOC(0000);

I'll post everything if needed, but I think that's the relevant code.

EDIT: Actually that's the latest settings. I tried flipping some of the settings like LVP and BOREN with no luck. Same issue.
EDIT AGAIN: Fixed title with correct PIC.
EDIT AGAIN: Well, that only corrected the internal title, the thread heading in the forum is still wrong. Oh Well.
 
Last edited:
I can't even find a 12F1680 ??

Edit: ah 12F680.
 
Last edited:
That should be 12f1840. I have no idea where I got 1680 from. Some magic number I pulled out of my head for some reason.

I guess it's the debug bit or something, because I only get the message when I do debugging mode. Regular run mode works fine. In debug mode it gives me the option to continue anyway and it works fine. It's just annoying getting the error message every time.

Anyway, it works. My little LED is flashing, so I'm good.
 
Each of the __CONFIG statements in the code in the original post is for the separate registers.
 
Does the problem just show up when debugging on the PIC? I did not see the error on the simulator when I ran this code with your config bits.

Code:
#include <htc.h>

__CONFIG(FOSC_INTOSC & WDTE_OFF & PWRTE_OFF & MCLRE_ON & CP_OFF & CPD_OFF & BOREN_OFF & CLKOUTEN_OFF & IESO_OFF & FCMEN_OFF);
__CONFIG(WRT_OFF & PLLEN_OFF & STVREN_ON & BORV_25 & LVP_OFF);
__IDLOC(0000);

void main(void)
{
	unsigned int i;
	
	while(1)
	{
	    for(i=0;i<10000;i++)
	      i++;
	}	
}
 
Does the problem just show up when debugging on the PIC? I did not see the error on the simulator when I ran this code with your config bits.

I guess it's the debug bit or something, because I only get the message when I do debugging mode. Regular run mode works fine.

Yes.

If I do something actually wrong in the config bits it will give me the same error message, but will have the detail of the actual error. In this case, there's no error message at all.
 
I've had problems with code compiled with H-tech C the code runs but it show a config error And onsoft wouldn't load the hex for simulation But the code ran on a real chip fine I was using a 12F chip not the same as yours but it dose this with 12F508 and 12F683
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top