Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

uC programmed but does not works

Status
Not open for further replies.

Shaheers

Member level 2
Joined
Mar 24, 2010
Messages
51
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Location
Islamabad,Pakistan
Activity points
1,609
I am trying to implement a simple blinking circuit on bread board to checking purpose

I try for both atmel 89s52 and PIC18F452 for testing
I program 89s52 on Mickro C and Keil,
and PIC18F452 on Micro C and CSS C as well


I use old computer power supply to power them,
I am using Genius G540 to program them


both of circuits are works on proteus but not in real world,

is there any problem with crystal clock?
is there any problem in programming device, that device is using some sort of encruption while programming.
Is there any problem with power supply?
Is both of uC are faulty, even it programs and verify. . .. ?

the simple program in keil and sch are given


Code:
#include <REGX51.H>
#include <stdio.H>
#include <math.H>

void main()
{
	do{
		int i;
		for(i=0;i<10000;i++)
		{
		P2= 0x80;
		}
		for(i=0;i<10000;i++)
		{
		P2= 0x00;
		}

		}while (1);
		}
 

Attachments


Tahmid

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,791
Reputation
3,574
Reaction score
1,650
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,545
For the 89S52:

Connect pin 40 (VCC) (Not shown in Proteus) to +5V.
Connect pin 20 (GND) (Not shown in Protues) to ground.
Connect pin 9 (RST) to ground via a 10k resistor. Connect a 10uF capacitor from +5V to pin 9 (RST).

Take a look here: http://www.ikalogic.com/part-3-basic-inputoutput-operations/

Hope this helps.
Tahmid.
 

nandhu015

Advanced Member level 5
Joined
Feb 11, 2006
Messages
1,965
Helped
300
Reputation
600
Reaction score
224
Trophy points
1,353
Location
India
Activity points
9,814
You need to reset circuit to operate.

Here is the basic circuit

images.jpeg

Try this one
 

sequel

Member level 4
Joined
Oct 27, 2012
Messages
76
Helped
8
Reputation
16
Reaction score
7
Trophy points
1,288
Location
Nigeria
Activity points
1,753
are you very sure of your programmer?
 

Tahmid

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,791
Reputation
3,574
Reaction score
1,650
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,545
What is the frequency of the oscillator?

Your problem is that the delay you used is too small. While the LED does blink, the rate is too fast for our eyes to detect and it seems like the LED is on. Increase the delay time so that it's about 250ms or more.

- - - Updated - - -

You said that you tried using mikroC as well. Upload the mikroC code.

Also, upload the schematic and codes for the PIC.
 

bigdogguru

Administrator
Joined
Mar 12, 2010
Messages
9,831
Helped
2,348
Reputation
4,690
Reaction score
2,274
Trophy points
1,413
Location
Southwest, USA
Activity points
62,506
is there any problem with crystal clock?
What value of capacitors are you using for the crystal? Your schematic indicates 22nF, while a valid range is more in 20pF to 30pF range.

is there any problem in programming device, that device is using some sort of encruption while programming.
If the devices have been Code Protection enabled, you will need to manually erase the entire device before programming.

Is there any problem with power supply?
The power supply needs to be well regulated, proper use of bypass/decoupling capacitors is advisable.

Also some computer power supplies require a minimum load to function properly.

You might consider building a simply 7805 based power supply for your projects.

Is both of uC are faulty, even it programs and verify. . .. ?
Highly Doubtful.


BigDog
 

Shaheers

Member level 2
Joined
Mar 24, 2010
Messages
51
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Location
Islamabad,Pakistan
Activity points
1,609
are you very sure of your programmer?
Yeh is just got a new one, i think this is not a reasion.

What is the frequency of the oscillator?
The oscillator freq is 20Mhz.

You said that you tried using mikroC as well. Upload the mikroC code.

Also, upload the schematic and codes for the PIC.



The code i use in MikroC is for 80s52

Code:
void main ()

{
unsigned char j=1;


         for(;;)
         {
         P0=j;                                            // same as for pic, with TRISA=0; and PORTA;
         P1=j;
         P2=j;
         P3=j;
         Delay_ms(1500);
         j=j<<1;
                if(j==0)
                {
                j=1;
                }
                }
}
I think it is not a problem with code,

What value of capacitors are you using for the crystal? Your schematic indicates 22nF, while a valid range is more in 20pF to 30pF range.
I am sorry i got a problem, the problem is probably capacitor, let me fix this first. . .

Is there any alternator of that crystal, any possibility to use micro-controller without crystal, like RC or internal oscillator?
 

sequel

Member level 4
Joined
Oct 27, 2012
Messages
76
Helped
8
Reputation
16
Reaction score
7
Trophy points
1,288
Location
Nigeria
Activity points
1,753
ground the body of the crystal, make sure you make good use of power supply filter capacitors, increase the ground plane of you circuit so as to lower the inductance, measure the supply voltage across the power pin (GND and VDD) to be sure that it is within the set values, recompile and assemble your program once again....cheers

- - - Updated - - -

when digital systems tend to show bizarre attitudes one of the best bet will be to run a lower crystal value first then if all went well you can then push it to the limits of the chip and not starting it all up from the other side because things make get so bad...without you being able to combat it within a short while.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top