⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zygd.asm

📁 利用点阵显示显示中文字符
💻 ASM
📖 第 1 页 / 共 4 页
字号:
;program :  Led display board with encoder
;Writer  :  yu wai wan
;Date    :  2000/05/09                    "Nam" Edit 2-7-2002
;Modified:  Creatideas
;Date    :  2000/11/29

;Version :  1.00

;Processor       PIC16C63A
;***********************************************************************************
;modified by:	ningxinlin
;ver	    :hd720
;des: add at24c16、max487,communica2te with computer to change the display
;it communicate with the computer when the j1.0 is on
;contant.use the key to decide what to display
;data: 12/11/2002
;at24c16 define: 700~77f display content,the others as same as 696
;************************************************************************************
;modified by:	Zzl
;description:	none floor message&arrow message,clean display
;use MCU ver:	16F73
;date:		2003/10/3/
;***********************************************************************************
;		LIST            p=16c63a,R=DEC;, COLUMNS=120, XREF=YES, NOWRAP,LINES=0

LIST   P=PIC16F73	;include         "P16C63.INC"
INCLUDE  "eeprom_7.asm"
;--------------------------------------------------------------------------------------------------
; 40 42 44 46 48 4a 4c 4e 50 52 54 56 58 5a 5c 5e 60 62 64 66 68 6a 6c 6e 70 72 74 76 78 7a 7c 7e |
;                                                                                                 |
; 41 43 45 47 49 4b 4d 4f 51 53 55 57 59 5b 5d 5f 61 63 65 67 69 6b 6d 6f 71 73 75 77 79 7b 7d 7f |
;                                                                                                 |
;--------------------------------------------------------------------------------------------------

;***********************************************************************************************************
;      About hand-shaking                							           *
;               											   *
;      Normal signal       11 cc cccc   - first send control code					   *
;                          10 nn nnnn   - display code0 						   *
;                          10 nn nnnn   - display code1						           *
;                          10 ab cccc   - control code and test code  a = is total number of c		   *
;                                                                     b = is total number of n		   *
;      read status from display unit									   *
;                          00 nn nnnn   - number of display unit					   *
;                          display return code 10 nn nnnn                       		           *
;      control display unit										   *
;                          01 nn nnnn   - first send number of display unit which encoder want to control  *
;                          10 aa aaaa   - send option which display unit must do  			   *
;             												   *
;***********************************************************************************************************
;Processor       PIC16C63
;==========================================================================;
;       Register Definitions
;
;==========================================================================
W                            EQU     H'0000'
F                            EQU     H'0001'

;----- Register Files------------------------------------------------------

INDF                    EQU     H'0000'
INDIRECT                EQU     H'0000'
TMR0                    EQU     H'0001'
PCL                     EQU     H'0002'
STATUS                  EQU     H'0003'
FSR                     EQU     H'0004'
PORTA                   EQU     H'0005'
PORTB                   EQU     H'0006'
PORTC			EQU     H'0007'
ROW_OUT			EQU	     0
IN1CE			EQU	     1
IN2CE			EQU	     2
SCL			EQU          3
SDA			EQU          4
SCLKPIN			EQU          3
SDAPIN			EQU          4
S138G			EQU	     5
CLK			EQU	     6
Rs232Pin		EQU	     7
ADCON1		EQU		0x9f

PCLATH                  EQU     H'008A'
INTCON                  EQU     H'000B'
PIR1                    EQU     H'000C'
PIR2                    EQU     H'000D'
TMR1L                   EQU     H'000E'
TMR1H                   EQU     H'000F'
T1CON                   EQU     H'0010'
TMR2                    EQU     H'0011'
T2CON                   EQU     H'0012'
SSPBUF                  EQU     H'0013'
SSPCON                  EQU     H'0014'
CCPR1L                  EQU     H'0015'
CCPR1H                  EQU     H'0016'
CCP1CON                 EQU     H'0017'
RCSTA                   EQU     H'0018'
TXREG                   EQU     H'0019'
RCREG                   EQU     H'001A'
CCPR2L                  EQU     H'001B'
CCPR2H                  EQU     H'001C'
CCP2CON                 EQU     H'001D'

OPTION_REG              EQU     H'0081'
TRISA                   EQU     H'0085'
TRISB                   EQU     H'0086'
TRISC                   EQU     H'0087'
PIE1                    EQU     H'008C'
PIE2                    EQU     H'008D'
PCON                    EQU     H'008E'
PR2                     EQU     H'0092'
SSPADD                  EQU     H'0093'
SSPSTAT                 EQU     H'0094'
TXSTA                   EQU     H'0098'
SPBRG                   EQU     H'0099'

;----- STATUS Bits --------------------------------------------------------

IRP                          EQU     H'0007'
RP1                          EQU     H'0006'
RP0                          EQU     H'0005'
NOT_TO                       EQU     H'0004'
NOT_PD                       EQU     H'0003'
Z                            EQU     H'0002'
ZFlag	                     EQU     2
DC                           EQU     H'0001'
C                            EQU     H'0000'
Carry	                     EQU     0
;----- INTCON Bits --------------------------------------------------------

GIE                          EQU     H'0007'
PEIE                         EQU     H'0006'
T0IE                         EQU     H'0005'
INTE                         EQU     H'0004'
RBIE                         EQU     H'0003'
T0IF                         EQU     H'0002'
INTF                         EQU     H'0001'
RBIF                         EQU     H'0000'

;----- PIR1 Bits ----------------------------------------------------------

PSPIF                        EQU     H'0007'
RCIF                         EQU     H'0005'
TXIF                         EQU     H'0004'
SSPIF                        EQU     H'0003'
CCP1IF                       EQU     H'0002'
TMR2IF                       EQU     H'0001'
TMR1IF                       EQU     H'0000'

;----- PIR2 Bits ----------------------------------------------------------

CCP2IF                       EQU     H'0000'

;----- T1CON Bits ---------------------------------------------------------

T1CKPS1                      EQU     H'0005'
T1CKPS0                      EQU     H'0004'
T1OSCEN                      EQU     H'0003'
NOT_T1SYNC                   EQU     H'0002'
T1INSYNC                     EQU     H'0002'    ; Backward compatibility only
TMR1CS                       EQU     H'0001'
TMR1ON                       EQU     H'0000'

;----- T2CON Bits ---------------------------------------------------------

TOUTPS3                      EQU     H'0006'
TOUTPS2                      EQU     H'0005'
TOUTPS1                      EQU     H'0004'
TOUTPS0                      EQU     H'0003'
TMR2ON                       EQU     H'0002'
T2CKPS1                      EQU     H'0001'
T2CKPS0                      EQU     H'0000'

;----- SSPCON Bits --------------------------------------------------------

WCOL                         EQU     H'0007'
SSPOV                        EQU     H'0006'
SSPEN                        EQU     H'0005'
CKP                          EQU     H'0004'
SSPM3                        EQU     H'0003'
SSPM2                        EQU     H'0002'
SSPM1                        EQU     H'0001'
SSPM0                        EQU     H'0000'

;----- CCP1CON Bits -------------------------------------------------------

CCP1X                        EQU     H'0005'
CCP1Y                        EQU     H'0004'
CCP1M3                       EQU     H'0003'
CCP1M2                       EQU     H'0002'
CCP1M1                       EQU     H'0001'
CCP1M0                       EQU     H'0000'

;----- RCSTA Bits ---------------------------------------------------------

SPEN                         EQU     H'0007'
RX9                          EQU     H'0006'
RC9                          EQU     H'0006'    ; Backward compatibility only
NOT_RC8                      EQU     H'0006'    ; Backward compatibility only
RC8_9                        EQU     H'0006'    ; Backward compatibility only
SREN                         EQU     H'0005'
CREN                         EQU     H'0004'
FERR                         EQU     H'0002'
OERR                         EQU     H'0001'
RX9D                         EQU     H'0000'
RCD8                         EQU     H'0000'    ; Backward compatibility only

;----- CCP2CON Bits -------------------------------------------------------

CCP2X                        EQU     H'0005'
CCP2Y                        EQU     H'0004'
CCP2M3                       EQU     H'0003'
CCP2M2                       EQU     H'0002'
CCP2M1                       EQU     H'0001'
CCP2M0                       EQU     H'0000'

;----- OPTION Bits --------------------------------------------------------

NOT_RBPU                     EQU     H'0007'
INTEDG                       EQU     H'0006'
T0CS                         EQU     H'0005'
T0SE                         EQU     H'0004'
PSA                          EQU     H'0003'
PS2                          EQU     H'0002'
PS1                          EQU     H'0001'
PS0                          EQU     H'0000'

;----- TRISE Bits ---------------------------------------------------------

IBF                          EQU     H'0007'
OBF                          EQU     H'0006'
IBOV                         EQU     H'0005'
PSPMODE                      EQU     H'0004'
TRISE2                       EQU     H'0002'
TRISE1                       EQU     H'0001'
TRISE0                       EQU     H'0000'

;----- PIE1 Bits ----------------------------------------------------------

PSPIE                        EQU     H'0007'
RCIE                         EQU     H'0005'
TXIE                         EQU     H'0004'
SSPIE                        EQU     H'0003'
CCP1IE                       EQU     H'0002'
TMR2IE                       EQU     H'0001'
TMR1IE                       EQU     H'0000'

;----- PIE2 Bits ----------------------------------------------------------

CCP2IE                       EQU     H'0000'

;----- PCON Bits ----------------------------------------------------------

NOT_POR                      EQU     H'0001'
NOT_BO                       EQU     H'0000'
NOT_BOR                      EQU     H'0000'

;----- SSPSTAT Bits -------------------------------------------------------

SMP                          EQU     H'0007'
CKE                          EQU     H'0006'
D                            EQU     H'0005'
I2C_DATA                     EQU     H'0005'
NOT_A                        EQU     H'0005'
NOT_ADDRESS                  EQU     H'0005'
D_A                          EQU     H'0005'
DATA_ADDRESS                 EQU     H'0005'
P                            EQU     H'0004'
I2C_STOP                     EQU     H'0004'
S                            EQU     H'0003'
I2C_START                    EQU     H'0003'
R                            EQU     H'0002'
I2C_READ                     EQU     H'0002'
NOT_W                        EQU     H'0002'
NOT_WRITE                    EQU     H'0002'
R_W                          EQU     H'0002'
READ_WRITE                   EQU     H'0002'
UA                           EQU     H'0001'
BF                           EQU     H'0000'

;----- TXSTA Bits ---------------------------------------------------------

CSRC                         EQU     H'0007'
TX9                          EQU     H'0006'
NOT_TX8                      EQU     H'0006'    ; Backward compatibility only
TX8_9                        EQU     H'0006'    ; Backward compatibility only
TXEN                         EQU     H'0005'
SYNC                         EQU     H'0004'
BRGH                         EQU     H'0002'
TRMT                         EQU     H'0001'
TX9D                         EQU     H'0000'
TXD8                         EQU     H'0000'    ; Backward compatibility only

rcounterl         equ       0X20
rcounterh         equ       0x21
displayflag       equ       0x22
ledaddress        equ       0x23
ledcounter        equ       0x24
romcounterl       equ       0x25

startaddress      equ       0x26
optiondata        equ       0x27
databank          equ       0x28
tableaddress      equ       0x29
tempa             equ       0x2a
tempb             equ       0x2b
;********eeprom_7****************************
Temp1			equ			0x21
Delayaddress	        equ			0x2c
Datakey			equ			0x2d
Counter			equ			0x2e
Rowcount		equ			0x2f
Faddr			equ			b'10100000'
Flagcode		equ			0x34
;*********************************************
pclath_temp       equ       0x2c
w_temp            equ       0x2d
status_temp       equ       0x2e
FSR_temp          equ       0x2f
Rowcount		equ			0x2f
datactrl          equ       0x30
dataleft          equ       0x31
dataright         equ       0x32

tdatactrl         equ       0x33
tdataleft         equ       0x34
tdataright        equ       0x35

romcounter        equ       0x36

romaddress        equ       0x37
rombank           equ       0x38

timera            equ       0x39
timerb            equ       0x3a


keya              equ       0x3b
keyb              equ       0x3c
tkeya             equ       0x3d
tkeyb             equ       0x3e
key_count1        equ       0x3f
Flagcode	  equ	    0x34
delay_int	  equ	    0x41
delay_a		  equ	    0x46
delay_b		  equ	    0x47
delay_c		  equ	    0x48
key_flag	  equ	    0x49
nofloor		  equ	    7
Flag1		  equ	    0x4c
continue_m	  equ	    1
conarr		  equ	    2
arr_stop	  equ	    3
updateF		  equ	    4
PoweronF	  equ	    5
ACsignalF	  equ	    6
AllffF		  equ	    7
coladdress	  equ	    0x4a
key_count2	  equ	    0x4b
key_count3	  equ	    0x4d
flag_arrow	  equ	    0x4e
bittm             equ       0x4F 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;定义的6位到11位转换存放数字0~9和number
;
;
number0          equ       0xf0
number1          equ       0xf1
number2          equ       0xf2
number3          equ       0xf3
number4          equ       0xf4
number5          equ       0xf5
number6          equ       0xf6
number7          equ       0xf7
number8          equ       0xf8
number9          equ       0xf9
number           equ       0xfa
number11           equ       0xfb

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
no_arrow_f	  equ	    7
Faddr		  equ	    b'10100000'
#define           read_bit       PORTA,1
#define           shift_clk      PORTA,2
#define           load_data      PORTA,3
SDI          equ           3
clk1         equ           4
latch1       equ           5     

                org        0x0000
                goto       Start

                org        0x0004
ledint
		movwf      w_temp
                swapf      STATUS,w   

                movwf      status_temp

                movf       FSR,w
                movwf      FSR_temp
                movf       PCLATH,w
                movwf      pclath_temp

                CLRWDT
                bsf	   STATUS,RP0
                MOVLW	   0X00
                MOVWF	   TRISB
                BCF	   STATUS,RP0
                nop
                nop
                bsf	   PORTC,IN1CE
                bsf	   PORTC,IN2CE
		    ;bsf	   PORTC,5	;138G
ledint_next     
                btfss      PIR1,TMR2IF
                goto       continu_int

                movlw      0x02
                xorwf      displayflag,f

                
                ;movlw      0xff
                ;movwf      PORTB
                ;bsf	   PORTC,ROW_OUT
                ;bcf	   PORTC,ROW_OUT


                movlw      0x04
                movwf      rcounterh
		BSF     PORTA, LATCH1

ledint_01    
               ;bcf	   PORTC,0
		    movf       ledaddress,w
                movwf      FSR
                call       jkjke
                movlw      0x05
                addwf      ledaddress,f

                decfsz     rcounterh,f
                goto       ledint_01
                BCF     PORTA, LATCH1
                NOP
                NOP
                NOP			;OUTPUT ENABLE OF TB62726
                ;BSF     PORTA, LATCH1
		    movf       coladdress,w
                movwf      PORTB
                bSf     portc,row_out
                ;NOP
                ;NOP
                ;NOP 
                ;bcf     portc,row_out

                movlw      0x65		;14            ;speed of moving arrow
                movwf      rcounterh

ddloop1         
                clrwdt
                decfsz     rcounterh,f
                goto       ddloop1

		    ;movlw      0x04
                ;movwf      rcounterh
                ;bcf	   PORTC,5
                movlw   0xff
                movwf   portb 
                bSf     portc,row_out
                ;NOP
                ;NOP
                ;NOP 
                bcf     portc,row_out
ledint_a
            ;bcf	   PORTC,0
		;movlw      0xff
		;movwf      PORTB
                ;bsf        PORTC,6	;CLK
                ;nop
		;nop
		;nop
		;nop
		;nop
                ;bcf        PORTC,6	;CLK

                ;decfsz     rcounterh,f
                ;goto       ledint_a

		;movlw	   0xff
		;movwf	   PORTA
		movlw      0x13
                subwf      ledaddress,f
                rlf        coladdress,f
                ;movlw	   0x08
                ;addwf	   coladdress,f

                ;movlw	   0x38
                ;andwf	   coladdress,f
                ;movlw	   0x28
                ;subwf	   coladdress,w
                
                btfsc      coladdress,5
                goto       continu_int
		btfsc	   displayflag,0
		decf	   databank,f
		movlw      0xfe
                movwf      coladdress
                movlw      0x6c
                movwf      ledaddress

continu_int
		;bcf		PORTC,5
		movlw		0x02
		movwf		PCLATH
		btfsc		Flag1,continue_m
		call		move_uparrow
		

init1	       
                movlw      0xff
                movwf      PORTB
                bsf	   PORTC,ROW_OUT
                bcf	   PORTC,ROW_OUT
                ;bcf	   PORTC,5
		    movf       pclath_temp,w
                movwf      PCLATH
                movf       FSR_temp,w
                movwf      FSR
                swapf      status_temp,w
                movwf      STATUS
                swapf      w_temp,f
                swapf      w_temp,w
                bcf        PIR1,TMR2IF          ;reset interrupt flag
		retfie

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -