📄 clock.rmh
字号:
// #34: CONSTANT(LCD_RW,2) ; Read=1 Write=0 RW - bit1// #35: CONSTANT(LCD_RS,4) ; Instruction=0 Data=1 RS - bit2// #36: CONSTANT(LCD_drive,8) ; Master enable (active High) - bit3// #37: CONSTANT(LCD_DB4,16) ; 4-bit Data DB4 - bit4// #38: CONSTANT(LCD_DB5,32) ; interface Data DB5 - bit5// #39: CONSTANT(LCD_DB6,64) ; Data DB6 - bit6// #40: CONSTANT(LCD_DB7,128) ; Data DB7 - bit7// #41: ;// #42: CONSTANT(LCD_input_port,2) ;LCD character module input data// #43: CONSTANT(LCD_read_spare0,1) ; Spare bits - bit0// #44: CONSTANT(LCD_read_spare1,2) ; are zero - bit1// #45: CONSTANT(LCD_read_spare2,4) ; - bit2// #46: CONSTANT(LCD_read_spare3,8) ; - bit3// #47: CONSTANT(LCD_read_DB4,16) ; 4-bit Data DB4 - bit4// #48: CONSTANT(LCD_read_DB5,32) ; interface Data DB5 - bit5// #49: CONSTANT(LCD_read_DB6,64) ; Data DB6 - bit6// #50: CONSTANT(LCD_read_DB7,128) ; Data DB7 - bit7// #51: CONSTANT(BIT7,128) ;// #52: CONSTANT(BIT6,64) ;// #53: CONSTANT(BIT5,32) ;// #54: CONSTANT(BIT4,16) ;// #55: CONSTANT(BIT3,8) ;// #56: CONSTANT(BIT2,4) ;// #57: CONSTANT(BIT1,2) ;// #58: CONSTANT(BIT0,1) ;// #59: ;// #60: ;**************************************************************************************// #61: ;Scratch Pad Memory Locations// #62: ;**************************************************************************************// #63: ;// #64: CONSTANT(rotary_status,0) ;Status of rotary encoder// #65: CONSTANT(ISR_s0,1) ;Preserve s0 contents during ISR// #66: CONSTANT(LED_pattern,2) ;LED pattern used in rotation mode// #67: ;// #68: CONSTANT(mode,3) ;control mode 00=switch and button FF=rotary// #69: CONSTANT(ms1,4)// #70: CONSTANT(secL,5)// #71: CONSTANT(secH,6)// #72: CONSTANT(minL,7)// #73: CONSTANT(minH,8)// #74: CONSTANT(hourL,9)// #75: CONSTANT(hourH,10)// #76: CONSTANT(week,11)// #77: CONSTANT(year1,12)// #78: CONSTANT(year2,13)// #79: CONSTANT(year3,14)// #80: CONSTANT(year4,15)// #81: CONSTANT(ms2,16)// #82: CONSTANT(ms500,17)// #83: CONSTANT(ISR_s1,18)// #84: CONSTANT(ms100,19)// #85: CONSTANT(ROTA_CNT,20)// #86: CONSTANT(ISR_s2,21)// #87: CONSTANT(temp,22)// #88: CONSTANT(pressed,23)// #89: CONSTANT(disp_flag,24)// #90: CONSTANT(blink_flag,25)// #91: CONSTANT(disp_flag2,26) ;;;;;no use// #92: CONSTANT(monH,27)// #93: CONSTANT(monL,28)// #94: CONSTANT(dayH,29)// #95: CONSTANT(dayL,30)// #96: CONSTANT(DAY_UP,31)// #97: CONSTANT(year100,32)// #98: CONSTANT(hourB,33)// #99: CONSTANT(minB,34)// #100: CONSTANT(secB,35)// #101: CONSTANT(yearB,36)// #102: CONSTANT(monB,37)// #103: CONSTANT(dayB,38)// #104: CONSTANT(DMAX,39) ;// #105: CONSTANT(JAN,40) ;// #106: CONSTANT(FEB,41) ;// #107: CONSTANT(MAR,42) ;// #108: CONSTANT(APR,43) ;// #109: CONSTANT(MAY,44) ;// #110: CONSTANT(JUN,45) ;// #111: CONSTANT(JUL,46) ;// #112: CONSTANT(AUG,47) ;// #113: CONSTANT(SEP,48) ;// #114: CONSTANT(OCT,49) ;// #115: CONSTANT(NOV,50) ;// #116: CONSTANT(DEC,51) ;// #117: CONSTANT(JAN2,52) ;// #118: CONSTANT(FEB2,53) ;// #119: CONSTANT(MAR2,54) ;// #120: CONSTANT(APR2,55) ;// #121: CONSTANT(MAY2,56) ;// #122: CONSTANT(JUN2,57) ;// #123: CONSTANT(JUL2,58) ;// #124: CONSTANT(AUG2,59) ;// #125: CONSTANT(SEP2,60) ;// #126: CONSTANT(OCT2,61) ;// #127: CONSTANT(NOV2,62) ;// #128: CONSTANT(DEC2,63) ;// #129: ;The main operation of the program uses 1ms delays to set the shift rate// #130: ;of the LCD display. A 16-bit value determines how many milliseconds// #131: ;there are between shifts// #132: ;// #133: ;Tests indicate that the fastest shift rate that the LCD display supports is// #134: ;500ms. Faster than this and the display becomes less clear to read.// #135: ;// #136: CONSTANT(shift_delay_msb,1) ;delay is 500ms (01F4 hex)// #137: CONSTANT(shift_delay_lsb,F4)// #138: ;// #139: ; delay_1us_constant = (clock_rate - 6)/4 Where 'clock_rate' is in MHz// #140: ;// #141: ;Example: For a 50MHz clock the constant value is (10-6)/4 = 11 (0B Hex).// #142: ;For clock rates below 10MHz the value of 1 must be used and the operation will// #143: ;become lower than intended.// #144: ;// #145: CONSTANT(delay_1us_constant,11)// #146: ;ASCII table// #147: ;// #148: CONSTANT(character_a,97)// #149: CONSTANT(character_b,98)// #150: CONSTANT(character_c,99)// #151: CONSTANT(character_d,100)// #152: CONSTANT(character_e,101)// #153: CONSTANT(character_f,102)// #154: CONSTANT(character_g,103)// #155: CONSTANT(character_h,104)// #156: CONSTANT(character_i,105)// #157: CONSTANT(character_j,106)// #158: CONSTANT(character_k,107)// #159: CONSTANT(character_l,108)// #160: CONSTANT(character_m,109)// #161: CONSTANT(character_n,110)// #162: CONSTANT(character_o,111)// #163: CONSTANT(character_p,112)// #164: CONSTANT(character_q,113)// #165: CONSTANT(character_r,114)// #166: CONSTANT(character_s,115)// #167: CONSTANT(character_t,116)// #168: CONSTANT(character_u,117)// #169: CONSTANT(character_v,118)// #170: CONSTANT(character_w,119)// #171: CONSTANT(character_x,120)// #172: CONSTANT(character_y,121)// #173: CONSTANT(character_z,122)// #174: CONSTANT(character_A,65)// #175: CONSTANT(character_B,66)// #176: CONSTANT(character_C,67)// #177: CONSTANT(character_D,68)// #178: CONSTANT(character_E,69)// #179: CONSTANT(character_F,70)// #180: CONSTANT(character_G,71)// #181: CONSTANT(character_H,72)// #182: CONSTANT(character_I,73)// #183: CONSTANT(character_J,74)// #184: CONSTANT(character_K,75)// #185: CONSTANT(character_L,76)// #186: CONSTANT(character_M,77)// #187: CONSTANT(character_N,78)// #188: CONSTANT(character_O,79)// #189: CONSTANT(character_P,80)// #190: CONSTANT(character_Q,81)// #191: CONSTANT(character_R,82)// #192: CONSTANT(character_S,83)// #193: CONSTANT(character_T,84)// #194: CONSTANT(character_U,85)// #195: CONSTANT(character_V,86)// #196: CONSTANT(character_W,87)// #197: CONSTANT(character_X,88)// #198: CONSTANT(character_Y,89)// #199: CONSTANT(character_Z,90)// #200: CONSTANT(character_0,48)// #201: CONSTANT(character_1,49)// #202: CONSTANT(character_2,50)// #203: CONSTANT(character_3,51)// #204: CONSTANT(character_4,52)// #205: CONSTANT(character_5,53)// #206: CONSTANT(character_6,54)// #207: CONSTANT(character_7,55)// #208: CONSTANT(character_8,56)// #209: CONSTANT(character_9,57)// #210: CONSTANT(character_colon,58)// #211: CONSTANT(character_stop,46)// #212: CONSTANT(character_semi_colon,59)// #213: CONSTANT(character_minus,45)// #214: CONSTANT(character_divide,47) ;'/'// #215: CONSTANT(character_plus,43)// #216: CONSTANT(character_comma,44)// #217: CONSTANT(character_less_than,60)// #218: CONSTANT(character_greater_than,62)// #219: CONSTANT(character_equals,61)// #220: CONSTANT(character_space,32)// #221: CONSTANT(character_CR,13) ;carriage return// #222: CONSTANT(character_question,63) ;'?'// #223: CONSTANT(character_dollar,36)// #224: CONSTANT(character_exclaim,33) ;'!'// #225: CONSTANT(character_BS,8) ;Back Space command character// #226: ;// @000 #227: [reset]302e5 // @000 #227: CALL(LCD_reset)3c001 // @001 #228: ENABLE(INTERRUPT)00dff // @002 #229: LOAD(sD,FF)00000 // @003 #230: LOAD(s0,0) ;2e00a // @004 #231: STORE(s0,hourH)2e007 // @005 #232: STORE(s0,minL)2e008 // @006 #233: STORE(s0,minH)2e006 // @007 #234: STORE(s0,secH)2e005 // @008 #235: STORE(s0,secL)2e00d // @009 #236: STORE(s0,year2)2e00e // @00a #237: STORE(s0,year3)2e01b // @00b #238: STORE(s0,monH)2e022 // @00c #239: STORE(s0,minB) ;;;;;;;;;;2e023 // @00d #240: STORE(s0,secB) ;;;;;;;;;;00009 // @00e #241: LOAD(s0,9) ;2e009 // @00f #242: STORE(s0,hourL)2e021 // @010 #243: STORE(s0,hourB) ;;;;;;;;;00002 // @011 #244: LOAD(s0,2) ;2e00c // @012 #245: STORE(s0,year1)2e01d // @013 #246: STORE(s0,dayH)00006 // @014 #247: LOAD(s0,6) ;2e01e // @015 #248: STORE(s0,dayL)2e00f // @016 #249: STORE(s0,year4)2e024 // @017 #250: STORE(s0,yearB) ;;;;;;;;;00005 // @018 #251: LOAD(s0,5) ;2e01c // @019 #252: STORE(s0,monL)2e00b // @01a #253: STORE(s0,week)2e025 // @01b #254: STORE(s0,monB) ;;;;;;;;;0001a // @01c #255: LOAD(s0,26)2e026 // @01d #256: STORE(s0,dayB) ;;;;;;;;;0001f // @01e #257: LOAD(s0,31)2e028 // @01f #258: STORE(s0,JAN) ;12e02a // @020 #259: STORE(s0,MAR) ;32e02c // @021 #260: STORE(s0,MAY) ;52e02e // @022 #261: STORE(s0,JUL) ;72e02f // @023 #262: STORE(s0,AUG) ;82e031 // @024 #263: STORE(s0,OCT) ;102e033 // @025 #264: STORE(s0,DEC) ;120001e // @026 #265: LOAD(s0,30)2e02b // @027 #266: STORE(s0,APR) ;42e02d // @028 #267: STORE(s0,JUN) ;62e030 // @029 #268: STORE(s0,SEP) ;92e032 // @02a #269: STORE(s0,NOV) ;110001c // @02b #270: LOAD(s0,28)2e029 // @02c #271: STORE(s0,FEB) ;200003 // @02d #272: LOAD(s0,3)2e034 // @02e #273: STORE(s0,JAN2)2e03d // @02f #274: STORE(s0,OCT2)00006 // @030 #275: LOAD(s0,6)2e035 // @031 #276: STORE(s0,FEB2)2e036 // @032 #277: STORE(s0,MAR2)2e03e // @033 #278: STORE(s0,NOV2)00002 // @034 #279: LOAD(s0,2)2e037 // @035 #280: STORE(s0,APR2)2e03a // @036 #281: STORE(s0,JUL2)00004 // @037 #282: LOAD(s0,4)2e038 // @038 #283: STORE(s0,MAY2)00000 // @039 #284: LOAD(s0,0)2e039 // @03a #285: STORE(s0,JUN2)00005 // @03b #286: LOAD(s0,5)2e03b // @03c #287: STORE(s0,AUG2)00001 // @03d #288: LOAD(s0,1)2e03c // @03e #289: STORE(s0,SEP2)2e03f // @03f #290: STORE(s0,DEC2)00f00 // @040 #291: LOAD(sF,0) ;// @041 #292: [restart]00510 // @041 #293: LOAD(s5,16)30313 // @042 #294: CALL(LCD_cursor)301d9 // @043 #295: CALL(disp_msg1)00520 // @044 #296: LOAD(s5,32)30313 // @045 #297: CALL(LCD_cursor)301f4 // @046 #298: CALL(disp_msg2)00335 // @047 #299: LOAD(s3,53)2e316 // @048 #300: STORE(s3,temp)// @049 #301: [BLINK10]00300 // @049 #301: LOAD(s3,0)2e313 // @04a #302: STORE(s3,ms100)// @04b #303: [BLINK1]06313 // @04b #303: FETCH(s3,ms100)14305 // @04c #304: COMPARE(s3,5)3584b // @04d #305: JUMP(C,BLINK1)0052f // @04e #306: LOAD(s5,47)30313 // @04f #307: CALL(LCD_cursor)06516 // @050 #308: FETCH(s5,temp)302d4 // @051 #309: CALL(LCD_write_data)00300 // @052 #310: LOAD(s3,0)2e313 // @053 #311: STORE(s3,ms100)// @054 #312: [wait1]06313 // @054 #312: FETCH(s3,ms100)14305 // @055 #313: COMPARE(s3,5)35854 // @056 #314: JUMP(C,wait1)0052f // @057 #315: LOAD(s5,47)30313 // @058 #316: CALL(LCD_cursor)00520 // @059 #317: LOAD(s5,32)302d4 // @05a #318: CALL(LCD_write_data)06516 // @05b #319: FETCH(s5,temp)185ff // @05c #320: ADD(s5,FF)2e516 // @05d #321: STORE(s5,temp)1452f // @05e #322: COMPARE(s5,47)35449 // @05f #323: JUMP(NZ,BLINK10)// @060 #324: [RRESTART]00510 // @060 #324: LOAD(s5,16)30313 // @061 #325: CALL(LCD_cursor)30213 // @062 #326: CALL(disp_msg3)00520 // @063 #327: LOAD(s5,32)30313 // @064 #328: CALL(LCD_cursor)3022a // @065 #329: CALL(disp_msg4)00335 // @066 #330: LOAD(s3,53)2e316 // @067 #331: STORE(s3,temp)// @068 #332: [BLINK20]00300 // @068 #332: LOAD(s3,0)2e313 // @069 #333: STORE(s3,ms100)// @06a #334: [BLINK2]06313 // @06a #334: FETCH(s3,ms100)14305 // @06b #335: COMPARE(s3,5)3586a // @06c #336: JUMP(C,BLINK2)0052f // @06d #337: LOAD(s5,47)30313 // @06e #338: CALL(LCD_cursor)06516 // @06f #339: FETCH(s5,temp)302d4 // @070 #340: CALL(LCD_write_data)00300 // @071 #341: LOAD(s3,0)2e313 // @072 #342: STORE(s3,ms100)// @073 #343: [wait2]06313 // @073 #343: FETCH(s3,ms100)14305 // @074 #344: COMPARE(s3,5)35873 // @075 #345: JUMP(C,wait2)0052f // @076 #346: LOAD(s5,47)30313 // @077 #347: CALL(LCD_cursor)00520 // @078 #348: LOAD(s5,32)302d4 // @079 #349: CALL(LCD_write_data)06516 // @07a #350: FETCH(s5,temp)185ff // @07b #351: ADD(s5,FF)2e516 // @07c #352: STORE(s5,temp)1452f // @07d #353: COMPARE(s5,47)35468 // @07e #354: JUMP(NZ,BLINK20)00000 // @07f #355: LOAD(s0,0)2e002 // @080 #356: STORE(s0,LED_pattern)2e003 // @081 #357: STORE(s0,mode)2e019 // @082 #358: STORE(s0,blink_flag)2e013 // @083 #359: STORE(s0,ms100)00510 // @084 #360: LOAD(s5,16)30313 // @085 #361: CALL(LCD_cursor)30247 // @086 #362: CALL(disp_msg5)00520 // @087 #363: LOAD(s5,32)30313 // @088 #364: CALL(LCD_cursor)30265 // @089 #365: CALL(disp_msg6)// @08a #366: [PAUSE]06013 // @08a #366: FETCH(s0,ms100)14032 // @08b #367: COMPARE(s0,50)3588a // @08c #368: JUMP(C,PAUSE)302f6 // @08d #369: CALL(LCD_clear)04000 // @08e #370: INPUT(s0,0)2e01a // @08f #371: STORE(s0,disp_flag2)2e013 // @090 #372: STORE(s0,ms100)// @091 #373: [loop]06021 // @091 #374: FETCH(s0,hourB)301d2 // @092 #375: CALL(B2BCD)2e009 // @093 #376: STORE(s0,hourL)2e10a // @094 #377: STORE(s1,hourH)06022 // @095 #378: FETCH(s0,minB)301d2 // @096 #379: CALL(B2BCD)2e007 // @097 #380: STORE(s0,minL)2e108 // @098 #381: STORE(s1,minH)06023 // @099 #382: FETCH(s0,secB)301d2 // @09a #383: CALL(B2BCD)2e005 // @09b #384: STORE(s0,secL)2e106 // @09c #385: STORE(s1,secH)06026 // @09d #386: FETCH(s0,dayB)301d2 // @09e #387: CALL(B2BCD)2e01e // @09f #388: STORE(s0,dayL)2e11d // @0a0 #389: STORE(s1,dayH)06025 // @0a1 #390: FETCH(s0,monB)301d2 // @0a2 #391: CALL(B2BCD)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -