1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

how can user enter input in 8051 assembly programming

Discussion in '8051/8951' started by sukanya, Apr 9, 2004.

  1. sukanya

    sukanya New Member

    Joined:
    Feb 2, 2004
    Messages:
    6
    Likes:
    0
    hi
    i want to know that how do you write command in assembly language for the user to input some data.i will be working on 8051 family.
    thank you
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,205
    Likes:
    640
    Location:
    Derbyshire, UK
    ONLINE
    If you're writing in assembler you will probably have to write the entire routine yourself, or try and download a suitable routine from somewhere. Obviously it will depend on how you wish to enter the data, there are many possibilities - among them are scanning single keys, scanning multiplexed keys, reading serial data from a keyboard.
     
  3. StupidDum

    StupidDum New Member

    Joined:
    Nov 3, 2003
    Messages:
    242
    Likes:
    0
    Location:
    Malaysia
    If you work on PIC or motorola, 8051 input pin may be strange to you.
    Unlike the others, there is no port direction control register. You cannot set the I/O to be input permenantly.

    In 8051, if you want to read an I/O pin, you must first set the value to be 1. So, it the input is 1, it remain to be 1. If input is 0, then it will pull down the I/O to 0. After that, if you wish to read again, you gotta reset the I/O to 1.

    That is somehow confusing and troublesome.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. bmcculla

    bmcculla New Member

    Joined:
    Sep 5, 2003
    Messages:
    898
    Likes:
    0
    Location:
    California, USA

    StupidDum: I don't think you're quite right about how the 8051 switches it's ports to inputs. The 8051 that I use has two port configurations: push-pull, and open collector. To make the port an input you set the mode to opencollector and then load a 1 to the port. This turns off the open collector transistor making the port a high impedance node. The external signal will now drive the port value. There is no need to reset the port to 1 after it is pulled low the input just needs a drive the input high. What you write to the port goes to turn on or off the transistors that drive the port pin. What you read when you read the port is the actual value on the output of the transistors( the value on the pin). This lets you write a 1 to the port (in open collector mode) and read a 0 (driven by the input signal)on the port. The value you wrote hasn't changed but the state of the pin has.

    Brent
     
  6. falleafd

    falleafd New Member

    Joined:
    May 13, 2003
    Messages:
    412
    Likes:
    0
    Location:
    Vietnam
    Yeah, direction register is on PIC, 8051 or 8951 you dont have to control the direction. But with port 0 of 8951, you have to put pullup resistors.

    With other ports, you don't have to put pullup resistors.

    To write asm to 8951, you may download the datasheet of at89c51.

    it may have some differences such as the interrupts. The interrupts on PIC is start at 0x0004 but the different interrupts on 8951 have different interrupts addresses.

    Like stuff, I don't like 8951 even I work with 8951 as beginning learning microcontroller and I wrote many applications on that chips. If anyone ask, I would recommend to use PIC.
     
  7. mahinda jayasingh

    mahinda jayasingh New Member

    Joined:
    Feb 15, 2004
    Messages:
    14
    Likes:
    0
    assembly command

    Find the assembly language instruction set for your micro controller,
    Each instruction is explained with example on the user guides.

    Once you write assembly language instructions, use compiler to compile it. It will convert your written assembly instructions to series of Hex numbers. Those hex numbers can be loaded to micro controller memory.

    It is given on user guid how to load it.

    good luck

    mahinda
     

Share This Page