; Copyright (c) 1998, MICROCHIP Technology Inc
;*******************************************
TITLE "PS7219 TEST" ;Title
LIST P=16C711 ;Processor is PIC16C711 microcontroller
#INCLUDE P16c711.INC
TIMER1 EQU H'000C' ;Define delay register
TIMER2 EQU H'000D'
SENT_ADDRESS EQU H'000E' ;Define send address register
SENT_DATA EQU H'000F' ;Define send data register
LED1 EQU H'0010'
LED2 EQU H'0011'
LED3 EQU H'0012'
LED4 EQU H'0013'
LED5 EQU H'0014'
LED6 EQU H'0015'
LED7 EQU H'0016'
LED8 EQU H'0017'
COUNT EQU H'0018'
NO_OP EQU 0X00 ;Define control register
DIGIT1 EQU 0X01
DIGIT2 EQU 0X02
DIGIT3 EQU 0X03
DIGIT4 EQU 0X04 DIGIT5
EQU 0X05
DIGIT6 EQU 0X06
DIGIT7 EQU 0X07
DIGIT8 EQU 0X08
DECODE EQU 0X09
INTSEN EQU 0X0A
SCAN EQU 0X0B
SHUT EQU 0X0C
FLASH EQU 0X0D
DISPLAY EQU 0X0F
LOAD EQU 0 ;Communication pin definition
DOUT EQU 1
CLK EQU 2
ORG 0
GOTO START ;Program start
ORG H'0010'
;****************************
; Delay subroutine
;*************************
T1
MOVLW 33 ;Delay subroutine T1
MOVWF TIMER1
DEL_LOP
CLRWDT
DECFSZ TIMER1,1
GOTO DEL_LOP
RETURN
T2
MOVLW 0X04 ;Delay subroutine T2
MOVWF TIMER1
MOVLW 0XFF
LOOP2
MOVWF TIMER2
LOOP1
CLRWDT
DECFSZ TIMER2,1
GOTO LOOP1
DECFSZ TIMER1,1
GOTO LOOP2
RETURN
SEND
MOVLW 8 ;Data transfer subroutine SEND
MOVWF COUNT
BCF PORTA,LOAD ;Initialize LOAD pin
CALL T1
SET_LP1
BCF STATUS,C ;Send 8-bit address
BSF PORTA,CLK
RLF SENT_ADDRESS,1
BCF PORTA,DOUT
BTFSC STATUS,C
BSF PORTA,DOUT
BCF PORTA,CLK
CALL T1 ;Call delay subroutine T1
DECFSZ COUNT,1 ;When COUNT is reduced by one and becomes zero, the transfer ends
GOTO SET_LP1
BSF PORTA,CLK
MOVLW 8
MOVWF COUNT
BSF PORTA,LOAD
SET_LP2
BCF STATUS,C ;Send 8-bit data
BSF PORTA,CLK
RLF SENT_DATA,1
BCF PORTA,DOUT
BTFSC STATUS,C
BSF PORTA,DOUT
BCF PORTA,CLK
CALL T1 ;Call delay subroutine T1
DECFSZ COUNT,1 ;When COUNT is reduced by one and becomes zero, the transfer ends
GOTO SET_LP2
BSF PORTA,CLK
CALL T1
BSF PORTA,LOAD
BSF PORTA,DOUT
RETURN ;The subroutine returns
to START
BSF STATUS,RP0 ; Main program
MOVLW 0X18
MOVWF TRISA
MOVLW 0XFF
MOVWF TRISB
BCF STATUS,RP0
CALL T1
CALL T1
MOVLW 0X12
MOVWF PORTA
BCF PORTA,LOAD
CON_COM
CALL T1 ;Initialize PS7219 internal RAM
MOVLW 0X0A ;Set the brightness to the brightest
MOVWF SENT_ADDRESS
MOVLW 0X0F
MOVWF SENT_DATA
CALL SEND ;Call serial communication subroutine
CALL T1
MOVLW 0X0B ;Set the scan boundary to 8 bits
MOVWF SENT_ADDRESS
MOVLW 0X07
MOVWF SENT_DATA
CALL SEND ;Call serial communication subroutine
CALL T1
MOVLW 0X09 ;Set each bit decoding mode to BCD decoding
MOVWF SENT_ADDRESS
MOVLW 0XFF
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X0C ;Set the working mode to normal
MOVWF SENT_ADDRESS
MOVLW 0X01
MOVWF SENT_DATA
CALL SEND
LED_CON
CALL T1 ;LED display control part
MOVLW 0X01 ;LED1 displays 1
MOVWF SENT_ADDRESS
MOVLW 0X01
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X02 ;LED2 displays 2
MOVWF SENT_ADDRESS
MOVLW 0X02
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X03 ;LED3 displays 3
MOVWF SENT_ADDRESS
MOVLW 0X03
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X04 ;LED4 displays 4
MOVWF SENT_ADDRESS
MOVLW 0X04
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X05 ;LED5 displays as 5
MOVWF SENT_ADDRESS
MOVLW 0X05
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X06 ;LED6 displays as 6
MOVWF SENT_ADDRESS
MOVLW 0X06
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X07 ;LED7 displays as 7
MOVWF SENT_ADDRESS
MOVLW 0X07
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X08 ;LED8 displays as 8
MOVWF SENT_ADDRESS
MOVLW 0X08
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X0F ;Enter test mode
MOVWF SENT_ADDRESS
MOVLW 0X01
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X0F ;Exit test mode
MOVWF SENT_ADDRESS
MOVLW 0X00
MOVWF SENT_DATA
CALL SEND
CALL T1
MOVLW 0X0D ;Enable 8-bit LED flashing
MOVWF SENT_ADDRESS
MOVLW 0XFF
MOVWF SENT_DATA
CALL SEND
FINISH CLRWDT ;Clear Watch Dog
GOTO FINISH
END ;End
Previous article:Example program to read and write 1-wire EEPROM DS2430 using PIC microcontroller
Next article:Problems and Countermeasures in Application of PIC16C71/PIC16C84 Microcontroller
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Amateur 30MHz wireless walkie-talkie
- [Jihai APM32E103VET6S MINI development board review] Part 3: Timer PWM breathing light
- The MAX2395 output is matched to the SAW filter input for optimal cascaded gain flatness
- Deleting the database and running away happened again! Employees working from home destroyed the server, and the company's market value evaporated by 900 million in one day
- What does IAR do before main?
- Design of high linearity low voltage low noise amplifier
- Help!
- Solution of DC power supply soft start circuit
- Modlesim Advanced Techniques
- 【Complain and Get Rewarded】Complain about the forum news alerts.