80c535, very simple : writing to a port!

Hi there..

It's incredible simple - yet I haven't manage to locate the spot in the documentation to this chip. Alas, I have this code :

sfr p1 = 0x90;

main() {

while(1) { p1 = 0x55; } }

As you can see, it's very simple. But when i measure on the ports, I get

2.0V on all ports - ie. it doesn't seem to do what I tell it to do.

Another thing is that apparently, you have to setup the port for reading. Ie. you write 0xff to the port and then you can write what ever you want. I've looked everywhere in the documentation[1] but I simply can't find the place where it tells me that. There simply doesn't seem to be a SFR register anywhere in that chip that controls the input/output state of the ports.

[1] Infineon : User's Manual 08.95 Microcomputer Components SAB 80515/SAB 80C515 8-Bit Single-Chip Microcontroller Family and C500 Architecture and Instruction Set
--
"You look down and you see a tortoise crawling towards you."
Reply to
Kim Noer
Loading thread data ...

need external pullups?

Reply to
Rein Wiehler

Kim Noer schrieb:

What's connected to the port?

All controllers of the MCS-51 family (well, almost all) have so-called quasi-bidirectional outputs. They can be used for output as well as for input without being configured. Basic principle is a weak pull-up resistor (about 100k) combined with an open-drain transistor which can pull the pin low. Reading the port always gets the current value at the pin, regardless of if it's pulled down by the internal transistor or an external signal. So you must write a port to 1 (high) to use it as input. Details surely are also contained in the user manual you quoted, as well as in numerous UMs of similar chips of all MCS-51 makers.

I think your problem is elsewhere:

- external connections at the port

- influences of a development system or emulator if you use one

- a reset problem, maybe reset is active all the time

- etc

--
Dipl.-Ing. Tilmann Reh
Autometer GmbH Siegen - Elektronik nach Maß.
 Click to see the full signature
Reply to
Tilmann Reh

The chip doc is not the only place to look. Have a look at the compiler documentation (which compiler?) to see how to access SFRs from C, this is compiler dependent.

Stef

Reply to
Stef

He may need them, but that is not his (only) problem. Without pullups he should at least get 0V on half the pins when setting the port to 0x55.

Stef

Reply to
Stef

Nothing at all. Well other than the multimeter I was using to measure.

Indeed they are. I was looking for a control register (my experience is with

8088 and 8152) - and I didn't think to take a look at the port driver. But I can see now, that that is the place to look. Thanks for the hints!
--
I doubt, therefore I might be.
Reply to
Kim Noer

I'm currently using Keil C51. I'm thinking about skipping C and go directly to assembler (which strangely enough where I'm most experienced).

--
I doubt, therefore I might be.
Reply to
Kim Noer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.