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

📄 lcd.log

📁 FPGA 基于PICOBLAZE内核的LCD显示程序,完整,XILINX
💻 LOG
📖 第 1 页 / 共 3 页
字号:
 00D                             ; Display frequency on top line of the LCD and DDS data on the lower line
 00D                             ;**************************************************************************************
 00D                             ;
 00D                             ; The BCD value should be stored in scratch pad memory in 9 ascending locations
 00D                             ; called BCD_digit0 to BCD_digit8.
 00D                             ;
 00D                             ; The value is displayed in the format      xxx.xxx xxxMHz
 00D                             ;
 00D                             ; However, the most significant 2 digits will be blanked if zero.
 00D                             ;
 00D                             ; registers used s0,s1,s2,s3,s4,s5,s6,s7
 00D                             ;
 00D                             ;
 00D                             ;
 00D  00303    display_3_digits: LOAD s3, 03                         ;3 digits to display
 00E  07520         3digit_loop: FETCH s5, (s2)
 00F  30014                      CALL display_digit[014]
 010  1C201                      SUB s2, 01                          ;decrement digit pointer
 011  1C301                      SUB s3, 01                          ;count digits displayed
 012  3540E                      JUMP NZ, 3digit_loop[00E]
 013  2A000                      RETURN
 014                             ;
 014  18530       display_digit: ADD s5, 30                          ;convert BCD to ASCII character
 015  30097                      CALL LCD_write_data[097]
 016  2A000                      RETURN
 017                             ;
 017  00520       display_space: LOAD s5, character_space[20]
 018  30097                      CALL LCD_write_data[097]
 019  2A000                      RETURN
 01A                             ;
 01A                             ;
 01A                             ;
 01A                             ;
 01A                             ;
 01A                             ;**************************************************************************************
 01A                             ; Routines to display hexadecimal values on LCD display
 01A                             ;**************************************************************************************
 01A                             ;
 01A                             ;
 01A                             ; Convert hexadecimal value provided in register s0 into ASCII characters
 01A                             ;
 01A                             ; The value provided must can be any value in the range 00 to FF and will be converted into
 01A                             ; two ASCII characters.
 01A                             ;     The upper nibble will be represented by an ASCII character returned in register s3.
 01A                             ;     The lower nibble will be represented by an ASCII character returned in register s2.
 01A                             ;
 01A                             ; The ASCII representations of '0' to '9' are 30 to 39 hexadecimal which is simply 30 hex
 01A                             ; added to the actual decimal value. The ASCII representations of 'A' to 'F' are 41 to 46
 01A                             ; hexadecimal requiring a further addition of 07 to the 30 already added.
 01A                             ;
 01A                             ; Registers used s0, s2 and s3.
 01A                             ;
 01A  01200   hex_byte_to_ASCII: LOAD s2, s0                         ;remember value supplied
 01B  2000E                      SR0 s0                              ;isolate upper nibble
 01C  2000E                      SR0 s0
 01D  2000E                      SR0 s0
 01E  2000E                      SR0 s0
 01F  30026                      CALL hex_to_ASCII[026]              ;convert
 020  01300                      LOAD s3, s0                         ;upper nibble value in s3
 021  01020                      LOAD s0, s2                         ;restore complete value
 022  0A00F                      AND s0, 0F                          ;isolate lower nibble
 023  30026                      CALL hex_to_ASCII[026]              ;convert
 024  01200                      LOAD s2, s0                         ;lower nibble value in s2
 025  2A000                      RETURN
 026                             ;
 026                             ; Convert hexadecimal value provided in register s0 into ASCII character
 026                             ;
 026                             ;Register used s0
 026                             ;
 026  1C00A        hex_to_ASCII: SUB s0, 0A                          ;test if value is in range 0 to 9
 027  35829                      JUMP C, number_char[029]
 028  18007                      ADD s0, 07                          ;ASCII char A to F in range 41 to 46
 029  1803A         number_char: ADD s0, 3A                          ;ASCII char 0 to 9 in range 30 to 40
 02A  2A000                      RETURN
 02B                             ;
 02B                             ;
 02B                             ; Display the two character HEX value of the register contents 's0' on the LCD
 02B                             ; at the current cursor position.
 02B                             ;
 02B                             ; Registers used s0, s1, s2, s3, s4, s5
 02B                             ;
 02B  3001A    display_hex_byte: CALL hex_byte_to_ASCII[01A]
 02C  01530                      LOAD s5, s3
 02D  30097                      CALL LCD_write_data[097]
 02E  01520                      LOAD s5, s2
 02F  30097                      CALL LCD_write_data[097]
 030  2A000                      RETURN
 031                             ;
 031                             ;
 031                             ;
 031                             ; Display the 32-bit value stored in 4 ascending memory locations as an 8 character
 031                             ; HEX value at the current cursor position. Register s7 must contain the memory
 031                             ; location of the most significant byte (which is also the highest address).
 031                             ;
 031                             ; Registers used s0, s1, s2, s3, s4, s5, s6, s7
 031                             ;
 031  00604  display_hex_32_bit: LOAD s6, 04                         ;4 bytes to display
 032  07070         disp32_loop: FETCH s0, (s7)                      ;read byte
 033  3002B                      CALL display_hex_byte[02B]          ;display byte
 034  1C701                      SUB s7, 01                          ;decrement pointer
 035  1C601                      SUB s6, 01                          ;count bytes displayed
 036  2B000                      RETURN Z
 037  34032                      JUMP disp32_loop[032]
 038                             ;
 038                             ;
 038                             ;**************************************************************************************
 038                             ;LCD text messages
 038                             ;**************************************************************************************
 038                             ;
 038                             ;
 038                             ;Display 'Frequency' on LCD at current cursor position
 038                             ;
 038  00546      disp_Frequency: LOAD s5, character_F[46]
 039  30097                      CALL LCD_write_data[097]
 03A  00572                      LOAD s5, character_r[72]
 03B  30097                      CALL LCD_write_data[097]
 03C  00565                      LOAD s5, character_e[65]
 03D  30097                      CALL LCD_write_data[097]
 03E  00571                      LOAD s5, character_q[71]
 03F  30097                      CALL LCD_write_data[097]
 040  00575                      LOAD s5, character_u[75]
 041  30097                      CALL LCD_write_data[097]
 042  00565                      LOAD s5, character_e[65]
 043  30097                      CALL LCD_write_data[097]
 044  0056E                      LOAD s5, character_n[6E]
 045  30097                      CALL LCD_write_data[097]
 046  00563                      LOAD s5, character_c[63]
 047  30097                      CALL LCD_write_data[097]
 048  00579                      LOAD s5, character_y[79]
 049  30097                      CALL LCD_write_data[097]
 04A  2A000                      RETURN
 04B                             ;
 04B                             ;Display 'Generator' on LCD at current cursor position
 04B                             ;
 04B  00547      disp_Generator: LOAD s5, character_G[47]
 04C  30097                      CALL LCD_write_data[097]
 04D  00565                      LOAD s5, character_e[65]
 04E  30097                      CALL LCD_write_data[097]
 04F  0056E                      LOAD s5, character_n[6E]
 050  30097                      CALL LCD_write_data[097]
 051  00565                      LOAD s5, character_e[65]
 052  30097                      CALL LCD_write_data[097]
 053  00572                      LOAD s5, character_r[72]
 054  30097                      CALL LCD_write_data[097]
 055  00561                      LOAD s5, character_a[61]
 056  30097                      CALL LCD_write_data[097]
 057  00574                      LOAD s5, character_t[74]
 058  30097                      CALL LCD_write_data[097]
 059  0056F                      LOAD s5, character_o[6F]
 05A  30097                      CALL LCD_write_data[097]
 05B  00572                      LOAD s5, character_r[72]
 05C  30097                      CALL LCD_write_data[097]
 05D  30017                      CALL display_space[017]
 05E  00576                      LOAD s5, character_v[76]
 05F  30097                      CALL LCD_write_data[097]
 060  00531                      LOAD s5, character_1[31]
 061  30097                      CALL LCD_write_data[097]
 062  0052E                      LOAD s5, character_stop[2E]
 063  30097                      CALL LCD_write_data[097]
 064  00532                      LOAD s5, character_2[32]
 065  30097                      CALL LCD_write_data[097]
 066  2A000                      RETURN
 067                             ;
 067                             ;
 067                             ;
 067                             ;
 067                             ;**************************************************************************************
 067                             ;Software delay routines
 067                             ;**************************************************************************************
 067                             ;
 067                             ;
 067                             ;
 067                             ;Delay of 1us.
 067                             ;
 067                             ;Constant value defines reflects the clock applied to KCPSM3. Every instruction
 067                             ;executes in 2 clock cycles making the calculation highly predictable. The '6' in
 067                             ;the following equation even allows for 'CALL delay_1us' instruction in the initiating code.
 067                             ;
 067                             ; delay_1us_constant =  (clock_rate - 6)/4       Where 'clock_rate' is in MHz
 067                             ;
 067                             ;Registers used s0
 067                             ;
 067  0000B           delay_1us: LOAD s0, delay_1us_constant[0B]
 068  1C001            wait_1us: SUB s0, 01
 069  35468                      JUMP NZ, wait_1us[068]
 06A  2A000                      RETURN
 06B                             ;
 06B                             ;Delay of 40us.
 06B                             ;
 06B                             ;Registers used s0, s1
 06B                             ;
 06B  00128          delay_40us: LOAD s1, 28                         ;40 x 1us = 40us
 06C  30067           wait_40us: CALL delay_1us[067]
 06D  1C101                      SUB s1, 01
 06E  3546C                      JUMP NZ, wait_40us[06C]
 06F  2A000                      RETURN
 070                             ;
 070                             ;
 070                             ;Delay of 1ms.
 070                             ;
 070                             ;Registers used s0, s1, s2
 070                             ;
 070  00219           delay_1ms: LOAD s2, 19                         ;25 x 40us = 1ms

⌨️ 快捷键说明

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