This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

inportb and outportb

I have problems with the the two functions inportb and outportb. They don't function and I don't find them in any headerfile.
I want to program the serial interface 0 of the 80C537.
I have the evaluation software from Keil.

Can you help me?
Do I only need an extra headerfile?

Thanks

  • Why would you find them? They are not part of ISO C. What are you trying to do? Look at my UART driver (I sound like a broken record) at http://www.embeddedfw.com at the bottom of the page. The UART0 on the '537 should be similar if not identical. Notice my uart.c file does not require any device header file - it stands on its own. You will see that there is no need for an inpb outpb function since there are no port mapped registers in the 8051. Everything is memory mapped, however, the special function registers must be accessed using extensions to C, e.g. sfr and sbit. For example to access Port 0

    sfr r_port0 = 0x80;
    if (0xAA == r_port0) r_port0 = 0x55;

  • I presume you're used to PC/x86 compilers?

    The x86 has separate "Port" and "Memory" address spaces, so compiler writers came up with inportb, outportb, etc to allow access from 'C'.

    The 8051 architecture is different - you need to read the Manuals for the implementation-specific details.

    You should probably start with the uVision Getting Started guide, and work through the examples in it; these will show you how to access the 8051's ports, SFRs, etc