8052 serial data correct but program not running correctly.

Thread Starter

testuserabcdef

Joined Jul 12, 2016
127
I am able to store program code starting at address zero to the chip via ISP and I was able to verify that the program is stored correctly, but when I tried running it on my test board that has LED's connected to all P0 and P2 pins through 220 ohm resistors to 5V, Most of them were on. I expected them all to be off after arriving at this code:

Code:
mov P0,#0FFh
nop
mov P2,#0FFh
nop
sjmp $
After measuring my entire code with a simulator, it takes less than 3 seconds to execute the entire code, so I expected to see the lights go off.

What can I do to fix this?
 

absf

Joined Dec 29, 2010
1,943
The code looks fine to me. Does it assemble without "ORG".

May be problem is in hardware. I tested with proteus and it was working.

Allen
 

Thread Starter

testuserabcdef

Joined Jul 12, 2016
127
yes it does. I'm gonna try a bigger delay in my reset circuit. right now my programmer reset RC values are 47k and 2.2nF and my target circuit reset RC values are 47k and 47nF, AT89S52 datasheet thinks I should use 50k as the lowest resistor value but Ive seen circuit examples on the net where the resistor value is 8.2k.
 

cmartinez

Joined Jan 17, 2007
6,963
I am able to store program code starting at address zero to the chip via ISP and I was able to verify that the program is stored correctly, but when I tried running it on my test board that has LED's connected to all P0 and P2 pins through 220 ohm resistors to 5V, Most of them were on. I expected them all to be off after arriving at this code:

Code:
mov P0,#0FFh
nop
mov P2,#0FFh
nop
sjmp $
After measuring my entire code with a simulator, it takes less than 3 seconds to execute the entire code, so I expected to see the lights go off.

What can I do to fix this?
What brand/model of 8052 are you using? Some variants require setting up the I/O pins in four different configurations.
 
Top