80c535, very simple : writing to a port!

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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."



Re: 80c535, very simple : writing to a port!


Quoted text here. Click to load it
need external pullups?


Re: 80c535, very simple : writing to a port!
Quoted text here. Click to load it

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



Re: 80c535, very simple : writing to a port!
Kim Noer schrieb:

Quoted text here. Click to load it

What's connected to the port?

Quoted text here. Click to load it

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.
We've slightly trimmed the long signature. Click to see the full one.
Re: 80c535, very simple : writing to a port!

Quoted text here. Click to load it

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

Quoted text here. Click to load it

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.



Re: 80c535, very simple : writing to a port!
Quoted text here. Click to load it

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



Re: 80c535, very simple : writing to a port!

Quoted text here. Click to load it

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.



Site Timeline