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.

first c18 code; final few probems(eeprom, array size);

Status
Not open for further replies.
yaay,... I got the code done!

but i cant get it to program in.... I'v switched it from debug to RELEASE then selected PICKIT2 from the programmer, and reset the software and pickit connection, everything is saying ok to go, power on, mclr off, but im not getting any thing flashing on the uC, is there something else im missing?
maybe linker and header are different in release mode?




.................last question, i promise!!!!
 
Last edited:
none of the leds are lighting, usually they at least flikker a bit even while initializing, but now nothing, and in debug mode everything is now perfected
 
As you don't get an error message then I'm assuming that it has programmed correctly and it is a bug in your code. I suggest debugging the old way. At the start of your code set one of the LED pins to output and turn the LED on. Follow that line with a while(1);. If the LED lights then it is programming ok. Gradually move the code down until you identify where the code stops. Then work out why.

BTW, a quick look at your code shows that you enable interrupts before you setup the chip, a sure way to get a random crash.

Code:
void main (void)
{
	unsigned char  SECTORA;
	unsigned char  BLOCKA;
	unsigned char  PAGEINA;
	unsigned char  WAITSTAGE;
	unsigned char  WAITARRAYSTAGE;
	unsigned char  STAGE;
	unsigned char  FPS;
	unsigned char  DATAPOSA;
	unsigned char  LAYERC;



	RCON = 0b10000000;
	INTCON2 = 0b01000000;
	INTCON = 0b10010000;       <--------------This enables interrupts!!!!

Mike.
 
hmm... it doesn't seem to be my code, i started a new one,

#pragma config osc=intio67 wdt=off lvp=off
#include <p18f4620.h>

void main (void)
{
trise=0 //e2 output
while (1) {latebits.late2 = 1}
}

is just a quick example, the code debugs ok, but when i go in to program mode & release, port e2 wont switch on, I also took the liberty of taking the hex that mplab compiled and loaded it manually in to pickit programmer, to which i got an unusual error " too many words, or undefined words" or to that sort. Mind that when i use the programmer in mplab no errors return. and device reads target as properly loaded.

USING GCGB importing hex to the pickit would always say "hex file is larger than device" but the programs have always seem to run regardless.
 
You can't allow main() to finish or it will do random things.

Edit, Just realised that it doesn't finish, sorry. Can you try a different compiler?

Mike.
 
Last edited:
If you're still using C18 then it should be fine.

A couple of things to check,
Are you using PK2 in program mode not debug?
Are you selecting release mode?
Is MCLR tied to Vdd?
Are you releasing from reset?

Mike.
 
YUP


YUP.PGM
YUP.RELEASE
.........................unbeileveable.\

thnx pommie & everyone for the paitence i always forget the mclr tie
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top