8051 code help required.

Discussion in 'Embedded Systems and Microcontrollers' started by acc1444, Apr 24, 2014.

  1. acc1444

    Thread Starter New Member

    Apr 2, 2012
    1
    0
    [​IMG]



    details:
    P3 is connected to parallel port and input given from computer.
    Opposite motor input will drive motor. Same high output will break motor rotation. Refer L298 datasheet.
    I have attached one image above. I am building model which consists of 3 motion as shown in image. Front-back, up-down and left right.
    Each motion is achieved with use of DC motor driven by L298 driver.
    As shown in image, red circles are sensors placed at some distance to stop motor at particular position. I have used IR transmitter and receiver as sensor(refer image). When receiver receives IR signal from transmitter, output becomes high(2.5-3V).
    I want to control whole operations with help of micro controller 8051/8052 and controllers input is given by computer as per my command given via parallel port.(I can not use serial port as I am using RFID reader having serial port interface).
    Operating sequence
    Assume that up-down mechanism should stop at 2nd IR sensor.
    1) Give command to controller via parallel port from computer. Let us set pin 4 which calls fixed programmed routine.
    2) Controller turn ON IR sensor (at P2).
    3) Check P3(as input) whether it is already at desired position. If yes, then motor should remain stop. If No, then
    4) Motor input is set to drive motor to get desired position. Once it reaches, IR sensor output becomes high and motor input is set to break motor rotation.


    Similarly, I want to have fixed routine for all operation.
    To stop at 2nd IR sensor, I will set pin of 4 at port 3 and routing is called mentioned from point 2 to 4 as above.


    To stop at 3nd IR sensor, I will set pin of 5 at port 3 and routing is called mentioned from point 2 to 4 as above.


    To stop at 4nd IR sensor, I will set pin of 6 at port 3 and routing is called mentioned from point 2 to 4 as above.



    I am newbie with 8051. I need help to give a start.
     
  2. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    That is quite an ambitious project. You'd have to break it down to manageable parts like the mcu interfacing to IOs, communications, motor control and IR detection. Are you using a 8051 dev board or making your own 8051 mcu board? What language would you be using ?

    Here is a good tutorial to get started...

    8051 Basic Tutorials

    Allen
     
Loading...