Author Topic: how to check either Controller working or damaged  (Read 1660 times)

0 Members and 1 Guest are viewing this topic.

Offline ect_09Topic starter

  • Contributor
  • Posts: 17
how to check either Controller working or damaged
« on: October 28, 2014, 11:13:29 am »
Hi,:(
i want to know that how to check that either Controller working or damaged ,
am confused because i have PIC 18f452 and its being detect automatically when i want to load HEX file it and at the end it shows message that programming finished successfully, (i attached the image).
but when i run this on hardware its PORT does not responding..no voltage on its output.
what should i do..????

code is here
Code: [Select]
#include<htc.h>


// PIC 18F452 fuse configuration:
// Config word 1 (Oscillator configuration)
// 40Mhz crystal input
__CONFIG(1, OSCSDIS & HSPLL);
// Config word 2
__CONFIG(2, BORDIS & PWRTDIS & WDTDIS);
// Config word 3
__CONFIG(3, CCP2RC1);
// Config word 4
__CONFIG(4,  LVPDIS & STVREN);
// Config word 5, 6 and 7 (protection configuration)
__CONFIG(5, UNPROTECT);
__CONFIG(6, WRTEN);
__CONFIG(7, TRU);

#define _XTAL_FREQ 40000000   //MHz

void delay_sec(unsigned char seconds)    // This function provides delay in terms of seconds
{
unsigned char i,j;

for(i=0;i<seconds;i++)
for(j=0;j<100;j++)
__delay_ms(10);
}

void main()
{
// Make RB0 zero
TRISB = 0;     // Make RB0 output

while(1)
{
PORTB = 0x55; // Make RB0 one
delay_sec(1);   // delay of one second

PORTB = 0xAA; // Make RB0 zero
delay_sec(1); // delay of one second
}
}
 

Offline Pack34

  • Frequent Contributor
  • **
  • Posts: 753
Re: how to check either Controller working or damaged
« Reply #1 on: October 28, 2014, 03:35:45 pm »
Are you sure that your external oscillator is functioning properly?

Also I would suggest using the snipping tool, or pressing ALT+PRINT_SCREEN for screenshots. This will slim up your screenshots to the window that you're using.

http://windows.microsoft.com/en-us/windows/use-snipping-tool-capture-screen-shots#1TC=windows-8
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: how to check either Controller working or damaged
« Reply #2 on: October 28, 2014, 03:43:35 pm »
You read the datasheet, write a good piece of code and compile and burn it to your chip. And observe.

in your case, your code us wrong.
================================
https://dannyelectronics.wordpress.com/
 

jucole

  • Guest
Re: how to check either Controller working or damaged
« Reply #3 on: October 28, 2014, 04:24:26 pm »
You could try this neat little program called "PIC18 SIMULATOR IDE" http://www.oshonsoft.com/pic18.html  it's free to tryout; so you can load in your hex file and setup some LEDs to flash or LCD etc and see if your code works.



 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf