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

📄 ls_test.psm

📁 和picoblaze完全兼容的mcu ip core
💻 PSM
📖 第 1 页 / 共 5 页
字号:
                     COMPARE s0, character_Y                ;test for 'Y' of 'CYCLE' command
                     JUMP NZ, bad_command
                     CALL read_next_char
                     COMPARE s0, character_C                ;test for 'C' of 'CYCLE' command
                     JUMP NZ, bad_command
                     CALL read_next_char
                     COMPARE s0, character_L                ;test for 'L' of 'CYCLE' command
                     JUMP NZ, bad_command
                     CALL read_next_char
                     COMPARE s0, character_E                ;test for 'E' of 'CYCLE' command
                     JUMP NZ, bad_command
                     CALL read_next_char                    ;test for a space
                     COMPARE s0, character_space
                     JUMP NZ, bad_command
                     CALL read_next_char                    ;determine decimal value of 'n' in [s9,s8,s7,s6]
                     COMPARE s0, character_CR
                     JUMP Z, bad_command                    ;need at least 1 digit
                     CALL ASCII_to_decimal                  ;convert to decimal and test
                     JUMP C, bad_command
                     LOAD s6, s0
                     LOAD s7, 00
                     LOAD s8, 00
                     LOAD s9, 00
                     CALL read_next_char
                     COMPARE s0, character_CR
                     JUMP Z, store_n
                     CALL ASCII_to_decimal
                     JUMP C, bad_command
                     LOAD s7, s6
                     LOAD s6, s0
                     CALL read_next_char
                     COMPARE s0, character_CR
                     JUMP Z, store_n
                     CALL ASCII_to_decimal
                     JUMP C, bad_command
                     LOAD s8, s7
                     LOAD s7, s6
                     LOAD s6, s0
                     CALL read_next_char
                     COMPARE s0, character_CR
                     JUMP Z, store_n
                     CALL ASCII_to_decimal
                     JUMP C, bad_command
                     LOAD s9, s8
                     LOAD s8, s7
                     LOAD s7, s6
                     LOAD s6, s0
                     CALL read_next_char
                     COMPARE s0, character_CR
                     JUMP NZ, bad_command                   ;only 4 digits supported so must be a CR next
            store_n: STORE s6, n_count0                     ;store value of 'n'
                     STORE s7, n_count1
                     STORE s8, n_count2
                     STORE s9, n_count3
                     CALL send_CR
             n_loop: FETCH s6, n_count0                     ;Execute cycle command 'n' times
                     FETCH s7, n_count1
                     FETCH s8, n_count2
                     FETCH s9, n_count3
                     SUB s6, 01                             ;decrement counter
                     JUMP NC, update_n
                     LOAD s6, 09
                     SUB s7, 01
                     JUMP NC, update_n
                     LOAD s7, 09
                     SUB s8, 01
                     JUMP NC, update_n
                     LOAD s8, 09
                     SUB s9, 01
                     JUMP NC, update_n
                     JUMP end_cycle                         ;roll under to 9999 signifies end of command
           update_n: STORE s6, n_count0                     ;updated stored value of 'n'
                     STORE s7, n_count1
                     STORE s8, n_count2
                     STORE s9, n_count3
                     FETCH sE, fast_mode                    ;determine display mode
                     COMPARE sE, 00                         ;display active if fast mode is off
                     JUMP Z, step_test
                     LOAD sE, 01                            ;turn display off for fast mode on
                     COMPARE s6, 00                         ;but display last line of cycle command
                     JUMP NZ, step_test
                     COMPARE s7, 00
                     JUMP NZ, step_test
                     COMPARE s8, 00
                     JUMP NZ, step_test
                     COMPARE s9, 00
                     JUMP NZ, step_test
                     LOAD sE, 00
          step_test: CALL step_line_store                   ;execute one test step of the line store
                     JUMP n_loop
          end_cycle: CALL send_index                        ;display index card for data
                     CALL send_OK
                     JUMP warm_start
                     ;
                     ;
                     ;Read next character from scratch pad memory
                     ;
     read_next_char: ADD sE, 01
                     FETCH s0, (sE)                         ;test for space
                     RETURN
                     ;
                     ;
                     ;
                     ;**************************************************************************************
                     ; Line Store step
                     ;**************************************************************************************
                     ;
                     ; Performs one step of the line stores in which the following sequence is followed.
                     ;
                     ; 1) The cycle counter is incremented and then displayed.
                     ; 2) Display the value about to be stored.
                     ; 3) The current output from each line store is read and displayed.
                     ;       This is representative of the value which would be captured on the next rising clock.
                     ; 4) The clock enable to the line stores is activated storing the value held in the
                     ;       line_store_input register.
                     ; 5) Increment the value to be stored next time if function has been turned on.
                     ;
                     ; The display output is suppressed when register 'sE' is not zero.
                     ;
                     ;
    step_line_store: FETCH s9, step_counter4                ;increment step counter
                     FETCH s8, step_counter3
                     FETCH s7, step_counter2
                     FETCH s6, step_counter1
                     FETCH s5, step_counter0
                     ADD s5, 01
                     COMPARE s5, 0A
                     JUMP NZ, store_step_count
                     LOAD s5, 00
                     ADD s6, 01
                     COMPARE s6, 0A
                     JUMP NZ, store_step_count
                     LOAD s6, 00
                     ADD s7, 01
                     COMPARE s7, 0A
                     JUMP NZ, store_step_count
                     LOAD s7, 00
                     ADD s8, 01
                     COMPARE s8, 0A
                     JUMP NZ, store_step_count
                     LOAD s8, 00
                     ADD s9, 01
                     COMPARE s9, 0A
                     JUMP NZ, store_step_count
                     LOAD s9, 00
   store_step_count: STORE s9, step_counter4
                     STORE s8, step_counter3
                     STORE s7, step_counter2
                     STORE s6, step_counter1
                     STORE s5, step_counter0
                     COMPARE sE, 00                         ;suppress display
                     JUMP NZ, skip_display
                     LOAD UART_data, s9                     ;display step counter
                     ADD UART_data, 30
                     CALL send_to_UART
                     LOAD UART_data, s8
                     ADD UART_data, 30
                     CALL send_to_UART
                     LOAD UART_data, s7
                     ADD UART_data, 30
                     CALL send_to_UART
                     LOAD UART_data, s6
                     ADD UART_data, 30
                     CALL send_to_UART
                     LOAD UART_data, s5
                     ADD UART_data, 30
                     CALL send_to_UART
                     CALL send_space
                     CALL send_space
                     CALL send_space
                     FETCH sA, test_data_in0                ;Read set value into [sC,sB,sA]
                     FETCH sB, test_data_in1
                     FETCH sC, test_data_in2
                     FETCH s0, auto_inc
                     LOAD s0, sC                            ;display value being input to line store
                     CALL send_hex_byte
                     LOAD s0, sB
                     CALL send_hex_byte
                     LOAD s0, sA
                     CALL send_hex_byte
                     CALL send_space
                     CALL send_space
                     INPUT s0, line_store1_output_H         ;read 24-bit line store 1 output and display
                     CALL send_hex_byte
                     INPUT s0, line_store1_output_M
                     CALL send_hex_byte
                     INPUT s0, line_store1_output_L
                     CALL send_hex_byte
                     CALL send_space
                     CALL send_space
                     INPUT s0, line_store2_output_H         ;read 18-bit line store 2 output and display
                     CALL send_nibble
                     INPUT s0, line_store2_output_M
                     CALL send_hex_byte
                     INPUT s0, line_store2_output_L
                     CALL send_hex_byte
                     CALL send_space
                     CALL send_space
                     INPUT s0, line_store3_output_H         ;read 13-bit line store 3 output and display
                     CALL send_hex_byte
                     INPUT s0, line_store3_output_L
                     CALL send_hex_byte
                     CALL send_space
                     CALL send_space
                     INPUT s0, line_store4a_output_H        ;read 24-bit line store 4 output 'A' and display
                     CALL send_hex_byte
                     INPUT s0, line_store4a_output_M
                     CALL send_hex_byte
                     INPUT s0, line_store4a_output_L
                     CALL send_hex_byte
                     CALL send_space
                     INPUT s0, line_store4b_output_H        ;read 24-bit line store 4 output 'B' and display
                     CALL send_hex_byte
                     INPUT s0, line_store4b_output_M
                     CALL send_hex_byte
                     INPUT s0, line_store4b_output_L
                     CALL send_hex_byte
                     CALL send_space
                     INPUT s0, line_store4c_output_H        ;read 24-bit line store 4 output 'C' and display
                     CALL send_hex_byte
                     INPUT s0, line_store4c_output_M
                     CALL send_hex_byte
                     INPUT s0, line_store4c_output_L
                     CALL send_hex_byte
                     CALL send_space
                     CALL send_space
                     INPUT s0, line_store5_output_H         ;read 12-bit line store 5 output and display
                     CALL send_nibble
                     INPUT s0, line_store5_output_L
                     CALL send_hex_byte
                     CALL send_space
                     CALL send_space
                     INPUT s0, line_store6_output_H         ;read 9-bit line store 6 output and display
                     CALL send_nibble
                     INPUT s0, line_store6_output_L
                     CALL send_hex_byte
                     CALL send_space
                     CALL send_space
                     INPUT s0, line_store7a_output_H        ;read 24-bit line store 7 output 'A' and display
                     CALL send_hex_byte
                     INPUT s0, line_store7a_output_M
                     CALL send_hex_byte
                     INPUT s0, line_store7a_output_L
                     CALL send_hex_byte
                     CALL send_space
                     INPUT s0, line_store7b_output_H        ;read 24-bit line store 7 output 'B' and display

⌨️ 快捷键说明

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