Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help on 8251A USART

I want to check whether 8251A (USART) in my microprocessor (8085) kit is working properly. So I wrote a program for loop back. I mean I connected the Tx and Rx pins and transmitted the data. The program is as follows

starting address 4100h .To transmit test data

MVI A,4E ;initialize 8251 in Asynchronous mode
OUT C2 ; C2 is the port address for mode word register in 8251 in my kit as specified in the manual
MVI A,37 ; Enables Tx & Rx
OUT C2
MVI A,FF ; Test data
OUT C0 ; C0 is port address of 8251
RST 1 ; Reset the system

starting address 4200h . To check the reception of data

IN C0 ;get the loop backed data at port
STA 3200h ;store the result in 3200h
RST 1 ; Reset the system

When we send the data to any port the data is stored in the hardware in a register. If I read the data from the register using an IN command, I think we'll get back the data. So how can I be sure that the data which I get is the loop backed data ,and not what I had put using the OUT command.

thanx

senthil


Comments

  • melissa_may1melissa_may1 Posts: 937Member
    : I want to check whether 8251A (USART) in my microprocessor (8085) kit is working properly. So I wrote a program for loop back. I mean I connected the Tx and Rx pins and transmitted the data. The program is as follows
    :
    : starting address 4100h .To transmit test data
    :
    : MVI A,4E ;initialize 8251 in Asynchronous mode
    : OUT C2 ; C2 is the port address for mode word register in 8251 in my kit as specified in the manual
    : MVI A,37 ; Enables Tx & Rx
    : OUT C2
    : MVI A,FF ; Test data
    : OUT C0 ; C0 is port address of 8251
    : RST 1 ; Reset the system
    :
    : starting address 4200h . To check the reception of data
    :
    : IN C0 ;get the loop backed data at port
    : STA 3200h ;store the result in 3200h
    : RST 1 ; Reset the system
    :
    : When we send the data to any port the data is stored in the hardware in a register. If I read the data from the register using an IN command, I think we'll get back the data. So how can I be sure that the data which I get is the loop backed data ,and not what I had put using the OUT command.
    :
    : thanx
    :
    : senthil
    :
    :

    Hi!

    Why don't you try these things:

    First, try your program as above with Tx and Rx [b]not[/b] connected. If you output FF, then input FF with the Tx and Rx disconnected, then you can't be reading loopbacked data.

    Next, do the IN first, and see what is returned before you do the OUT. Then, when you do the OUT, make sure the value is different than what you originally got from IN

    In other words, let's say you first do the IN, and get FF. then when you do the OUT, send 00. Do a second IN, and see what is returned. If it's FF again, then it's probably not the loopbacked data. If it's 00, then try other values to make sure they come back.

    Let me know what happens!

    Melissa



  • jorge_anastacjorge_anastac Posts: 2Member
    : : I want to check whether 8251A (USART) in my microprocessor (8085) kit is working properly. So I wrote a program for loop back. I mean I connected the Tx and Rx pins and transmitted the data. The program is as follows
    : :
    : : starting address 4100h .To transmit test data
    : :
    : : MVI A,4E ;initialize 8251 in Asynchronous mode
    : : OUT C2 ; C2 is the port address for mode word register in 8251 in my kit as specified in the manual
    : : MVI A,37 ; Enables Tx & Rx
    : : OUT C2
    : : MVI A,FF ; Test data
    : : OUT C0 ; C0 is port address of 8251
    : : RST 1 ; Reset the system
    : :
    : : starting address 4200h . To check the reception of data
    : :
    : : IN C0 ;get the loop backed data at port
    : : STA 3200h ;store the result in 3200h
    : : RST 1 ; Reset the system
    : :
    : : When we send the data to any port the data is stored in the hardware in a register. If I read the data from the register using an IN command, I think we'll get back the data. So how can I be sure that the data which I get is the loop backed data ,and not what I had put using the OUT command.
    : :
    : : thanx
    : :
    : : senthil
    : :
    : :
    :
    : Hi!
    :
    : Why don't you try these things:
    :
    : First, try your program as above with Tx and Rx [b]not[/b] connected. If you output FF, then input FF with the Tx and Rx disconnected, then you can't be reading loopbacked data.
    :
    : Next, do the IN first, and see what is returned before you do the OUT. Then, when you do the OUT, make sure the value is different than what you originally got from IN
    :
    : In other words, let's say you first do the IN, and get FF. then when you do the OUT, send 00. Do a second IN, and see what is returned. If it's FF again, then it's probably not the loopbacked data. If it's 00, then try other values to make sure they come back.
    :
    : Let me know what happens!
    :
    : Melissa
    :
    :
    :
    :
    Dear collegues,
    USART 8251a has a RxRDY pin (#14), wich is certainly connected to
    an interrupt line (RST) of your CPU (just check which one). This
    pin signals an incomming new char: RxRDY = Receiver ready, which
    means "character ready". So, you need to implement an interrupt
    routine under the correct interrupt. When this routine is activated,
    is because a new char is available, so that you can read it, and you
    can be sure that it is a new char - not the old one.

    Jorge



Sign In or Register to comment.