1. You can now buy finished microcontroller project from us, Check out the Store for the complete list of projects.
  2. Need a custom project, Send us some details about your project. So that we can quote the price for it.

Automatic Room light Controller with Visitor Counter (AT89S52)

Discussion in 'Doubts in My Projects' started by Binu, Jun 2, 2007.

  1. msmuneer

    msmuneer New Member

    Likes Received:
    0
    Trophy Points:
    0
    why u have move these values in value_1 and value_2 when main sub routine starts
    MOV VALUE_1,#15H
    MOV VALUE_2,#15H
  2. msmuneer

    msmuneer New Member

    Likes Received:
    0
    Trophy Points:
    0
    is value_1 is for showing on 7 segment display1 and value_2 for 7 sement 2
  3. Binu

    Binu Administrator

    Likes Received:
    137
    Trophy Points:
    63
    The functions HEX2BCD is used to convert the 16bit HEX to 5 digit BCD value. Since the data to be displayed on the Display is in BCD we need that subroutine.

    Regarding your second question, if the value of R2 is 15h, then the "-" symbol is displayed. i.e only the Segment G is switched on and the others are kept in off.
    If the value is 16H, all the segments are switched off.

    When the program starts only the " - - " symbols are displayed. It is done by moving the 15H to the Registers.

    In the final question you are correct, value_1 is displayed on display 1 and so on..

    J.Binu
    Click here to get free 8051 Codes
  4. msmuneer

    msmuneer New Member

    Likes Received:
    0
    Trophy Points:
    0
    i know that for displaying data on 7segment we have to convert hex 2 bcd. and the subroutine is understandable above this code :
    HIGH_BYTE:
    MOV A,#6
    ADD A,R3
    MOV B,#10
    DIV AB
    MOV R3,B
    ADD A,#5
    ADD A,R4
    MOV B,#10
    DIV AB
    MOV R4,B
    ADD A,#2
    ADD A,R5
    MOV B,#10
    DIV AB
    MOV R5,B
    CJNE R6,#00D,ADD_IT
    SJMP CONTINUE
    ADD_IT:
    ADD A,R6
    CONTINUE:
    MOV R6,A
    DJNZ R1,HIGH_BYTE
    MOV B, #10D
    MOV A,R6
    DIV AB
    MOV R6,B
    MOV R7,A
    ENDD: RET

    but this code is not understandable. plz tell me purpose of
    *ADD A,#5
    *ADD A,#2
    *CJNE R6,#00D,ADD_IT
    *SJMP CONTINUE
    *ADD_IT:
    *ADD A,R6
    *CONTINUE:
    *MOV R6,A
    *DJNZ R1,HIGH_BYTE
    *MOV B, #10D
    *MOV A,R6
    *DIV AB
    what u r doing below HIGH_BYTE label
  5. msmuneer

    msmuneer New Member

    Likes Received:
    0
    Trophy Points:
    0
    *my 2nd question is that u r using DS command for saving 8 bit data.
    *can we use DB command instead.
    *if we use DB command then is there any need to include reg_51.pdf.
  6. msmuneer

    msmuneer New Member

    Likes Received:
    0
    Trophy Points:
    0
    what should be the output of sensors (in volts) when there is no obsruction
  7. Binu

    Binu Administrator

    Likes Received:
    137
    Trophy Points:
    63
    Please go through any Books on 8051 microcontroller for HEX to BCD convertion else use the following simple code for converting a 2digit HEx value(max 63) to BCD upto 99.

    HEX2BCD:
    MOV B,#00H
    CJNE A,#64H,N100 ;NOT EQUAL 100D
    N100: JC LT99
    JMP GT99 ;greater than 99D
    LT99: ;less than 99D, continue
    SUB10: ;repeatedly subtaract 10D from Acc till reminder less than 10D
    CLR C
    CJNE A,#0AH,N10 ;NOT EQUAL 10D
    N10: JC LT10 ;reminder less than 10D
    SUBB A,#0AH
    INC B ;loop counter
    JMP SUB10
    GT99: CLR A ;output 00 only if greater than 99D
    LT10: SWAP A ;A contains low BCD nibble & B contains high BCD nibble
    ORL A,B
    SWAP A
    RET


    THIS ROUTINE ACCEPTS A BINARY NUMBER BETWEEN 0-99D(63H) IN ACC & CONVERTS TO BCD IF ACC>63H(99D) OUTPUTS 00H

    Tou can use DB instead of DS, but the include reg_51.pdf is nessary for the port declarations.

    When there is no obsruction the output of the IC555 is +5v and the sensor ouput will be also high.

    J.Binu
    Click here to get free 8051 Codes
  8. ucpatnaik

    ucpatnaik New Member

    Likes Received:
    0
    Trophy Points:
    0
    Dear Binu,
    This ckt was assembled on your PCB.The 7 seg multiplexing for one of the transistor is driven from pin 27 in the ckt as well as at the code.As the PCB has the same at pin 26 we changed the code accordingly and used your on-line assembler to get the HEX file which was lodaded to the 89S52.The 7 segment driving transistor collector resistors were taken as 1k instead of 2.2k for better illumination of the segments.Base drive though not given in the circuit we took 2.2k.
    Result ---In any case the 7 seg gives no glow.Temporarily Sorting the collector & emiter of the 7 seg drive transistors, all segments of corrosponding 7 seg glow .Even After 99 interruptions as per your code (output of 555 going high for each interruption as indicated by the LED glowing on the PCB (not given in the ckt)) pin 28 does not go high that drives the relay.
    UC Patnaik
  9. ucpatnaik

    ucpatnaik New Member

    Likes Received:
    0
    Trophy Points:
    0
    Request pls send your hex file
    U C Patnaik
  10. ucpatnaik

    ucpatnaik New Member

    Likes Received:
    0
    Trophy Points:
    0
    Many Circuits with more than one 7 seg display are not working.Is it the multiplexing mode ,not correct in the code?
Loading...

Share This Page