📄 lcd.log
字号:
KCPSM3 Assembler log file for program 'lcd.psm'.
Generated by KCPSM3 version 1.30
Ken Chapman (Xilinx Ltd) 2005.
18Mar2007-00:56:52
Addr Code
000 ; KCPSM3 Program - Control and calculation for Frequency Generator design using the
000 ; Spartan-3E Starter Kit.
000 ;
000 ; Interfaces with the rotary encoder and LCD display to enable a frequency to be set.
000 ; Converts the BCD frequency value into a binary integer and then performs the high
000 ; precision calculation necessary to derive the control numbers required by the high
000 ; performance Direct Digital Synthesis (DDS) circuit implemented in hardware.
000 ;
000 ; LEDs are connected and used as edit mode indicators.
000 ;
000 ; Substantial comments are included in line with the code below and should be used
000 ; in conjunction with the documentation provided with the complete reference design.
000 ;
000 ;
000 ;
000 ; Ken Chapman - Xilinx Ltd
000 ;
000 ; Version v1.00 - 13th July 2006
000 ;
000 ;**************************************************************************************
000 ;Port definitions
000 ;**************************************************************************************
000 ;
000 ;
000 ;LCD interface ports
000 ;
000 ;The master enable signal is not used by the LCD display itself
000 ;but may be required to confirm that LCD communication is active.
000 ;This is required on the Spartan-3E Starter Kit if the StrataFLASH
000 ;is used because it shares the same data pins and conflicts must be avoided.
000 ;
000 CONSTANT LCD_output_port, 40 ; LCD character module output data and control
000 CONSTANT LCD_E, 01 ; active High Enable E - bit0
000 CONSTANT LCD_RW, 02 ; Read=1 Write=0 RW - bit1
000 CONSTANT LCD_RS, 04 ; Instruction=0 Data=1 RS - bit2
000 ;CONSTANT LCD_drive, 08 ; Master enable (active High) - bit3
000 CONSTANT LCD_DB4, 10 ; 4-bit Data DB4 - bit4
000 CONSTANT LCD_DB5, 20 ; interface Data DB5 - bit5
000 CONSTANT LCD_DB6, 40 ; Data DB6 - bit6
000 CONSTANT LCD_DB7, 80 ; Data DB7 - bit7
000 ;
000 ;
000 CONSTANT LCD_input_port, 01 ; LCD character module input data
000 CONSTANT LCD_read_DB4, 10 ; 4-bit Data DB4 - bit4
000 CONSTANT LCD_read_DB5, 20 ; interface Data DB5 - bit5
000 CONSTANT LCD_read_DB6, 40 ; Data DB6 - bit6
000 CONSTANT LCD_read_DB7, 80 ; Data DB7 - bit7
000 ;
000 ;
000 ;
000 ;Control of frequency selection values
000 ;
000 CONSTANT cursor_position, 10 ; Pointer to edit position on LCD
000 ;
000 ; ************************
000 ;
000 ;Constant to define a software delay of 1us. This must be adjusted to reflect the
000 ;clock applied to KCPSM3. Every instruction executes in 2 clock cycles making the
000 ;calculation highly predictable. The '6' in the following equation even allows for
000 ;'CALL delay_1us' instruction in the initiating code.
000 ;
000 ; delay_1us_constant = (clock_rate - 6)/4 Where 'clock_rate' is in MHz
000 ;
000 ;Example: For a 50MHz clock the constant value is (50-6)/4 = 11 (0B Hex).
000 ;For clock rates below 10MHz the value of 1 must be used and the operation will
000 ;become lower than intended.
000 ;
000 CONSTANT delay_1us_constant, 0B
000 ;
000 ;
000 ;
000 ;ASCII table
000 ;
000 CONSTANT character_a, 61
000 CONSTANT character_b, 62
000 CONSTANT character_c, 63
000 CONSTANT character_d, 64
000 CONSTANT character_e, 65
000 CONSTANT character_f, 66
000 CONSTANT character_g, 67
000 CONSTANT character_h, 68
000 CONSTANT character_i, 69
000 CONSTANT character_j, 6A
000 CONSTANT character_k, 6B
000 CONSTANT character_l, 6C
000 CONSTANT character_m, 6D
000 CONSTANT character_n, 6E
000 CONSTANT character_o, 6F
000 CONSTANT character_p, 70
000 CONSTANT character_q, 71
000 CONSTANT character_r, 72
000 CONSTANT character_s, 73
000 CONSTANT character_t, 74
000 CONSTANT character_u, 75
000 CONSTANT character_v, 76
000 CONSTANT character_w, 77
000 CONSTANT character_x, 78
000 CONSTANT character_y, 79
000 CONSTANT character_z, 7A
000 CONSTANT character_A, 41
000 CONSTANT character_B, 42
000 CONSTANT character_C, 43
000 CONSTANT character_D, 44
000 CONSTANT character_E, 45
000 CONSTANT character_F, 46
000 CONSTANT character_G, 47
000 CONSTANT character_H, 48
000 CONSTANT character_I, 49
000 CONSTANT character_J, 4A
000 CONSTANT character_K, 4B
000 CONSTANT character_L, 4C
000 CONSTANT character_M, 4D
000 CONSTANT character_N, 4E
000 CONSTANT character_O, 4F
000 CONSTANT character_P, 50
000 CONSTANT character_Q, 51
000 CONSTANT character_R, 52
000 CONSTANT character_S, 53
000 CONSTANT character_T, 54
000 CONSTANT character_U, 55
000 CONSTANT character_V, 56
000 CONSTANT character_W, 57
000 CONSTANT character_X, 58
000 CONSTANT character_Y, 59
000 CONSTANT character_Z, 5A
000 CONSTANT character_0, 30
000 CONSTANT character_1, 31
000 CONSTANT character_2, 32
000 CONSTANT character_3, 33
000 CONSTANT character_4, 34
000 CONSTANT character_5, 35
000 CONSTANT character_6, 36
000 CONSTANT character_7, 37
000 CONSTANT character_8, 38
000 CONSTANT character_9, 39
000 CONSTANT character_colon, 3A
000 CONSTANT character_stop, 2E
000 CONSTANT character_semi_colon, 3B
000 CONSTANT character_minus, 2D
000 CONSTANT character_divide, 2F ;'/'
000 CONSTANT character_plus, 2B
000 CONSTANT character_comma, 2C
000 CONSTANT character_less_than, 3C
000 CONSTANT character_greater_than, 3E
000 CONSTANT character_equals, 3D
000 CONSTANT character_space, 20
000 CONSTANT character_CR, 0D ;carriage return
000 CONSTANT character_question, 3F ;'?'
000 CONSTANT character_dollar, 24
000 CONSTANT character_exclaim, 21 ;'!'
000 CONSTANT character_BS, 08 ;Back Space command character
000 ;
000 ;
000 ;
000 ;**************************************************************************************
000 ;Initialise the system
000 ;**************************************************************************************
000 ;
000 300A8 cold_start: CALL LCD_reset[0A8] ;initialise LCD display
001 ;
001 ;Write 'Frequency Generator' to LCD display and display for 4 seconds
001 ;
001 00510 LOAD s5, 10 ;Line 1 position 0
002 300BE CALL LCD_cursor[0BE]
003 30038 CALL disp_Frequency[038]
004 00522 LOAD s5, 22 ;Line 2 position 2
005 300BE CALL LCD_cursor[0BE]
006 3004B CALL disp_Generator[04B]
007 3007A CALL delay_1s[07A] ;wait 4 seconds
008 3007A CALL delay_1s[07A]
009 3007A CALL delay_1s[07A]
00A 3007A CALL delay_1s[07A]
00B 300B9 CALL LCD_clear[0B9] ;clear screen
00C ;
00C ;
00C ;
00C 30070 CALL delay_1ms[070]
00D ;
00D ;**************************************************************************************
00D ; Main program
00D ;**************************************************************************************
00D ;
00D ; The main program is centred on the task of editing the frequency. It waits until the
00D ; rotary control is used and then makes the appropriate changes. If the actual digit
00D ; digit value is changed then the calculation to drive the DDS is performed each time.
00D ;
00D ; The start state is that of allowing the edit cursor position to be moved. Rotary
00D ; inputs are detected by the interrupt service routine and set a flag bit which the
00D ; main program then uses to adjust the cursor position and pointer to the corresponding
00D ; BCD digit in memory.
00D ;
00D ; A press of the rotary control is detected by polling and used to change to the digit
00D ; editing mode.
00D ;
00D ;
00D ;**************************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -