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.

[SOLVED] Blinky not working on PIC18F452

Status
Not open for further replies.

atamariya

Newbie level 6
Joined
Sep 1, 2012
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,358
I downloaded a blinky program from http://www.voti.nl/blink/code/b452-1.hex . I tested it on my chip and it worked. Then I loaded my test program which was working well in sim. That's when something went wrong.

Now when I load the blinky program, it doesn't work. I can erase (verify by reading) and program again (verify again by reading). But it won't work. The only difference I can see is checksum of original vs read from chip version. Can anybody tell me what's going wrong here?

I use IC-Prog 1.06C and JDM programmer.
Thanks.
 

Can you provide the circuit? Which port is your led connected?
 

Re check your hardware settings. See if your uC is damaged or any connection is loose.
 

What freq are you using? 4 MHz? Internal / External?

Check this video of simulation. It is working fine. The problem is with your hardware.
 

Attachments

  • sim5.rar
    42.6 KB · Views: 45

If uC is damaged, would I be able to erase and re-program it?
Yes, sometimes uC's doesn't completely gets damaged. There are many reports of damage in only ports, read-write ability, etc.
 

So I got new chips and still have the same problem. I'm testing the chip on this board **broken link removed** . Any suggestion?

- - - Updated - - -

So I got new chips and still have the same problem. I'm testing the chip on this board http://www.embeddedmarket.com/products/PIC18F452-Lab-in-Pocket-Experiment-board . Any suggestion?
 

So I got new chips and still have the same problem. I'm testing the chip on this board **broken link removed** . Any suggestion?

- - - Updated - - -

So I got new chips and still have the same problem. I'm testing the chip on this board **broken link removed** . Any suggestion?

Check your circuit with the hex file I have posted.
 

So I got new chips and still have the same problem. I'm testing the chip on this board **broken link removed** . Any suggestion?

Hi,

As already said you need to post All your program code to see what you have tried to do.
There are parameters in the program code called the Configuaration, if they are set incorrectly it could cause problems.

As InternetUser mentions, what is the Frequency of the Crystal on that board.
With that 452 chip you only have the External option avaiable.
You can buy the much better 18F4520 chip which is pin compatible that has several extra features like internal oscillator, might be cheaper than the old 452 as well.

What might help is if you connect your programmer, do not load any hex file so your Buffer is clear, then Read the 452 chip and see if any .hex data comes into the Buffer ?

This will help prove if the programmer / chip are working.
 

Check your circuit with the hex file I have posted.
Did you forget to upload the hex file?

wp100, I mentioned in my first post that I'm trying to test the blinky program from the mentioned URL. Also,
I can erase (verify by reading) and program again (verify again by reading).
 

Here are the hex files for 4, 8, and 20 MHz external oscillator.
 

Attachments

  • blinky.rar
    771 bytes · Views: 43
Here are the hex files for 4, 8, and 20 MHz external oscillator.
Thanks a lot. I tested 4 and 8 MHz examples and BOTH are working. The crystal on the board says "11.0592 G MEC AH1DV". So I'm guessing it's a 11 MHz crystal - I didn't find any datasheet for this. So what is the difference in the code for the three examples you provided? Can you share the source code?
 

Thanks a lot. I tested 4 and 8 MHz examples and BOTH are working. The crystal on the board says "11.0592 G MEC AH1DV". So I'm guessing it's a 11 MHz crystal - I didn't find any datasheet for this. So what is the difference in the code for the three examples you provided? Can you share the source code?

I wrote the code in C and compiled form different clock frequencies. The code is the same for all the three.
Here is the code.
Code:
void main() {
     TRISA = 0b00000000;
     PORTA = 0b00000000;
     
     while(1) {
              PORTA.F0 = 1;
              Delay_ms(500);
              PORTA.F0 = 0;
              Delay_ms(500);
     }
}
 

The crystal on the board says "11.0592 G MEC AH1DV". So I'm guessing it's a 11 MHz crystal - I didn't find any datasheet for this.

Actually its an 11.0592MHz crystal, which are commonly used as this particular frequency allows a UART the ability to generate the commonly used BAUD rates with no error.

BigDog
 
Based on internetuser2k12 sample program, I added following configuration to make my blinky program work using XC8 compiler.
Code:
//#pragma config CONFIG1H = 0x22
__CONFIG(1, OSC_HS & OSCS_OFF);
//#pragma config CONFIG2L = 0xF
__CONFIG(2, PWRT_OFF & BOR_ON & BORV_20);
//#pragma config CONFIG2H = 0xE
__CONFIG(3, WDT_OFF & WDTPS_128);
//#pragma config CONFIG3H = 0x1
__CONFIG(4, CCP2MUX_ON);
//#pragma config CONFIG4L = 0x81
__CONFIG(5, STVR_ON & LVP_OFF);

Thanks everybody.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top