uclock.rmh

来自「和picoblaze完全兼容的mcu ip core」· RMH 代码 · 共 1,263 行 · 第 1/4 页

RMH
1,263
字号
/* Symbol Table */// BS_edit = LABEL: 211// ISR = LABEL: 1020// UART_data = REGISTER: 15// UART_read_port = CONSTANT: 1// UART_status_port = CONSTANT: 0// UART_write = LABEL: 162// UART_write_port = CONSTANT: 1// _1char_to_value = LABEL: 488// _2char_to_value = LABEL: 492// alarm_active = CONSTANT: 1// alarm_armed = CONSTANT: 2// alarm_control = CONSTANT: 1// alarm_drive = LABEL: 164// alarm_is_off = LABEL: 186// alarm_port = CONSTANT: 0// alarm_status = CONSTANT: 12// alarm_time_hours = CONSTANT: 9// alarm_time_minutes = CONSTANT: 10// alarm_time_seconds = CONSTANT: 11// bad_input_command = LABEL: 28// character_0 = CONSTANT: 48// character_1 = CONSTANT: 49// character_2 = CONSTANT: 50// character_3 = CONSTANT: 51// character_4 = CONSTANT: 52// character_5 = CONSTANT: 53// character_6 = CONSTANT: 54// character_7 = CONSTANT: 55// character_8 = CONSTANT: 56// character_9 = CONSTANT: 57// character_A = CONSTANT: 65// character_B = CONSTANT: 66// character_BS = CONSTANT: 8// character_C = CONSTANT: 67// character_CR = CONSTANT: 13// character_D = CONSTANT: 68// character_E = CONSTANT: 69// character_F = CONSTANT: 70// character_G = CONSTANT: 71// character_H = CONSTANT: 72// character_I = CONSTANT: 73// character_J = CONSTANT: 74// character_K = CONSTANT: 75// character_L = CONSTANT: 76// character_M = CONSTANT: 77// character_N = CONSTANT: 78// character_O = CONSTANT: 79// character_P = CONSTANT: 80// character_Q = CONSTANT: 81// character_R = CONSTANT: 82// character_S = CONSTANT: 83// character_T = CONSTANT: 84// character_U = CONSTANT: 85// character_V = CONSTANT: 86// character_W = CONSTANT: 87// character_X = CONSTANT: 88// character_Y = CONSTANT: 89// character_Z = CONSTANT: 90// character_a = CONSTANT: 97// character_b = CONSTANT: 98// character_c = CONSTANT: 99// character_colon = CONSTANT: 58// character_d = CONSTANT: 100// character_dollar = CONSTANT: 36// character_e = CONSTANT: 101// character_equals = CONSTANT: 61// character_f = CONSTANT: 102// character_g = CONSTANT: 103// character_greater_than = CONSTANT: 62// character_h = CONSTANT: 104// character_i = CONSTANT: 105// character_j = CONSTANT: 106// character_k = CONSTANT: 107// character_l = CONSTANT: 108// character_less_than = CONSTANT: 60// character_m = CONSTANT: 109// character_n = CONSTANT: 110// character_o = CONSTANT: 111// character_p = CONSTANT: 112// character_q = CONSTANT: 113// character_question = CONSTANT: 63// character_r = CONSTANT: 114// character_s = CONSTANT: 115// character_semi_colon = CONSTANT: 59// character_space = CONSTANT: 32// character_t = CONSTANT: 116// character_u = CONSTANT: 117// character_v = CONSTANT: 118// character_w = CONSTANT: 119// character_x = CONSTANT: 120// character_y = CONSTANT: 121// character_z = CONSTANT: 122// clear_UART_Rx_loop = LABEL: 223// cold_start = LABEL: 0// count_1000_lsb = CONSTANT: 232// count_1000_msb = CONSTANT: 3// decimal_to_ASCII = LABEL: 382// fetch_char_from_memory = LABEL: 145// finish_update = LABEL: 475// hours_in_a_day = CONSTANT: 24// inc_hours = LABEL: 447// inc_minutes = LABEL: 439// int_counter_lsb = REGISTER: 13// int_counter_msb = REGISTER: 12// invalid_time = LABEL: 139// minutes_in_an_hour = CONSTANT: 60// ms_time_lsb = CONSTANT: 4// ms_time_msb = CONSTANT: 5// next_char_tx = LABEL: 189// prompt_input = LABEL: 18// read_character = LABEL: 154// read_error = LABEL: 219// read_from_UART = LABEL: 149// real_time_hours = CONSTANT: 6// real_time_minutes = CONSTANT: 7// real_time_seconds = CONSTANT: 8// receive_full_test = LABEL: 198// receive_string = LABEL: 195// reset_hours = LABEL: 455// restore_ms_time = LABEL: 429// rx_data_present = CONSTANT: 16// rx_full = CONSTANT: 8// rx_half_full = CONSTANT: 4// s0 = REGISTER: 0// s1 = REGISTER: 1// s2 = REGISTER: 2// s3 = REGISTER: 3// s4 = REGISTER: 4// s5 = REGISTER: 5// s6 = REGISTER: 6// s7 = REGISTER: 7// s8 = REGISTER: 8// s9 = REGISTER: 9// sA = REGISTER: 10// sB = REGISTER: 11// sC = REGISTER: 12// sD = REGISTER: 13// sE = REGISTER: 14// sF = REGISTER: 15// seconds_in_a_minute = CONSTANT: 60// send_Active = LABEL: 339// send_Alarm = LABEL: 317// send_CR = LABEL: 228// send_Error = LABEL: 267// send_Invalid = LABEL: 293// send_OFF = LABEL: 328// send_ON = LABEL: 334// send_Overflow_Error = LABEL: 250// send_Syntax_Error = LABEL: 237// send_Time = LABEL: 308// send_backspace = LABEL: 234// send_greater_than = LABEL: 290// send_prompt = LABEL: 277// send_space = LABEL: 231// send_space_Error = LABEL: 266// send_to_UART = LABEL: 157// set_alarm_command = LABEL: 72// set_alarm_on_off = LABEL: 85// set_time_command = LABEL: 44// store_ms_time = LABEL: 431// store_pointer = REGISTER: 14// store_us_time = LABEL: 415// string_start = CONSTANT: 32// string_start_again = LABEL: 217// test_1000us = LABEL: 410// test_OFF = LABEL: 96// test_armed = LABEL: 182// test_for_ALARM = LABEL: 55// test_for_TIME = LABEL: 30// test_for_ten = LABEL: 383// test_time_string = LABEL: 109// time_preserve0 = CONSTANT: 16// time_preserve1 = CONSTANT: 17// time_preserve2 = CONSTANT: 18// time_preserve3 = CONSTANT: 19// time_preserve4 = CONSTANT: 20// time_preserve5 = CONSTANT: 21// time_to_ASCII = LABEL: 352// time_update_complete = LABEL: 457// transmit_alarm_time = LABEL: 172// transmit_string = LABEL: 188// transmit_time = LABEL: 168// tx_full = CONSTANT: 2// tx_half_full = CONSTANT: 1// update_time = LABEL: 389// upper_case = LABEL: 482// us_time_lsb = CONSTANT: 2// us_time_msb = CONSTANT: 3// us_time_stamp_lsb = CONSTANT: 0// us_time_stamp_msb = CONSTANT: 1/* Program Code */// #1: ;KCPSM3 Program - Real Time Clock with UART communication.// #2: ;// #3: ;Ken Chapman - Xilinx Ltd - October 2003// #4: ;// #5: ;// #6: ;Port definitions// #7: ;// #8: constant(UART_status_port,0) ;UART status input// #9: constant(tx_half_full,1) ;  Transmitter     half full - bit0// #10: constant(tx_full,2) ;    FIFO               full - bit1// #11: constant(rx_half_full,4) ;  Receiver        half full - bit2// #12: constant(rx_full,8) ;    FIFO               full - bit3// #13: constant(rx_data_present,16) ;               data present - bit4// #14: ;// #15: constant(UART_read_port,1) ;UART Rx data input// #16: ;// #17: constant(UART_write_port,1) ;UART Tx data output// #18: ;// #19: constant(alarm_port,0) ;Alarm output// #20: constant(alarm_control,1) ;     bit0// #21: ;// #22: ;Special Register usage// #23: ;// #24: register(UART_data,15) ;used to pass data to and from the UART// #25: ;// #26: register(store_pointer,14) ;used to pass location of data in scratch pad memory// #27: ;// #28: ;Two registers to form a 16-bit counter used to count// #29: ;interrupt pulses generated at 1us intervals.// #30: ;// #31: register(int_counter_lsb,13) ;lower 8-bits// #32: register(int_counter_msb,12) ;upper 8-bits// #33: ;// #34: ;// #35: ;Scratch Pad Memory Locations// #36: ;// #37: ;// #38: constant(us_time_stamp_lsb,0) ;16-bit micro-second time stamp// #39: constant(us_time_stamp_msb,1)// #40: ;// #41: constant(us_time_lsb,2) ;16-bit micro-second real time value// #42: constant(us_time_msb,3)// #43: ;// #44: constant(ms_time_lsb,4) ;16-bit milli-second real time value// #45: constant(ms_time_msb,5)// #46: ;// #47: constant(real_time_hours,6) ;Current clock time// #48: constant(real_time_minutes,7)// #49: constant(real_time_seconds,8)// #50: ;// #51: constant(alarm_time_hours,9) ;Alarm time// #52: constant(alarm_time_minutes,10)// #53: constant(alarm_time_seconds,11)// #54: ;// #55: constant(alarm_status,12) ;Alarm status// #56: constant(alarm_active,1) ;    bit0 - Alarm is active// #57: constant(alarm_armed,2) ;    bit1 - Alarm is armed// #58: ;// #59: constant(time_preserve0,16) ;storage for protection of registers// #60: constant(time_preserve1,17) ;used by the real time clock routine.// #61: constant(time_preserve2,18)// #62: constant(time_preserve3,19)// #63: constant(time_preserve4,20)// #64: constant(time_preserve5,21)// #65: ;// #66: ;UART character strings will be stored in scratch pad memory ending in carriage return.// #67: ;A string can be up to 16 characters with the start location defined by this constant.// #68: ;// #69: constant(string_start,32)// #70: ;// #71: ;// #72: ;Initialise the system// #73: ;// #74: ;// @000 #75: [cold_start]00000 // @000 #75: load(s0,0) ;clear all time values2e000 // @001 #76: store(s0,us_time_stamp_lsb)2e001 // @002 #77: store(s0,us_time_stamp_msb)2e002 // @003 #78: store(s0,us_time_lsb)2e003 // @004 #79: store(s0,us_time_msb)2e004 // @005 #80: store(s0,ms_time_lsb)2e005 // @006 #81: store(s0,ms_time_msb)2e006 // @007 #82: store(s0,real_time_hours)2e007 // @008 #83: store(s0,real_time_minutes)2e008 // @009 #84: store(s0,real_time_seconds)2e009 // @00a #85: store(s0,alarm_time_hours)2e00a // @00b #86: store(s0,alarm_time_minutes)2e00b // @00c #87: store(s0,alarm_time_seconds)2e00c // @00d #88: store(s0,alarm_status) ;clear and disable alarm300a4 // @00e #89: call(alarm_drive) ;turn off alarm control output port00d00 // @00f #90: load(int_counter_lsb,0) ;clear 'us' interrupt counter00c00 // @010 #91: load(int_counter_msb,0)3c001 // @011 #92: interrupt(enable) ;enable the 1us interrupts// #93: ;// #94: ;// #95: ;Start of the main program loop.// #96: ;// #97: ;A prompt is transmitted to the UART transmitter and then// #98: ;a command can be entered and interpreted.// #99: ;// #100: ;// @012 #101: [prompt_input]30115 // @012 #101: call(send_prompt) ;Prompt 'KCPSM3>'300c3 // @013 #102: call(receive_string) ;obtain input string and maintain the time// #103: ;// #104: ;// #105: ;Parse the string and perform actions as required// #106: ;// #107: ;// #108: ;00120 // @014 #109: load(s1,string_start)30091 // @015 #110: call(fetch_char_from_memory)1400d // @016 #111: compare(s0,character_CR) ;carriage return does nothing35012 // @017 #112: jump(z,prompt_input)14054 // @018 #113: compare(s0,character_T) ;start of 'TIME' command?3501e // @019 #114: jump(z,test_for_TIME)14041 // @01a #115: compare(s0,character_A) ;start of 'ALARM' command?35037 // @01b #116: jump(z,test_for_ALARM)// #117: ;// #118: ;trap other command starts here// #119: ;// @01c #120: [bad_input_command]300ed // @01c #120: call(send_Syntax_Error) ;no valid command

⌨️ 快捷键说明

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