📄 sub_refresh_display_buffers.s
字号:
;START_HEADER
;
; dsPIC30F6014 Demo Source File
; (c) Copyright 2005 Microchip Technology, All rights reserved
;
; --------------------------------------------------------------------------
; File Revision History:
; --------------------------------------------------------------------------
;
; $Log: sub_refresh_display_buffers.s,v $
; Revision 1.3 2005/04/04 23:38:30 VasukiH
; Updated comments in header
;
; Revision 1.2 2005/04/04 23:13:59 VasukiH
; Updates for MPLAB C30 v1.30 compatiblity
;
; Revision 1.1.1.1 2003/08/23 00:38:33 VasukiH
; First import of demo source into CVS Repository
;
;
;
; --------------------------------------------------------------------------
;
; Software and Development Tools Info:
; --------------------------------------------------------------------------
; Tool Version
; --------------------------------------------------------------------------
; MPLAB IDE 7.0
; MPLAB C30 Toolsuite 1.30
; dsPICDEM(TM) Processor Board 1.10
; --------------------------------------------------------------------------
;
; File Notes:
; 1. This file contains the UART and LCD display string definitions.
; 2. This file also contains routine that refreshes the display strings
; with new results.
; 3. This file calls C routines that are used to convert from hexadecimal
; to decimal.
;
;END_HEADER
.include "p30fxxxx.inc"
.include "common.inc"
.global POR_disp, Main_disp, Data_disp, DSP_disp, DTMF_disp, Cursor_disp, Cursor_disp1
.global lcd_freq1, lcd_temp, lcd_RP1, lcd_RP2, lcd_RP3
.global lcd_flttime, lcd_ffttime, lcd_freq2, lcd_bin, lcd_fftsize, lcd_flttype
.global CursorPos
.global DtmfSeq
.section .nbss, bss, near
adc_sample_ascii: .space 4
negtempflag: .space 2
.section .ndata, data, near
;Following variables belong to the UART Display buffer
.align WORD
smp1str: .byte 0x0A, 0x0D
.ascii "RP1 = "
smp1val: .ascii "0.00v"
smp2str: .byte 0x0A, 0x0D
.ascii "RP2 = "
smp2val: .ascii "0.00v"
smp3str: .byte 0x0A, 0x0D
.ascii "RP3 = "
smp3val: .ascii "0.00v"
smp4str: .byte 0x0A, 0x0D
.ascii "Temp = "
smp4val: .ascii "+uu"
.ascii " deg C"
smp5str: .byte 0x0A, 0x0D
.ascii "Frequecy = "
smp5val1: .ascii "0000"
.ascii "Hz / "
.ascii "Bin = "
smp5val2: .ascii " 000"
smp6str: .byte 0x0A, 0x0D
.ascii "Filter Type - "
smp6val: .ascii "IIR "
smp7str: .byte 0x0A, 0x0D
.ascii "Filtering Time = "
smp7val: .ascii "000000 Cycles"
smp8str: .byte 0x0A, 0x0D
.ascii "FFT Time = "
smp8val: .ascii "000000 Cycles"
smp9str1: .byte 0x0A, 0x0D
smp9val: .ascii "256"
smp9str2: .ascii "-Point FFT"
endsmpstr: .byte 0x0A, 0x0D
.asciz " "
.section .ndata, data, near
;Following variables belong to the LCD Display buffer
.align WORD
POR_disp : .ascii " dsPIC30F 16-bit "
.ascii " Digital Signal "
.ascii " Controller "
.ascii "Demo main menu - s1 "
Main_disp: .ascii " Menu Options "
.ascii "Data Acq Display- S2"
.ascii "DSP Operations - S3"
.ascii "DTMF Generation - S4"
Data_disp: .ascii "F="
lcd_freq1: .ascii "0000hz Temp="
lcd_temp: .ascii "+00dgC"
.ascii "RP1="
lcd_RP1: .ascii "0.00v RP2="
lcd_RP2: .ascii "0.00v "
.ascii "RP3="
lcd_RP3: .ascii "0.00v "
.ascii "main - s1 "
DSP_disp : .ascii "F="
lcd_freq2: .ascii "0000hz Bin="
lcd_bin: .ascii "000"
lcd_fftsize: .ascii "256pt Tfft ="
lcd_ffttime: .ascii "000000cy"
lcd_flttype: .ascii "IIR Tfilt ="
lcd_flttime: .ascii "000000cy"
.ascii "main-s1 chng filt-s2"
DTMF_disp: .ascii "Dtmf Tone 0123456789"
.ascii "next -s2 "
.ascii "select -s3 "
.ascii "play seq-s4 main-s1"
Cursor_disp1: .byte 0xAD, 0x02, 0xC5, 0x0A, 0x00
.align WORD
CursorPos: .byte 0x0A, 0x00
DtmfSeq: .ascii "4807927146"
.section .text
.global _sub_refresh_display_buffers
_sub_refresh_display_buffers:
push.d w0
push.d w2
mov PotRP1, w0
rcall _adcvolt
mov #smp1val, w1 ;Update Pot RP1 decimal ASCII value on UART
mov #lcd_RP1, w2 ;Update Pot RP1 decimal ASCII value on LCD
rcall refresh_adc_dispstr
mov PotRP2, w0
rcall _adcvolt
mov #smp2val, w1 ;Update Pot RP2 decimal ASCII value on UART
mov #lcd_RP2, w2 ;Update Pot RP2 decimal ASCII value on LCD
rcall refresh_adc_dispstr
mov PotRP3, w0
rcall _adcvolt
mov #smp3val, w1 ;Update Pot RP3 decimal ASCII value on UART
mov #lcd_RP3, w2 ;Update Pot RP3 decimal ASCII value on LCD
rcall refresh_adc_dispstr ;Call routine present downstream in this file
clr negtempflag ;Is the temperature Negative?
mov TempSens, w0 ;If so ensure that the "-" character appears
sub #0x0199, w0
bra c, not_subzerotemp
mov TempSens, w0
mov #0x0199, w1 ;0x199 is equal to 500 mv in 12-bit 5v ref. A/D
subr w0, w1, w0
setm negtempflag
not_subzerotemp:
rcall _adcvolt
mov #smp4val, w1
mov #lcd_temp, w2
mov #0x002B,w0
btsc negtempflag, #0
inc2 w0, w0
mov.b w0, [w1++] ;Update various digits in the temperature
mov.b w0, [w2++]
mov.b _adtenths, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _adhundredths, WREG
mov.b w0, [w1]
mov.b w0, [w2]
mov PeakFrequecy, w0 ;Update frequency in display buffers
rcall _hextodec
mov #smp5val1, w1
mov #lcd_freq1, w2
mov #lcd_freq2, w3
mov.b _freq1000, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b w0, [w3++]
mov.b _freq100, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b w0, [w3++]
mov.b _freq10, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b w0, [w3++]
mov.b _freq1, WREG
mov.b w0, [w1]
mov.b w0, [w2]
mov.b w0, [w3]
mov PeakBin, w0 ;Update Peak Frequency's Bin value
rcall _hextodec
mov #smp5val2, w1
mov #lcd_bin, w2
inc w1, w1
mov.b _freq100, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _freq10, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _freq1, WREG
mov.b w0, [w1]
mov.b w0, [w2]
mov FilterType, w0 ;Update Filter Type
cp w0, #0
bra nz, CurFltTypeFir
CurFltTypeIir:
mov #0x4949, w0
mov #0x2052, w1
bra UpdateFiltType
CurFltTypeFir:
cp w0, #1
bra nz, CurFltTypeNone
mov #0x4946, w0
mov #0x2052, w1
bra UpdateFiltType
CurFltTypeNone:
cp w0, #2
bra nz, SkipFiltTypeUpdate
mov #0x4F4E, w0
mov #0x454E, w1
UpdateFiltType:
mov.b WREG, lcd_flttype
mov.b WREG, smp6val
swap w0
mov.b WREG, lcd_flttype+1
mov.b WREG, smp6val+1
mov w1, w0
mov.b WREG, lcd_flttype+2
mov.b WREG, smp6val+2
swap w0
mov.b WREG, lcd_flttype+3
mov.b WREG, smp6val+3
SkipFiltTypeUpdate:
mov FilteringTime, w0 ;Update filtering time
mov FilteringTime+2, w1
rcall _hextolong
mov #smp7val, w1
mov #lcd_flttime, w2
mov.b _time100000, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time10000, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time1000, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time100, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time10, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time1, WREG
mov.b w0, [w1]
mov.b w0, [w2]
mov FFTTime, w0 ;Update FFT time
mov FFTTime+2, w1
rcall _hextolong
mov #smp8val, w1
mov #lcd_ffttime, w2
mov.b _time100000, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time10000, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time1000, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time100, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time10, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _time1, WREG
mov.b w0, [w1]
mov.b w0, [w2]
btsc ResultDispFlag, #0
bra kickoffUART
bra exit_routine
kickoffUART:
mov #smp1str, w1
mov w1, U2TXPtr
mov.b [w1], w0
mov.b WREG, U2TXREG
clr ResultDispFlag
exit_routine:
pop.d w2
pop.d w0
return
refresh_adc_dispstr:
mov.b _adones, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
inc w1, w1
inc w2, w2
mov.b _adtenths, WREG
mov.b w0, [w1++]
mov.b w0, [w2++]
mov.b _adhundredths, WREG
mov.b w0, [w1]
mov.b w0, [w2]
return
.end ;EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -