Indexed Addressing and Array Access in the HC11 Microprocessor

...sign for its functionality, SP 2 needed to customize a generic delay subroutine provided along with the project definition. Both these programs had to be loaded into and run from the RAM of the HC11 Section three, which needed both the Hex display as well as the DIP switch, involved writing and implementing a program which would either display the nine digits of the SSN or the decimal adjusted sum of the nine SSN numbers one after the other, depending on the position of the DIP switch. This program had to be run from the EEPROM of the HC11. This report presents both procedures for achieving these three separate designs and assessments of how well the designs worked. Also included in the report is pseudo code for the programs (shown in Appendix A), the listing files for the programs (shown in Appendix B), and a tutorial on indexing and array access (Appendix C). Section 2: Writing and Assembling Simple Programs This section called for writing two programs, assembling them, loading them into the RAM of the HC11 and running the programs to verify their correct operation. The programs will be referred to as Simple Program one, SP 1, and Simple Program two, SP 2. Both these designs require the Hex display. SP 1 requires the use of the DIP switch while SP 2 requires the use of the delay subroutine ‘del_sub’. The output is sent to the Hex display through port B while input from the DIP switch comes in on port A. SP 1 In this program we are required to output the alphabets ‘E’ or ‘F’ to the Hex display. Switch input = 1 should produce the output ‘E’ while switch input = 0 should produce the output ‘F’. Output port B is used to output these alphabets to the Hex display. PB3:0 are used to connect to the Hex display. The DIP switch is connected to pin 1 of port A through current limiting resistors which are also connected to power and ground. On execution, the program needs to check the status of the DIP switch, whether it is on or off (1 or 0) and then accordingly display the appropriate alphabet. The program definition asks us to load this program into the HC11 RAM starting at address $120. SP 2 In this program, upon execution the Hex display should display the alphabet ‘E’ followed by a 2 second delay, then display ‘F’ followed by a 3 second delay before displaying ‘E’ again and the whole cycle repeating infinitely until the board is reset or power is recycled. The DIP switch is not used in this program. However, the delay subroutine needs to be customized to adjust the delay time to 2 and 3 seconds. Also, the delay sub-routine needs to be accessed using the ‘include’ directive of the assembler. Since the delay subroutine was using index register ‘IX’ and accumulator B to count down time, we had to calculate and pass appropriate values of ‘IX’ and ‘acc b’ for 2 or 3 second delay before we called the sub routine. This had to be done taking into account the structure of the subroutine commands, i.e. how many cycles each command consumed and how the generic loop would operate. Section 2 Design Assessment The two programs were relatively easy to conceive, code, and implement. Both these programs, SP 1 and SP 2, laid the foundation for the program in the next section. The specially provided delay subroutine had to be studied in order to understand its delay functionality. The subroutine ‘del_sub’ used the accumulator b (acc b) and index register X (IX) to run through two loops, outer and inner respectively. To keep the loop as efficient as possible, it was decided to maximize the value of the IX to 65535 so that it transitioned from the inner loop to the outer loop as less as possible. Thus the value of acc b would be adjusted for the different delay durations of 2 and 3 seconds. Section 3: Array Access & Operating in Standalone Mode In this section, we were required to write, assemble and load a program into the EEPROM of the HC11, restart the machine and run the program in the standalone mode to verify the correct operation of the program without using the Buffalo monitor. This program, which uses indexed addressing, will access a file which has been linked using the ‘include’ directive of AS11, retrieve the data, which in this case are Social Security Numbers (SSN). If the switch is high (input = 1), then it would display the SSN one digit at a time with a two second...

Essay Information


Words: 1407
Pages: 5.6
Rating: None

All Papers Are For Research And Reference Purposes Only. You must cite our web site as your source.