📄 chap1.asm
字号:
; Chapter 1 6805 assembly language programs; Jonathan W. Valvano; This software accompanies the book,; Embedded Microcomputer Systems: Real Time Interfacing; published by Brooks Cole, 1999;; Program 1.8. Assembly definitions of the MC68HC705J1A I/O ports.PORTA equ $0000 8-bit bidirectional I/O portPORTB equ $0001 6-bit bidirectional I/O portDDRA equ $0004 specifies whether each bit is input(0) or output(1)DDRB equ $0005 specifies whether each bit is input(0) or output(1)TCR equ $0009 8-bit up counter incremented every memory clock; Program 1.9. Assembly definitions of the MC68HC05C I/O ports.PORTA equ $0000 8-bit bidirectional I/O portPORTB equ $0001 8-bit bidirectional I/O portPORTC equ $0002 8-bit bidirectional I/O portPORTD equ $0003 7-bit fixed input port (shared with SPI, SCI)DDRA equ $0004 specifies whether each bit is input(0) or output(1)DDRB equ $0005 specifies whether each bit is input(0) or output(1)DDRC equ $0006 specifies whether each bit is input(0) or output(1)TSC equ $0012 Timer status and controlTCNT equ $0018 16-bit up counter incremented every clock period; Program 1.14. Assembly software that reads from port A and writes to port B.; Program to implement a NOT gate; Port A are the 8 digital inputs and Port B are the 8 digital outputs; Software continuously repeats the following; 1) Read value from Port A; 2) Calculate the logical complement; 3) Write the result out to Port BNotGate lda PORTA Read from Port A into Register A coma Logical complement sta PORTB Write from Register A to Port B bra NotGate; Program 1.16. Assembly software that initializes an I/O port to input.; MC68HC705J1A clr DDRA; Program 1.18. Assembly software that reads from an I/O port input.; MC68HC705J1A lda PORTA sta Happiness; Program 1.20. Assembly software that initializes an I/O port to output.; MC68HC705J1A lda #$0F sta DDRA;Program 1.22. Assembly software that outputs an I/O port output.; MC68HC705J1A lda #$FF sta PORTA; Program 1.24. Assembly subroutines that provide initialization, read and write access an I/O port.; MC68HC705J1AInit sta DDRA rtsSet sta PORTA rtsRead lda PORTA rts; Program 1.26. Assembly subroutine that initializes the I/O port.; MC68HC05C4PORTC equ $0002 ;I/O portDDRC equ $0006 init lda #$F0 ;PC7-PC3 out sta DDRC ;PC3-PC0 in rts; Program 1.27. Assembly program that implements the 4 bit NOT gate.; MC68HC05C4 org $0100 ;ROMmain rsp ;SP=$00FF bsr init ;ritualloop lda PORTC ;input coma ;logical not lsla ;shift lsla lsla lsla sta PORTC ;output bra loop ;repeat org $1FFE fdb main ;reset vector
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -