1. madhusudan.pigeonsembs

    Thread Starter New Member

    Mar 17, 2011
    23
    2
    Hello. Plz run the program on KEIL uVision2 & suggest me.

    1. This program is for sending "M" to computer hyperterminal 20 times.

    2. Serial Interrupt is activated

    3. When running the program line by line, during "jnb ti,$" instruction execution, if i press some thing from key board then RI is activated & execute the ISR & sends the received data to P1. And finishing execution of ISR it returns to the same "jnb ti,$".

    4. My problem is, at the time of transmiting "M" is loaded in SBUF reg. At the same time if RI is activated and loads the received data to sbuf, then why sbuf value is not changed on simulator.

    5. It is doing transmitting & receiving at a time. Having one SBUF reg, how it is doing both the jobs.

    PLZ clear this to me.

    org 00h
    sjmp main

    org 23h
    sjmp serial

    org 30h
    main:
    mov tmod,#20h
    mov th1,#0fdh
    mov scon,#50h
    mov ie,#10010000b
    mov r0,#20
    setb tr1
    back:
    acall ser
    djnz r0,back
    sjmp $

    serial:
    jb ti,trans
    mov a,sbuf
    mov p1,a
    clr ri
    reti
    trans:
    reti

    ser:
    mov sbuf,#'M'
    jnb ti,$
    clr ti
    ret
    end
     
  2. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    SBUF is not a single register, instead it is two registers with the same name.

    One of them takes care of the data to be transmitted and the other holds the data received.

    So when you write to SBUF, it is not the same as read from SBUF.
     
Loading...