ARM Assembly Language uART0 Input Output, What am I doing wrong.

前端 未结 1 380
轮回少年
轮回少年 2020-12-22 12:51

Write two (2) ARM assembly language subroutines, called output_char and read_char. These subroutines will allow a user to enter a character and display the character in PuTT

1条回答
  •  时光取名叫无心
    2020-12-22 13:28

    This looks like it is related

    http://csserver.evansville.edu/~blandfor/EE311/ARMLecture/UARTNotes.pdf

    Considering these are supposed to be two separate functions, the previous comments above apply. Also, I will assume since the problem does not refer to initializing the UART, that it does work successfully otherwise. The STMFD/LDMFD/BX triplex should be associated with both functions. Also, considering the ARM procedure call standard

    http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf

    you probably should limit yourself to R0-R3 in your procedures, if possible. If you need more, you need to add them to the STMFD/LDMFD instructions so you don't modify registers without returning them to their previous state.

    The way the problem statement is written, the read_char function needs to call the write_char function to echo the character typed back to the screen. That is missing in your answer. It looks like the register holding the character is the same as the register sending the character, so that's good. Otherwise the read_character function looks OK.

    Your write_character function doesn't look quite correct however, your BIC 0xFFFF FFEF doesn't look right. You want to be looking at the Transmitter Empty bit, you should be using 0xFFFF FFBF. As a point of style, I would recommend using AND with the bit set you want versus BIC and the inverse. Makes it easier to see. If you aren't seeing anything on your output, this is most likely the problem since the BI (break indicator) bit at LSR[4] is probably never going high, so your code is looping forever.

    Lastly, the problem statement says to use read_char and output_char as your function names, so you need to add those labels to the STMFD instructions for each. Your BEQ is fine, it needs to loop back to the register read from the line status register, so it needs a separate target label.

    0 讨论(0)
提交回复
热议问题