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.

AT89S8252 Port "Sticking"

Status
Not open for further replies.

GrandAlf

Advanced Member level 2
Joined
Mar 9, 2002
Messages
520
Helped
47
Reputation
92
Reaction score
6
Trophy points
1,298
Location
UK
Activity points
4,730
I have a program originally written with Bascom for the 89S8252. To make it go a bit faster I have decided to rewrite in "C" (K*e*i*l). I have a problem with Port 1, this is split between input and output on various pins. The input side is active Low via opto, with 4k7 pullups direct to pins. Problem is when an input pin goes low, it usually stays low, even when the souce returns to high. Resetting the cpu clears it to high again. It all works fine with the Bascom prog, so the hardware is OK. 8052 series do not appear to have direction control, so this cannot be the cause. Rather baffled by this. I am using AT898252.h, and using "if (P1_7 == 0) {etc}" for reading. Any help greatly appreciated.
 

You should be very careful when using a port of an 8051 "splited" (a few inputs, a few outputs) because when you modify the port like this:
port|=0x1C;

If one of your inputs was low while you did this you overwrite the input and it becomes an output which is low and stays low :-(

To overcome this write your inputs with a "1" which means in the above example assuming that Bit7 and 6 of your port are used as inputs:
port|=0xDC;

Both inputs are written with a "1" but as the 8051 can only pull pins low it does not "lock" the input if it was low during your write operation.

hope this helps
 

C-Man,

This does help, I will check my timing.

Thank you for your input.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top