Problems Write programs that will accomplish the desired tasks listed below, using as few lines of code as possible. Use only opcodes that have been covered up to this chapter. Comment on each line of code. 1. Place the number 3Bh in internal RAM locations 30h to 32h. 2. Copy the data at internal RAM […]
Continue reading…
Moving Data on 8051
Summary of Moving Data
Summary The opcodes that move data between locations within the 8051 and between the 8051 and external memory have been discussed. The general form and results of these instructions are as follows. Instruction Type Result MOV destination, source Copy data from the internal RAM source address to the internal RAM destination address MOVC A, source […]
Continue reading…
Example Programs
Example Programs Programming is at once a skill and an art. Just as anyone may learn to play a musical instrument after sufficient instruction and practice. so may anyone learn to program a computer. Some individuals. however. have a gift for programming that sets them apart from their peers with the same level of experience. […]
Continue reading…
Data Exchanges
Data Exchanges MOV, PUSH, and POP opcodes all involve copying the data found in the source address to the destination address; the original data in the source is not changed. Exchange instructions actually move data in two directions: from source to destination and from destination to source. All addressing modes except immediate may be used […]
Continue reading…
PUSH and POP Opcodes
PUSH and POP Opcodes The PUSH and POP opcodes specify the direct address of the data. The data moves between an area of internal RAM, known as the stack, and the specified direct address. The stack pointer special-function register (SP) contains the address in RAM where data from the source address will be PUSHed, or […]
Continue reading…
Code Memory Read-Only Data Moves
Code Memory Read-Only Data Moves Data moves between RAM locations and 8051 registers are made by using MOV and MOVX opcodes. The data is usually of a temporary or "scratch pad" nature and disappears when the system is powered down. There are times when access to a preprogrammed mass of data is needed, such as […]
Continue reading…
Indirect Addressing Mode
Indirect Addressing Mode For all the addressing modes covered to this point, the source or destination of the data is an absolute number or a name. Inspection of the opcode reveals exactly what are the addresses of the destination and source. For example, the opcode MOV A,R7 says that the A register will get a […]
Continue reading…
Direct Addressing Mode
Direct Addressing Mode All 128 bytes of internal RAM and the SFRs may be addressed directly using the single byte address assigned to each RAM location and each special-function register. Internal RAM uses addresses from 00 to 7Fh to address each byte. The SFR addresses exist from 80h to FFh at the following locations: SFR […]
Continue reading…
Moving Data
Moving Data Outline: o Introduction o Addressing Modes o External Data Moves o PUSH and POP Opcodes o Data Exchanges o Example Programs o Summary Introduction A computer typically spends more time moving data from one location to another than it spends on any other operation. It is not surprising, therefore, to find that more […]
Continue reading…