MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 1 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00001 ; NWRF Nixie Clock program for 2 B5870 tubes and PIC16F722 00002 ; 00003 ; Copyright (C) 2005,2010 David Forbes 00004 ; 00005 ; This program is free software; you can redistribute it and/or modify 00006 ; it under the terms of the GNU General Public License as published by 00007 ; the Free Software Foundation; either version 2 of the License, or 00008 ; (at your option) any later version. 00009 ; 00010 ; This program is distributed in the hope that it will be useful, 00011 ; but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 ; GNU General Public License for more details. 00014 ; 00015 ;------------------------------------------------------------- 00016 ; Revision history 00017 ; 00018 ; 01/05/10 DF Making NWRF version from NWRD version 00019 ; 01/06/10 DF Added ANSELA and ANSELB to make buttons work 00020 ; Inverted sense of X and Y accelerometer data 00021 ; 02/15/10 DF Made tilt setting routine read tilt twice 00022 ; 00023 ;------------------------------------------------------------- 00024 ; Theory of Operation 00025 ; 00026 ; This clock has two display tubes and uses them to show 00027 ; first hours, then minutes when the tilt sensor says to. 00028 ; 00029 ; The processor runs at the stately speed of 8192 instructions per second. 00030 ; This has had a big influence on the code structure, as there are no 00031 ; spare cycles to waste. Every NOP is visible in the display. 00032 ; 00033 ; The tilt sensor is a 3-axis accelerometer ADXL335. We use Y and Z, not X. 00034 ; A/D converter is two channels with A3 used as power out to tilt sensor. 00035 ; Vref is taken from A3 since the ADXL335 is Vcc-referenced. 00036 ; 00037 ; The tilt sensing algorithm works by looking for both X and Y g factors 00038 ; of approximately 0.65g in the desired direction of upwards and toward 00039 ; the user. 00040 ; To prevent false triggering, an additional constraint is Xtilt + ytilt. 00041 ; 00042 ; The ADC is not very sensitive as used; the tilt values have the following 00043 ; range (approximate). 00044 ; X is h'70' at horizontal, h'80' at vertical. Good tilt < h'75'. 00045 ; Y is h'80' at horizontal, h'90' at vertical. Good tilt > h'8B'. 00046 ; 00047 ; OffLoop waits for valid angles from tilt sensor or Set button push. 00048 ; Pressing the Adv button while off enters diagnostic tilt display mode. 00049 ; 00050 ; When the display turns on it displays hours for a second, then 00051 ; displays minutes for a second, then either shuts off or displays seconds. 00052 ; 00053 ; The display code is constructed to minimize off-time of tubes MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 2 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00054 ; so that display will be as bright as possible. This means that 00055 ; all display formatting is done outside the tube-scanning loop. 00056 ; 00057 ; There is a diagnostic tilt angle display activated by pressing Adv when off. 00058 ; First X tilt is displayed, then Y tilt, then back to off. 00059 ; The tilt angle display does a cheesy hex display by lighting two cathodes 00060 ; such as '9' and '1' for hex 'A'. Their sum is the hex value. 00061 ; I could modify this to use BCD, but life is too short. 00062 ; Perhaps someone else wants to do that. 00063 ; 00064 ; Timesetting mode is entered from off loop by detecting Set button held. 00065 ; first we set 12/24 then hours then tens minutes then unit minutes then 00066 ; the tilt angle. The Adv button advances the digit(s) being set. 00067 ; 00068 ; If the watch is tilted for 1 whole second after hrs/mins display, 00069 ; then it enters seconds display mode. It turns off either 00070 ; if it's no longer tilted right or if the seconds timeout expires. 00071 ; Tilt check occurs right after the change of the second. 00072 ; 00073 ; The display period for each second is 2/3 second to save power. 00074 ; 00075 ; Timer is set to div/16384 to give one tick per second. 00076 ; No interrupts are used since they cause display glitches. 00077 ; Instead, time is incremented by DoTime when timer0 overflows. 00078 ; 00079 ; Hardware trick: Resistor from TiltPwr to HV sense provides 00080 ; blanking control by driving HV below 120V if TiltPwr on. 00081 ; Tilt is not needed at this time, so it's a free control bit. 00082 ; 00083 ;--------------------------------------------------------------- 00084 ; 00085 ; define chip type, hardware addrs & bits 00086 ; 00087 list p=16lf722 00088 00089 include 00001 LIST 00002 ; P16LF722.INC Standard Header File, Version 2.01 Microchip Technology, Inc. 00540 LIST 00541 00090 00091 ; 12 hour display mode parameters 00092 00000001 00093 FHr12 equ 1 ; hour to wrap to 00000001 00094 LHrT12 equ 1 ; last hour tens 00000003 00095 LHrU12 equ 3 ; last hour units 00000001 00096 DHrT12 equ 1 ; display hour tens 00000002 00097 DHrU12 equ 2 ; display hour units 00098 00099 ; 24 hour display mode parameters 00100 00000000 00101 FHr24 equ 0 ; hour to wrap to 00000002 00102 LHrT24 equ 2 ; last hour tens MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 3 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00000004 00103 LHrU24 equ 4 ; last hour units 00000002 00104 DHrT24 equ 2 ; display hour tens 00000004 00105 DHrU24 equ 4 ; display hour units 00106 00107 ; Time constants for display 00108 0000000A 00109 DigTim equ h'0A' ; # loops per 6 milliseconds (Less due to DoSet) 000000C0 00110 OffTim equ h'C0' ; # loops per 1/8 second for offloop 0000000E 00111 TiltTim equ h'0E' ; # of mux cycles to display tilt 0000001A 00112 HrsTim equ h'1A' ; # of mux cycles to display hours 00000030 00113 PausTim equ h'30' ; # of mux cycles to pause btwn hrs,mins 00000020 00114 MinTim equ h'20' ; # of mux cycles to display minutes 00000014 00115 SecTim equ h'14' ; # of mux cycles to display seconds 0000000C 00116 BlnkTim equ h'0C' ; blink half-period in mux cycles 00000006 00117 HangTim equ h'06' ; # of Offtims to wait after displaying 00000040 00118 SetTOut equ h'40' ; time setting timeout in seconds 0000000F 00119 TDTOut equ h'0F' ; tilt display timeout in seconds 000000FE 00120 XTMargin equ h'fe' ; display X tilt margin from captured X 00000002 00121 YTMargin equ h'02' ; display Y tilt margin from captured Y 00122 00123 ; Port A bit definitions 00124 ; 00125 ; PA5 I Adv 0=Adv button pushed 00126 ; PA4 I Set 0=Set button pushed 00127 ; PA3 A,O TPwr Analog vref in and 1->TiltPwr, HV blank 00128 ; PA2 O DispEn 1->DispPwr 00129 ; PA1 A TiltX Analog X tilt signal 00130 ; PA0 A TiltY Analog Y tilt signal 00131 00000005 00132 AdvButt equ 5 ; Adv button bit pressed = 0 00000004 00133 SetButt equ 4 ; Set button bit pressed = 0 00000000 00134 TiltY equ 0 ; Y tilt sensor analog signal 00000001 00135 TiltX equ 1 ; X tilt sensor analog signal 00136 ; 00137 ; Write the following literals to PORTA to set power bits 00138 ; 00000000 00139 PwrOff equ h'00' ; no power to nuthin' 00000004 00140 PwrDisp equ h'04' ; display HV on and not blanked 00000008 00141 PwrTilt equ h'08' ; Tilt sensor power on, no HV 0000000C 00142 PwrBlnk equ h'0C' ; display HV on but blanked 00143 ; 00144 ; Port B bit definitions 00145 ; 00146 ; PB7 O R1 ; Right digit cathode 1 00147 ; PB6 O R0 00148 ; PB5 O R2 00149 ; PB4 O R9 00150 ; PB3 O R3 00151 ; PB2 O R8 00152 ; PB1 O R4 00153 ; PB0 O R5 00154 00155 ; Port C bit definitions MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 4 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00156 ; 00157 ; PC7 O L2 ; Left digit cathode 2 00158 ; PC6 O L3 00159 ; PC5 O L4 00160 ; PC4 O L1 00161 ; PC3 O R6 00162 ; PC2 O R7 00163 ; PC1 O L0 00164 ; PC0 O L5 00165 ; 00166 ; Bits in SetDig tell which digit's being set 00167 ; 00000000 00168 NotSet equ 0 ; not in set mode 00000001 00169 H24Set equ 1 ; setting hours 00000002 00170 HrsSet equ 2 ; setting hours 00000003 00171 TMinSet equ 3 ; setting tens of minutes 00000004 00172 UMinSet equ 4 ; setting units minutes 00000005 00173 SecSet equ 5 ; set seconds to 00 when Adv pushed 00000006 00174 T45Set equ 6 ; setting tilt angle for 45 degrees 00000007 00175 DoneSet equ 7 ; were setting tilt, shut off display now 00176 ; 00177 ; Bits in TDDig tell which tilt axis is displayed 00178 ; 00000000 00179 NotTD equ 0 ; not in tilt disp mode 00000001 00180 XTDisp equ 1 ; display X tilt 00000002 00181 YTDisp equ 2 ; display Y tilt 00000003 00182 DoneTD equ 3 ; were displaying tilt, shut off display now 00183 ; 00184 ; bit definitions for display status word Display 00185 ; 00000000 00186 LBlink equ 0 ; left blink flag 1=blink 00000001 00187 RBlink equ 1 ; right blink flag 1=blink 00000002 00188 LBlank equ 2 ; left blank flag 1=blank 00000003 00189 RBlank equ 3 ; right blank flag 1=blank 00000007 00190 Hrs24 equ 7 ; 12/24 hour mode: 1=24hr 00191 ; 00192 ; Define RAM storage variables 00193 ; 00194 cblock h'020' 00000020 00195 THrs ; tens of hours range 0-1 00000021 00196 UHrs ; units hours range 0-9 00000022 00197 TMins ; tens of minutes range 0-5 00000023 00198 UMins ; units of minutes range 0-9 00000024 00199 TSecs ; tens of seconds range 0-5 00000025 00200 USecs ; units of seconds range 0-9 00000026 00201 TMinD ; displayed tens of minutes 00000027 00202 UMinD ; displayed units of minutes 00000028 00203 LDigit ; Left digit BCD value to display 00000029 00204 RDigit ; Right digit BCD value to display 0000002A 00205 SetDig ; code of digit being set 0000002B 00206 SetHist ; time that Set button has been held on 0000002C 00207 TDHist ; time that Adv button has been held on for tdisplp 0000002D 00208 TDDig ; mode of tilt display MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 5 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0000002E 00209 AdvHist ; time that Adv button has been held on 0000002F 00210 TltHist ; time that tilt has been correct 00000030 00211 Display ; display status bits per above 00000031 00212 DispTim ; time left to display this bit 00000032 00213 XTilt ; tilt of X axis from tilt sensor 00000033 00214 YTilt ; tilt of Y axis from tilt sensor 00000034 00215 DTilt ; Y tilt - X tilt from tilt sensor 00000035 00216 XTLim45 ; X tilt limit for 45 degree display 00000036 00217 YTLim45 ; Y tilt limit for 45 degree display 00000037 00218 DTLim45 ; Y-X tilt limit for 45 degree display 00000038 00219 TimLeft ; delay routine working storage 00000039 00220 LBData ; Left digit B port cathode bits 0000003A 00221 LCData ; Left digit C port cathode bits 0000003B 00222 RBData ; Right digit B port cathode bits 0000003C 00223 RCData ; Right digit C port cathode bits 0000003D 00224 SetTim ; timeout countdown for time setting mode (secs) 0000003E 00225 TDTim ; timeout countdown for tilt display mode (secs) 0000003F 00226 FirstHr ; first hour 0 or 1 00000040 00227 LastHrT ; last tens hour 1 or 2 00000041 00228 LastHrU ; last units hour 3 or 4 00000042 00229 DispHrT ; display tens hour 1 or 2 00000043 00230 DispHrU ; display units hour 3 or 4 00000044 00231 SecCnt ; number of seconds left to display 00232 00233 endc 00234 ; 00235 ; Upon reset, init ports and timer 00236 ; 0000 00237 org h'000' 0000 0000 00238 nop ; for debugger 0001 285F 00239 goto Start 00240 ; 00241 ; Load display digits with various time digits 00242 ; These are called by all display updating functions 00243 ; 0002 0824 00244 LdSecs movfw TSecs ; copy current secs into disp digits 0003 00A8 00245 movwf LDigit 0004 0825 00246 movfw USecs 0005 00A9 00247 movwf RDigit 0006 201A 00248 call LdDigs 0007 0008 00249 return 00250 0008 0822 00251 LdMins movfw TMins ; copy current mins into disp digits 0009 00A8 00252 movwf LDigit 000A 0823 00253 movfw UMins 000B 00A9 00254 movwf RDigit 000C 201A 00255 call LdDigs 000D 0008 00256 return 00257 000E 0826 00258 LdMinD movfw TMinD 000F 00A8 00259 movwf LDigit 0010 0827 00260 movfw UMinD ; copy saved minutes into L&R digits 0011 00A9 00261 movwf RDigit MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 6 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0012 201A 00262 call LdDigs 0013 0008 00263 return 00264 0014 0820 00265 LdHrs movfw THrs 0015 00A8 00266 movwf LDigit 0016 0821 00267 movfw UHrs 0017 00A9 00268 movwf RDigit ; copy current time into local storage 0018 201A 00269 call LdDigs 0019 0008 00270 return 00271 ; 00272 ; Load port B and C digit storage with cathode codes 00273 ; Reads LDigit and RDigit 00274 ; puts results in LBData..RCData 00275 ; 00276 ; This is done here to increase brightness by reducing workload 00277 ; of DispLp, which used to do all this stuff every iteration. 00278 ; 001A 3007 00279 LdDigs movlw h'07' ; prepare for left digit display 001B 05A8 00280 andwf LDigit,f ; fix range of number 001C 2027 00281 call BLeft 001D 00B9 00282 movwf LBData ; save B and C cathode codes 001E 2031 00283 call CLeft ; using bizarre PIC table lookup subroutines 001F 00BA 00284 movwf LCData 0020 300F 00285 movlw h'0F' ; prepare for right digit display 0021 05A9 00286 andwf RDigit,f ; fix range of number 0022 203B 00287 call BRight 0023 00BB 00288 movwf RBData ; Save B and C cathode codes 0024 204D 00289 call CRight 0025 00BC 00290 movwf RCData 0026 0008 00291 return 00292 ; 00293 ; The following tables are located here to ensure no wrap on PCL 00294 ; 00295 ; Lookup routines to set ports B and C to Nixie cathode 00296 ; per LDigit and RDigit 00297 ; 00298 ; Port B left tube 00299 ; 0027 0828 00300 BLeft movfw LDigit 0028 0782 00301 addwf PCL,f 00302 ; RRRRRRRR 00303 ; 10293845 0029 3400 00304 retlw B'00000000' ; left 0 002A 3400 00305 retlw B'00000000' ; left 1 002B 3400 00306 retlw B'00000000' ; left 2 002C 3400 00307 retlw B'00000000' ; left 3 002D 3400 00308 retlw B'00000000' ; left 4 002E 3400 00309 retlw B'00000000' ; left 5 002F 3400 00310 retlw B'00000000' ; left 6 displays 1,5 0030 3400 00311 retlw B'00000000' ; left 7 displays 2,5 00312 ; 00313 ; Port C left tube 00314 ; MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 7 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0031 0828 00315 CLeft movfw LDigit 0032 0782 00316 addwf PCL,f 00317 ; LLLLRRLL 00318 ; 23416705 0033 3402 00319 retlw B'00000010' ; left 0 0034 3410 00320 retlw B'00010000' ; left 1 0035 3480 00321 retlw B'10000000' ; left 2 0036 3440 00322 retlw B'01000000' ; left 3 0037 3420 00323 retlw B'00100000' ; left 4 0038 3401 00324 retlw B'00000001' ; left 5 0039 3411 00325 retlw B'00010001' ; left 6 displays 1,5 003A 3481 00326 retlw B'10000001' ; left 7 displays 2,5 00327 ; 00328 ; Port B right tube 00329 ; 003B 0829 00330 BRight movfw RDigit 003C 0782 00331 addwf PCL,f 00332 ; RRRRRRRR 00333 ; 10293845 003D 3440 00334 retlw B'01000000' ; right 0 003E 3480 00335 retlw B'10000000' ; right 1 003F 3420 00336 retlw B'00100000' ; right 2 0040 3408 00337 retlw B'00001000' ; right 3 0041 3402 00338 retlw B'00000010' ; right 4 0042 3401 00339 retlw B'00000001' ; right 5 0043 3400 00340 retlw B'00000000' ; right 6 0044 3400 00341 retlw B'00000000' ; right 7 0045 3404 00342 retlw B'00000100' ; right 8 0046 3410 00343 retlw B'00010000' ; right 9 0047 34C0 00344 retlw B'11000000' ; right 10 displays 1,0 0048 3430 00345 retlw B'00110000' ; right 11 displays 2,9 0049 34A0 00346 retlw B'10100000' ; right 12 displays 1,2 004A 3488 00347 retlw B'10001000' ; right 13 displays 1,3 004B 3482 00348 retlw B'10000010' ; right 14 displays 1,4 004C 3481 00349 retlw B'10000001' ; right 15 displays 1,5 00350 ; 00351 ; Port C right tube 00352 ; 004D 0829 00353 CRight movfw RDigit 004E 0782 00354 addwf PCL,f 00355 ; LLLLRRLL 00356 ; 23416705 004F 3400 00357 retlw B'00000000' ; right 0 0050 3400 00358 retlw B'00000000' ; right 1 0051 3400 00359 retlw B'00000000' ; right 2 0052 3400 00360 retlw B'00000000' ; right 3 0053 3400 00361 retlw B'00000000' ; right 4 0054 3400 00362 retlw B'00000000' ; right 5 0055 3408 00363 retlw B'00001000' ; right 6 0056 3404 00364 retlw B'00000100' ; right 7 0057 3400 00365 retlw B'00000000' ; right 8 0058 3400 00366 retlw B'00000000' ; right 9 0059 3400 00367 retlw B'00000000' ; right 10 displays 1,0 MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 8 LOC OBJECT CODE LINE SOURCE TEXT VALUE 005A 3400 00368 retlw B'00000000' ; right 11 displays 2,9 005B 3400 00369 retlw B'00000000' ; right 12 displays 1,2 005C 3400 00370 retlw B'00000000' ; right 13 displays 1,3 005D 3400 00371 retlw B'00000000' ; right 14 displays 1,4 005E 3400 00372 retlw B'00000000' ; right 15 displays 1,5 00373 ; 00374 ; Execution starts here after reset 00375 ; 005F 0000 00376 Start nop 0060 1283 00377 bcf STATUS,RP0 ; point to low bank 0061 1303 00378 bcf STATUS,RP1 0062 0185 00379 clrf PORTA ; turn off power 0063 0186 00380 clrf PORTB ; Clear nixie ports 0064 0187 00381 clrf PORTC 0065 3000 00382 movlw B'00000000' ; chan0, A/D disabled 0066 009F 00383 movwf ADCON0 00384 ; hi RAM 0067 1683 00385 bsf STATUS,RP0 ; point to high bank 0068 3084 00386 movlw B'10000100' ; TMR0 prescaler, 1:32 Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 0069 0081 00387 movwf OPTION_REG 006A 3033 00388 movlw B'00110011' ; PORTA bits 2,3 output Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 006B 0085 00389 movwf TRISA Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 006C 0186 00390 clrf TRISB ; PORTB all outputs Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 006D 0187 00391 clrf TRISC ; PORTC all outputs 006E 3072 00392 movlw B'01110010' ; internal RC oscillator, AN3 Vref Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 006F 009F 00393 movwf ADCON1 00394 ; hi hi RAM 0070 1703 00395 bsf STATUS,RP1 ; point to extra high bank 0071 300B 00396 movlw B'00001011' ; only AN0, AN1, AN3 are analog - tilt sensor Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 0072 0085 00397 movwf ANSELA 0073 3000 00398 movlw B'00000000' ; port B digital (outputs; shouldn't matter) Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 0074 0086 00399 movwf ANSELB 00400 ; low RAM 0075 1283 00401 bcf STATUS,RP0 ; point to low bank 0076 1303 00402 bcf STATUS,RP1 ; really point to low bank 0077 01A6 00403 clrf TMinD 0078 01A7 00404 clrf UMinD 0079 01A2 00405 clrf TMins 007A 01A3 00406 clrf UMins ; set mins,secs to :00:00 007B 01A4 00407 clrf TSecs 007C 01A5 00408 clrf USecs 007D 01A8 00409 clrf LDigit 007E 01A9 00410 clrf RDigit 007F 01B9 00411 clrf LBData 0080 01BA 00412 clrf LCData 0081 01BB 00413 clrf RBData MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 9 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0082 01BC 00414 clrf RCData 0083 01AE 00415 clrf AdvHist 0084 01AB 00416 clrf SetHist 0085 01AF 00417 clrf TltHist 0086 01B0 00418 clrf Display 0087 01B1 00419 clrf DispTim 0088 01B2 00420 clrf XTilt 0089 01B3 00421 clrf YTilt 008A 308C 00422 movlw h'8C' ; close to +0.65g 008B 00B5 00423 movwf XTLim45 008C 3074 00424 movlw h'74' ; close to -0.65g 008D 00B6 00425 movwf YTLim45 008E 3018 00426 movlw h'18' ; Y - X 008F 00B7 00427 movwf DTLim45 0090 2193 00428 call SetHr12 ; set to 12 hour mode 0091 01A0 00429 clrf THrs 0092 083F 00430 movfw FirstHr ; Set the hours to 00:00 or 1:00 0093 00A1 00431 movwf UHrs 0094 01BD 00432 clrf SetTim 0095 01AA 00433 clrf SetDig 0096 142A 00434 bsf SetDig,NotSet ; flag no setting going on 0097 01BE 00435 clrf TDTim 0098 01AD 00436 clrf TDDig 0099 142D 00437 bsf TDDig,NotTD ; turn off tilt display mode 00438 ; 00439 ; OffLoop follows tilt sequence, incs time, uses little power. 00440 ; 009A 221C 00441 OffLoop call WaitOff ; wait for 1/8 of second 009B 2221 00442 call DoTime ; update time variables 009C 2121 00443 call DoSet ; check for set button 009D 1C2A 00444 btfss SetDig,NotSet 009E 290F 00445 goto SetLoop ; Got to timesetting loop if setting 009F 20F5 00446 call DoTD ; check for Adv button 00A0 1C2D 00447 btfss TDDig,NotTD 00A1 28DF 00448 goto TDLoop ; goto tilt disp loop if Adv was pressed 00A2 2250 00449 call GetTilt ; read sensor 00A3 0AAF 00450 incf TltHist,f ; assume tilt is good 00A4 226A 00451 call ChkT45 ; See if tilt is 45 yet 00A5 1C03 00452 skpc ; good tilt 00A6 01AF 00453 clrf TltHist ; bad tilt, start over 00A7 3002 00454 movlw 2 ; test TltHist is 2 for good tilt 00A8 022F 00455 subwf TltHist,w 00A9 1D03 00456 skpz 00AA 289A 00457 goto OffLoop ; not good, do it all again 00458 ; 00459 ; Tilt sequence correct - turn on watch to show time 00460 ; 00AB 0AAF 00461 incf TltHist,f ; force another tilt to display again 00AC 2014 00462 call LdHrs ; get hours into display bytes 00AD 0822 00463 movfw TMins 00AE 00A6 00464 movwf TMinD ; save current minutes 00AF 0823 00465 movfw UMins ; so it won't show old hrs but new mins 00B0 00A7 00466 movwf UMinD MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 10 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00B1 1130 00467 bcf Display,LBlank ; disp both digits for now 00B2 11B0 00468 bcf Display,RBlank 00B3 301A 00469 NoHBlnk movlw HrsTim 00B4 00B1 00470 movwf DispTim ; set time to display hours 00B5 300C 00471 movlw PwrBlnk ; turn on HV but blank display 00B6 0085 00472 movwf PORTA 00B7 21FF 00473 call DispLpN ; display the hours 00B8 3030 00474 movlw PausTim 00B9 00B1 00475 movwf DispTim 00BA 2217 00476 HrMinLp call WtDigit ; pause between hrs, mins 00BB 0BB1 00477 decfsz DispTim,f 00BC 28BA 00478 goto HrMinLp 00BD 200E 00479 call LdMinD ; set display to saved minutes 00BE 3020 00480 movlw MinTim 00BF 00B1 00481 movwf DispTim ; set time to disp minutes 00C0 21FF 00482 call DispLpN ; display the minutes 00C1 3030 00483 movlw PausTim 00C2 00B1 00484 movwf DispTim 00C3 2217 00485 MinScLp call WtDigit ; pause between mins, secs 00C4 0BB1 00486 decfsz DispTim,f 00C5 28C3 00487 goto MinScLp 00C6 3014 00488 movlw SecTim 00C7 00C4 00489 movwf SecCnt ; set timeout for seconds display 00490 ; 00491 ; loop for seconds display till duty cycle reaches zero 00492 ; 00C8 1D0B 00493 SecLp btfss INTCON,T0IF ; test timer overflow 00C9 28C8 00494 goto SecLp ; loop till set (top of second) 00CA 2221 00495 call DoTime ; update time variables 00CB 2250 00496 call GetTilt ; read sensor 00CC 226A 00497 call ChkT45 ; See if tilt is still good 00CD 1C03 00498 skpc ; good tilt, do another second 00CE 28D5 00499 goto PwrDown ; bad tilt, exit seconds display 00CF 2002 00500 call LdSecs ; update seconds value to display 00D0 0844 00501 movfw SecCnt ; duty cycle is remaining loop index 00D1 00B1 00502 movwf DispTim ; set time to display them 00D2 21FF 00503 call DispLpN ; display the seconds 00D3 0BC4 00504 decfsz SecCnt,f ; count down seconds display timeout 00D4 28C8 00505 goto SecLp ; still active, do another second 00506 ; 00507 ; Finish up time display 00508 ; 00D5 0186 00509 PwrDown clrf PORTB ; shut off nixies 00D6 0187 00510 clrf PORTC 00D7 0185 00511 clrf PORTA ; turn off power 00D8 3006 00512 movlw HangTim 00D9 00B1 00513 movwf DispTim ; set up holdoff timer 00DA 221C 00514 HangLp call WaitOff 00DB 2221 00515 call DoTime 00DC 0BB1 00516 decfsz DispTim,f ; kill time between displayings 00DD 28DA 00517 goto HangLp 00DE 289A 00518 goto OffLoop ; ready to display again 00519 ; MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 11 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00520 ; TDispLp - diagnostic display of tilt values 00521 ; 00522 ; TDispLp displays X or Y tilt in hexadecimal on the nixies 00523 ; continuously for test purposes. 00524 ; It reads the tilt 2 times a second and updates the display at this 00525 ; rate. Power is shut down for tilt reading, causes display to wink. 00526 ; 00527 ; TDispLp is entered from OffLp when Adv button is pushed, 00528 ; causing TiltDig to be advanced to XTDisp. Adv steps through modes: 00529 ; off -> XTilt -> YTilt -> Done 00530 ; 00DF 00531 TDLoop 00DF 2221 00532 call DoTime ; keep timekeeping up to date 00E0 2250 00533 call GetTilt ; read tilt sensor 00E1 300C 00534 movlw PwrBlnk ; turn on HV but blank display 00E2 0085 00535 movwf PORTA 00E3 0832 00536 movfw XTilt 00E4 192D 00537 btfsc TDDig,YTDisp ; use Y instead of X when in Y mode 00E5 0833 00538 movfw YTilt 00E6 00A8 00539 movwf LDigit ; MSBs into left digit 00E7 0EA8 00540 swapf LDigit,f ; move MSBs to LSBs of left digit 00E8 00A9 00541 movwf RDigit ; LSBs to right digit 00E9 201A 00542 call LdDigs ; write digits to tubes 00EA 1130 00543 bcf Display,LBlank ; disp both digits 00EB 11B0 00544 bcf Display,RBlank 00EC 300E 00545 movlw TiltTim ; set time to display it 00ED 00B1 00546 movwf DispTim 00EE 21FF 00547 call DispLpN ; display tilt but don't check buttons 00EF 3000 00548 movlw PwrOff ; turn off HV 00F0 0085 00549 movwf PORTA 00F1 20F5 00550 call DoTD ; process Adv button for tilt modes 00F2 1C2D 00551 btfss TDDig,NotTD ; exit this loop if out of tdisp mode 00F3 28DF 00552 goto TDLoop ; pushed, so do it again 00F4 289A 00553 goto OffLoop ; else go back to being a clock 00554 ; 00555 ; DoTD detects if the Adv button is pushed, and debounces. 00556 ; If it's time for action, it sequences through the tilt display modes. 00557 ; 00F5 1E85 00558 DoTD btfss PORTA,AdvButt ; read the button - 0 is pushed 00F6 28FC 00559 goto IsTD 00F7 01AC 00560 clrf TDHist ; button not pressed - clear history 00F8 08BE 00561 tstf TDTim ; timed out? 00F9 1903 00562 skpnz 00FA 290B 00563 goto DoneT ; yes, turn off tilt display mode 00FB 290E 00564 goto NoTD 00FC 0AAC 00565 IsTD incf TDHist,f ; it is pushed - bump history counter 00FD 3004 00566 movlw 4 00FE 022C 00567 subwf TDHist,w 00FF 1903 00568 skpnz ; make hist stick at 4 to prevent autorepeat 0100 03AC 00569 decf TDHist,f 0101 3001 00570 GotTD movlw 1 0102 022C 00571 subwf TDHist,w ; debounce time is 1 loop 0103 1D03 00572 skpz MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 12 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0104 290E 00573 goto NoTD 0105 300F 00574 movlw TDTOut ; load tilt display timeout counter 0106 00BE 00575 movwf TDTim 0107 1003 00576 clrc 0108 0DAD 00577 rlf TDDig,f ; bump to next setting mode 0109 1DAD 00578 btfss TDDig,DoneTD ; are we done tilt displaying? 010A 290E 00579 goto NoTD 010B 01AD 00580 DoneT clrf TDDig ; turn off tilt display mode 010C 142D 00581 bsf TDDig,NotTD 010D 01BE 00582 clrf TDTim ; clear timeout counter 010E 0008 00583 NoTD return 00584 ; 00585 ; -------------------------------------------------------- 00586 ; 00587 ; Time setting code 00588 ; 00589 ; Setting procedure: 00590 ; 00591 ; Hold Set button till display lights, then release. 00592 ; Display is unblinking '12' or '24', indicating hours mode. 00593 ; Press Adv button to toggle between 12 hour and 24 hour modes. 00594 ; Press Set button and release. 00595 ; Both digits of Hours will flash. 00596 ; Press Adv button once per increment to set hours. 00597 ; Press Set button and release. 00598 ; Tens of Minutes will flash, units will be solid. 00599 ; Press Adv button once per increment to set tens minutes. 00600 ; Press Set button and release. 00601 ; Units of Minutes will flash, tens will be solid. 00602 ; Press Adv button once per increment to set units minutes. 00603 ; Press Set button and release. 00604 ; Display is incrementing seconds. 00605 ; Press Adv button once to reset seconds to 00. 00606 ; Press Set button and release. 00607 ; Display is unblinking '45'. 00608 ; Hold watch at best viewing angle, typically 45 degrees. 00609 ; Press Adv button to save tilt angle. Display will flash once. 00610 ; Press Set button and release. 00611 ; Display will blank. Setting is done. 00612 ; 00613 ; Set & Adv buttons are sampled once per mux iteration. 00614 ; Each button must be pressed then released for each action. 00615 00616 ; SetLoop is entered from OffLp when Set button is pushed, 00617 ; causing SetDig to be advanced to HrsSet. 00618 ; 00619 ; The setting state machine keeps its state in SetDig. 00620 ; SetHist is a count of how long the Set button has been held down. 00621 ; When the buton has been hjeld down long enough to debounce, then 00622 ; the state machine is advanced to the next state and the necessary 00623 ; variables are updated to make the display show the right stuff for 00624 ; that mode. Similarly, the Adv button's time pressed is AdvHist. 00625 ; When Adv is pressed, the appropriate vairable is incremented and MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 13 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00626 ; the display variables are updated. 00627 ; 00628 ; Display time with blinking digits, read buttons and act on them. 00629 ; 010F 300C 00630 SetLoop movlw BlnkTim ; set display duration 0110 00B1 00631 movwf DispTim 0111 1130 00632 bcf Display,LBlank ; Enable display for on phase of blink 0112 11B0 00633 bcf Display,RBlank 0113 21E5 00634 call DispLp ; Do display, read buttons 0114 300C 00635 movlw BlnkTim 0115 00B1 00636 movwf DispTim ; set duration 0116 1830 00637 btfsc Display,LBlink ; set L blanking flag per blink request 0117 1530 00638 bsf Display,LBlank 0118 18B0 00639 btfsc Display,RBlink ; set R blanking flag per blink request 0119 15B0 00640 bsf Display,RBlank 011A 21E5 00641 call DispLp ; do display, read buttons 011B 1C2A 00642 btfss SetDig,NotSet 011C 290F 00643 goto SetLoop ; loop if still setting 011D 0186 00644 clrf PORTB ; shut off nixies 011E 0187 00645 clrf PORTC 011F 0185 00646 clrf PORTA ; turn off power 0120 289A 00647 goto OffLoop 00648 ; 00649 ; DoSet detects if the Set button is pushed, and debounces. 00650 ; If it's time for action, it selects the digit being set in the order: 00651 ; 00652 ; This routine sets up the display mode to match the set function. 00653 ; 0121 1E05 00654 DoSet btfss PORTA,SetButt ; read the button - 0 is pushed 0122 2928 00655 goto IsSet 0123 01AB 00656 clrf SetHist ; button not pressed - clear history 0124 08BD 00657 tstf SetTim ; timed out? 0125 1903 00658 skpnz 0126 2967 00659 goto DoneS ; yes, turn off timesetting mode 0127 296D 00660 goto NoSet 0128 0AAB 00661 IsSet incf SetHist,f ; it is pushed - bump history counter 0129 3004 00662 movlw 4 012A 022B 00663 subwf SetHist,w 012B 1903 00664 skpnz ; make hist stick at 4 to prevent autorepeat 012C 03AB 00665 decf SetHist,f 012D 3002 00666 GotSet movlw 2 012E 022B 00667 subwf SetHist,w ; debounce time is 2 loops ~=40 millisec 012F 1D03 00668 skpz 0130 296D 00669 goto NoSet 0131 3040 00670 movlw SetTOut ; load time setting timeout counter 0132 00BD 00671 movwf SetTim 0133 1003 00672 clrc 0134 0DAA 00673 rlf SetDig,f ; bump to next setting mode 0135 18AA 00674 btfsc SetDig,H24Set ; is it 12/24 hour mode? 0136 2943 00675 goto H24S 0137 192A 00676 btfsc SetDig,HrsSet ; is it hours? 0138 294F 00677 goto HrsS 0139 19AA 00678 btfsc SetDig,TMinSet ; is it tens of minutes? MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 14 LOC OBJECT CODE LINE SOURCE TEXT VALUE 013A 2953 00679 goto TMinS 013B 1A2A 00680 btfsc SetDig,UMinSet ; is it units of minutes? 013C 2957 00681 goto UMinS 013D 1AAA 00682 btfsc SetDig,SecSet ; is it seconds? 013E 295B 00683 goto SecS 013F 1B2A 00684 btfsc SetDig,T45Set ; is it tilt? 0140 295F 00685 goto Tilt45S 0141 1BAA 00686 btfsc SetDig,DoneSet ; are we done setting? 0142 2967 00687 goto DoneS 00688 ; 00689 ; Enter H24 setting mode 00690 ; 00691 ; This routine turns on the display when timesetting mode is entered. 00692 ; 0143 300C 00693 H24S movlw PwrBlnk ; turn on HV but blank display 0144 0085 00694 movwf PORTA 0145 0000 00695 nop 0146 0000 00696 nop 0147 0842 00697 movfw DispHrT ; get mode display value 0148 00A8 00698 movwf LDigit ; into display digits 0149 0843 00699 movfw DispHrU 014A 00A9 00700 movwf RDigit 014B 201A 00701 call LdDigs ; load it into disp storage 014C 1030 00702 bcf Display,LBlink ; no blinking 014D 10B0 00703 bcf Display,RBlink 014E 296D 00704 goto NoSet 00705 ; 00706 ; Enter Hours setting mode 00707 ; 014F 2014 00708 HrsS call LdHrs ; copy current hours into disp digits 0150 1430 00709 bsf Display,LBlink ; blink both digits 0151 14B0 00710 bsf Display,RBlink 0152 296D 00711 goto NoSet 00712 ; 00713 ; Enter TMins setting mode 00714 ; 0153 2008 00715 TMinS call LdMins ; copy current mins into disp digits 0154 1430 00716 bsf Display,LBlink ; blink only left digit 0155 10B0 00717 bcf Display,RBlink 0156 296D 00718 goto NoSet 00719 ; 00720 ; Enter UMins setting mode 00721 ; 0157 2008 00722 UMinS call LdMins ; load minutes into disp storage 0158 1030 00723 bcf Display,LBlink ; blink only right digit 0159 14B0 00724 bsf Display,RBlink 015A 296D 00725 goto NoSet 00726 ; 00727 ; Enter Secs setting mode 00728 ; 015B 2002 00729 SecS call LdSecs ; load seconds into disp storage 015C 1030 00730 bcf Display,LBlink ; No blink, but display advances 015D 10B0 00731 bcf Display,RBlink ; via code at TimeRet. MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 15 LOC OBJECT CODE LINE SOURCE TEXT VALUE 015E 296D 00732 goto NoSet 00733 ; 00734 ; Enter Tilt45 setting mode 00735 ; 015F 3004 00736 Tilt45S movlw h'4' ; get a '45' for display 0160 00A8 00737 movwf LDigit 0161 3005 00738 movlw h'5' 0162 00A9 00739 movwf RDigit 0163 201A 00740 call LdDigs ; load it into disp storage 0164 1030 00741 bcf Display,LBlink ; no blinking 0165 10B0 00742 bcf Display,RBlink 0166 296D 00743 goto NoSet 00744 ; 00745 ; Finish up when exiting set mode 00746 ; 0167 01AA 00747 DoneS clrf SetDig ; leave setting mode 0168 142A 00748 bsf SetDig,NotSet 0169 01BD 00749 clrf SetTim ; clear timeout counter 016A 0186 00750 clrf PORTB 016B 0187 00751 clrf PORTC 016C 0185 00752 clrf PORTA ; Shut off display 016D 0008 00753 NoSet return 00754 ; 00755 ; DoAdv processes the Adv button. If it's pushed, we debounce 00756 ; via AdvHist. When it's time to advance the clock setting, 00757 ; the appropriate digit(s) are incremented without carrying into other 00758 ; digits. 00759 ; 016E 1E85 00760 DoAdv btfss PORTA,AdvButt ; read the button - 0 is pushed 016F 2972 00761 goto IsAdv 0170 01AE 00762 clrf AdvHist ; button not pressed - clear history 0171 2987 00763 goto AdvDone 0172 0AAE 00764 IsAdv incf AdvHist,f ; it is pushed - bump history counter 0173 3004 00765 movlw 4 0174 022E 00766 subwf AdvHist,w 0175 1903 00767 skpnz ; make hist stick at 4 to prevent autorepeat 0176 03AE 00768 decf AdvHist,f 0177 3002 00769 GotAdv movlw 2 0178 022E 00770 subwf AdvHist,w ; debounce time is 2 loops ~=40 millisec 0179 1D03 00771 skpz 017A 2987 00772 goto AdvDone 017B 18AA 00773 btfsc SetDig,H24Set ; is it 12/24 hour mode? 017C 2988 00774 goto H24A 017D 192A 00775 btfsc SetDig,HrsSet ; is it hours? 017E 29AB 00776 goto HrsA 017F 19AA 00777 btfsc SetDig,TMinSet ; is it Tenmins? 0180 29AE 00778 goto TMinA 0181 1A2A 00779 btfsc SetDig,UMinSet ; is it UnitsMins? 0182 29B5 00780 goto UMinA 0183 1AAA 00781 btfsc SetDig,SecSet ; is it seconds? 0184 29BC 00782 goto SecA 0185 1B2A 00783 btfsc SetDig,T45Set ; is it Tilt at 45? 0186 29C1 00784 goto Tilt45A MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 16 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0187 0008 00785 AdvDone return ; Nothing to do so return 00786 ; 00787 ; toggle 12/24 hour mode 00788 ; 0188 1FB0 00789 H24A btfss Display,Hrs24 ; In 24 hour mode? 0189 298C 00790 goto H24No 018A 2193 00791 call SetHr12 ; yes, go from 24 to 12 hour mode 018B 298D 00792 goto H24Got 018C 219F 00793 H24No call SetHr24 ; else go from 12 to 24 hour mode 018D 0842 00794 H24Got movfw DispHrT ; get mode display value 018E 00A8 00795 movwf LDigit ; into display digits 018F 0843 00796 movfw DispHrU 0190 00A9 00797 movwf RDigit 0191 201A 00798 call LdDigs ; load it into disp storage 0192 2987 00799 goto AdvDone 00800 ; 00801 ; Set timekeeping to 12 hour mode 00802 ; 0193 3001 00803 SetHr12 movlw FHr12 ; Set up for 12 hour mode 0194 00BF 00804 movwf FirstHr 0195 3001 00805 movlw LHrT12 0196 00C0 00806 movwf LastHrT 0197 3003 00807 movlw LHrU12 0198 00C1 00808 movwf LastHrU 0199 3001 00809 movlw DHrT12 019A 00C2 00810 movwf DispHrT 019B 3002 00811 movlw DHrU12 019C 00C3 00812 movwf DispHrU 019D 13B0 00813 bcf Display,Hrs24 019E 0008 00814 return 00815 ; 00816 ; Set timekeeping to 24 hour mode 00817 ; 019F 3000 00818 SetHr24 movlw FHr24 ; Set up for 24 hour mode 01A0 00BF 00819 movwf FirstHr 01A1 3002 00820 movlw LHrT24 01A2 00C0 00821 movwf LastHrT 01A3 3004 00822 movlw LHrU24 01A4 00C1 00823 movwf LastHrU 01A5 3002 00824 movlw DHrT24 01A6 00C2 00825 movwf DispHrT 01A7 3004 00826 movlw DHrU24 01A8 00C3 00827 movwf DispHrU 01A9 17B0 00828 bsf Display,Hrs24 01AA 0008 00829 return 00830 ; 00831 ; Advance hours 00832 ; 01AB 21D1 00833 HrsA call IncHrs ; increment hours (messy) 01AC 2014 00834 call LdHrs ; copy new hours into disp digits 01AD 2987 00835 goto AdvDone 00836 ; 00837 ; Advance tens of minutes MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 17 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00838 ; 01AE 0AA2 00839 TMinA incf TMins,f ; increment tens of minutes 01AF 3006 00840 movlw 6 01B0 0222 00841 subwf TMins,w ; did it hit 6? 01B1 1903 00842 skpnz 01B2 01A2 00843 clrf TMins ; yes, wrap from 5 to 0 01B3 2008 00844 call LdMins ; copy new minutes into disp digits 01B4 2987 00845 goto AdvDone 00846 ; 00847 ; Advance units minutes 00848 ; 01B5 0AA3 00849 UMinA incf UMins,f ; increment units of minutes 01B6 300A 00850 movlw h'A' 01B7 0223 00851 subwf UMins,w ; did it hit 10? 01B8 1903 00852 skpnz 01B9 01A3 00853 clrf UMins ; yes, wrap from 10 to 0 01BA 2008 00854 call LdMins ; copy new minutes into disp digits 01BB 2987 00855 goto AdvDone 00856 ; 00857 ; Reset seconds 00858 ; 01BC 01A4 00859 SecA clrf TSecs ; Set seconds to 0 01BD 01A5 00860 clrf USecs 01BE 0181 00861 clrf TMR0 ; set sub-seconds to 0 01BF 2002 00862 call LdSecs ; copy new seconds into disp digits 01C0 2987 00863 goto AdvDone 00864 ; 00865 ; Capture and save 45 deg tilt angle 00866 ; 01C1 3000 00867 Tilt45A movlw PwrOff 01C2 0085 00868 movwf PORTA ; cut off power now for stability 01C3 2250 00869 call GetTilt ; find out current tilt angle 01C4 221C 00870 call WaitOff ; pause to flash display 01C5 2250 00871 call GetTilt ; find out current tilt angle 01C6 30FE 00872 movlw XTMargin ; Get X tilt + XTMargin 01C7 0732 00873 addwf XTilt,w 01C8 00B5 00874 movwf XTLim45 ; save as X limit 01C9 3002 00875 movlw YTMargin ; Get Y tilt + YTMargin 01CA 0733 00876 addwf YTilt,w 01CB 00B6 00877 movwf YTLim45 ; save as Y limit 01CC 0833 00878 movfw YTilt ; Get X tilt - Y tilt 01CD 0232 00879 subwf XTilt,w 01CE 00B7 00880 movwf DTLim45 ; save as D limit 01CF 03B7 00881 decf DTLim45,f ; make it X - Y - 1 01D0 2987 00882 goto AdvDone 00883 ; 00884 ; IncHrs increments the hours which is an ugly process 00885 ; (but it only happens once an hour, so what, me worry?) 00886 ; 01D1 0AA1 00887 IncHrs incf UHrs,f ; bump units hours 01D2 0840 00888 movfw LastHrT 01D3 0220 00889 subwf THrs,w ; Tens at last hour? 01D4 1D03 00890 skpz MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 18 LOC OBJECT CODE LINE SOURCE TEXT VALUE 01D5 29DE 00891 goto NoHWrap ; no, do carry 01D6 0841 00892 movfw LastHrU 01D7 0221 00893 subwf UHrs,w ; Units at last hour? 01D8 1D03 00894 skpz 01D9 29DE 00895 goto NoHWrap ; no, do carry 01DA 083F 00896 movfw FirstHr 01DB 00A1 00897 movwf UHrs ; yes, reset hours to 1 or 0 o'clock 01DC 0103 00898 clrw 01DD 00A0 00899 movwf THrs 01DE 300A 00900 NoHWrap movlw h'A' 01DF 0221 00901 subwf UHrs,w ; did it hit 10? 01E0 1D03 00902 skpz 01E1 29E4 00903 goto NoHrC 01E2 01A1 00904 clrf UHrs ; yes, wrap from 10 to 0 01E3 0AA0 00905 incf THrs,f ; and bump tens 01E4 0008 00906 NoHrC return 00907 ; 00908 ;-------------------------------------------------------- 00909 ; Display loop 00910 ; 00911 ; DispLp displays the cathodes stored in [L,R][B,C]Data. 00912 ; It uses the blanking bits LBlank and RBlank per digit. 00913 ; It runs for DispTim then returns. 00914 ; Also calls Set and Adv button routines for timesetting mode. 00915 ; 00916 ; This routine does multiplexing by lighting first left digit then right. 00917 ; 00918 ; Entered and returns with display dark via TiltEn bit of Port A 00919 ; Also clears Ports B and C to ensure blankness 00920 ; 01E5 2221 00921 DispLp call DoTime ; update time variables 01E6 0839 00922 movfw LBData 01E7 0086 00923 movwf PORTB ; Set ports B and C to left cathode codes 01E8 083A 00924 movfw LCData 01E9 0087 00925 movwf PORTC 01EA 3004 00926 movlw PwrDisp 01EB 1D30 00927 btfss Display,LBlank ; blank this digit? 01EC 0085 00928 movwf PORTA ; not blanked so let HV go high 01ED 2217 00929 call WtDigit ; Wait for it to display 01EE 2121 00930 call DoSet ; process the Set button while lit 01EF 300C 00931 movlw PwrBlnk 01F0 0085 00932 movwf PORTA ; blank display while changing cathodes 01F1 083B 00933 movfw RBData 01F2 0086 00934 movwf PORTB ; Set ports B and C to right cathode codes 01F3 083C 00935 movfw RCData 01F4 0087 00936 movwf PORTC 01F5 3004 00937 movlw PwrDisp 01F6 1DB0 00938 btfss Display,RBlank ; blank this digit? 01F7 0085 00939 movwf PORTA ; not blanked so let HV go high 01F8 2217 00940 call WtDigit ; Wait for it to display 01F9 216E 00941 call DoAdv ; process the Adv button while other digit lit 01FA 300C 00942 movlw PwrBlnk 01FB 0085 00943 movwf PORTA ; blank via HV control from TiltPwr MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 19 LOC OBJECT CODE LINE SOURCE TEXT VALUE 01FC 0BB1 00944 decfsz DispTim,f 01FD 29E5 00945 goto DispLp ; do it till count expires 01FE 0008 00946 return 00947 ; 00948 ; This version doesn't call DoSet or DoAdv. It's used for normal display. 00949 ; 01FF 2221 00950 DispLpN call DoTime ; update time variables 0200 0839 00951 movfw LBData 0201 0086 00952 movwf PORTB ; Set ports B and C to left cathode codes 0202 083A 00953 movfw LCData 0203 0087 00954 movwf PORTC 0204 3004 00955 movlw PwrDisp 0205 1D30 00956 btfss Display,LBlank ; blank this digit? 0206 0085 00957 movwf PORTA ; not blanked so let HV go high 0207 2217 00958 call WtDigit ; Wait for it to display 0208 300C 00959 movlw PwrBlnk 0209 0085 00960 movwf PORTA ; blank display while changing cathodes 020A 083B 00961 movfw RBData 020B 0086 00962 movwf PORTB ; Set ports B and C to right cathode codes 020C 083C 00963 movfw RCData 020D 0087 00964 movwf PORTC 020E 3004 00965 movlw PwrDisp 020F 1DB0 00966 btfss Display,RBlank ; blank this digit? 0210 0085 00967 movwf PORTA ; not blanked so let HV go high 0211 2217 00968 call WtDigit ; Wait for it to display 0212 300C 00969 movlw PwrBlnk 0213 0085 00970 movwf PORTA ; blank via HV control from TiltPwr 0214 0BB1 00971 decfsz DispTim,f 0215 29FF 00972 goto DispLpN ; do it till count expires 0216 0008 00973 return 00974 ; 00975 ; WtDigit delays for one digit time - about six milliseconds 00976 ; 00977 ; Destroys W 00978 ; 0217 300A 00979 WtDigit movlw DigTim ; get constant delay number 0218 00B8 00980 movwf TimLeft ; copy to local storage 0219 0BB8 00981 WtLoop1 decfsz TimLeft,f 021A 2A19 00982 goto WtLoop1 ; loop that many times 021B 0008 00983 return 00984 ; 00985 ; WaitOff delays for about 1/8 second while power is off 00986 ; 00987 ; Destroys W 00988 ; 021C 30C0 00989 WaitOff movlw OffTim ; get constant delay number 021D 00B8 00990 movwf TimLeft ; copy to local storage 021E 0BB8 00991 WtOff1 decfsz TimLeft,f 021F 2A1E 00992 goto WtOff1 ; loop that many times 0220 0008 00993 return 00994 ; 00995 ; DoTime checks timer, updates time vars accordingly 00996 ; MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 20 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00997 ; The timer is set up to overflow once per second. This routine is called 00998 ; several times a second to poll the timer status to detect an overflow. 00999 ; If hte timer overflows, the overflow bit is reset and the time variables 01000 ; are incremented according to standard clock behavior. 01001 ; 01002 ; The reason that interrupts are not used is that the display flickers 01003 ; when the interrupt occurrs. Been there, done that. 01004 ; 0221 1D0B 01005 DoTime btfss INTCON,T0IF ; test timer overflow 0222 2A43 01006 goto TimeNop ; no overflow, do nothing (equalize time) 0223 110B 01007 bcf INTCON,T0IF ; reset overflow flag 0224 08BD 01008 tstf SetTim ; Setting mode? 0225 1D03 01009 skpz 0226 03BD 01010 decf SetTim,f ; Yes, count down setting time left 0227 08BE 01011 tstf TDTim ; Tilt display mode? 0228 1D03 01012 skpz 0229 03BE 01013 decf TDTim,f ; Yes, count down display time left 022A 0AA5 01014 incf USecs,f ; bump units seconds 022B 300A 01015 movlw h'A' ; ten second overflow? 022C 0225 01016 subwf USecs,w 022D 1D03 2A4D 01017 bnz TimeRet ; no, return 022F 01A5 01018 clrf USecs 0230 0AA4 01019 incf TSecs,f ; bump tens seconds 0231 3006 01020 movlw h'6' ; Minute overflow? 0232 0224 01021 subwf TSecs,w 0233 1D03 2A4D 01022 bnz TimeRet ; no, return 0235 01A4 01023 clrf TSecs 0236 0AA3 01024 incf UMins,f ; bump units minutes 0237 300A 01025 movlw h'A' ; ten minute overflow? 0238 0223 01026 subwf UMins,w 0239 1D03 2A4D 01027 bnz TimeRet ; no, return 023B 01A3 01028 clrf UMins 023C 0AA2 01029 incf TMins,f ; bump tens minutes 023D 3006 01030 movlw h'6' ; hourly overflow? 023E 0222 01031 subwf TMins,w 023F 1D03 2A4D 01032 bnz TimeRet ; no, return 0241 01A2 01033 clrf TMins 0242 21D1 01034 call IncHrs ; bump the hour by one 0243 0000 01035 TimeNop nop 0244 0000 01036 nop ; equalize timing of routine to 0245 0000 01037 nop ; prevent display glitch once per second 0246 0000 01038 nop 0247 0000 01039 nop 0248 0000 01040 nop 0249 0000 01041 nop 024A 0000 01042 nop 024B 0000 01043 nop 024C 0000 01044 nop 024D 1AAA 01045 TimeRet btfsc SetDig,SecSet ; If we're setting seconds, update display 024E 2802 01046 goto LdSecs 024F 0008 01047 return 01048 ; 01049 ; Read the tilt sensor. MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 21 LOC OBJECT CODE LINE SOURCE TEXT VALUE 01050 ; Results are placed in XTilt and YTilt. 01051 ; 01052 ; Disp, Tilt power is turned off by this routine. 01053 ; 01054 ; Sensor needs 2 milliseconds from TiltPwr on to first A/D conversion. 01055 ; Code is interleaved to minimize power-on time of tilt sensor, 01056 ; which uses 300 uA. This saves battery drain. 01057 ; 01058 ; The remnants are from an attempt to use higher resolution on the ADC. 01059 ; It needed all 10 bits, so I didn't bother. Seems to work as is. 01060 ; 0250 3008 01061 GetTilt movlw PwrTilt ; turn on tilt sensor power 0251 0085 01062 movwf PORTA 0252 141F 01063 bsf ADCON0,ADON ; turn on the A/D converter module 0253 111F 01064 bcf ADCON0,CHS0 ; select A/D channel 0 = X 0254 0000 01065 nop 0255 0000 01066 nop ; wait one millisecond 0256 0000 01067 nop 0257 0000 01068 nop 0258 0000 01069 nop 0259 0000 01070 nop 025A 0000 01071 nop 025B 0000 01072 nop 025C 149F 01073 bsf ADCON0,GO ; Start A/D conversion at 2 milliseconds 025D 0000 01074 nop ; Wait for X conversion to complete 025E 151F 01075 bsf ADCON0,CHS0 ; select A/D channel 1 = Y 025F 081E 01076 movfw ADRES ; get X tilt from A/D 0260 00B2 01077 movwf XTilt ; save X tilt 0261 149F 01078 bsf ADCON0,GO ; Start second A/D conversion 0262 0000 01079 nop ; Wait for Y conversion to complete 0263 0000 01080 nop ; Wait for Y conversion to complete 0264 081E 01081 movfw ADRES ; get Y tilt 0265 00B3 01082 movwf YTilt ; save Y tilt 0266 3000 01083 movlw PwrOff ; turn off tilt sensor power 0267 0085 01084 movwf PORTA 0268 101F 01085 bcf ADCON0,ADON ; turn off the A/D converter module 0269 0008 01086 return 01087 ; 01088 ; ChkT45 See if tilted to 45 degrees 01089 ; 01090 ; Returns NC if not tilted right, 01091 ; returns C if tilted right. 01092 ; 01093 ; We want: 01094 ; (XTilt - YTilt) > DTLim45 (h'18') 01095 ; XTilt > XTLim45 (h'8C' ~+0.65g) 01096 ; YTilt < YTLim45 (h'74' ~-0.65g) 01097 ; 026A 0833 01098 ChkT45 movfw YTilt 026B 0232 01099 subwf XTilt,w 026C 00B4 01100 movwf DTilt ; calc XTilt - YTilt -> DTilt 026D 0837 01101 movfw DTLim45 026E 0234 01102 subwf DTilt,w ; D tilt minus D lim, pos is good tilt MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 22 LOC OBJECT CODE LINE SOURCE TEXT VALUE 026F 1C03 01103 skpc ; NC is bad 0270 2A77 01104 goto CT45Don ; bad Y-X tilt 0271 0835 01105 movfw XTLim45 0272 0232 01106 subwf XTilt,w ; X tilt minus X lim, pos is good tilt 0273 1C03 01107 skpc ; NC is bad 0274 2A77 01108 goto CT45Don ; bad X tilt 0275 0833 01109 movfw YTilt 0276 0236 01110 subwf YTLim45,w ; Y lim minus Y tilt, pos is good tilt 0277 0008 01111 CT45Don return ; NC is bad, C is good 01112 01113 end ; end of file MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 23 SYMBOL TABLE LABEL VALUE ADCON0 0000001F ADCON1 0000009F ADCS0 00000004 ADCS1 00000005 ADCS2 00000006 ADDEN 00000003 ADFVR0 00000000 ADFVR1 00000001 ADIE 00000006 ADIF 00000006 ADON 00000000 ADREF0 00000000 ADREF1 00000001 ADRES 0000001E ANSA0 00000000 ANSA1 00000001 ANSA2 00000002 ANSA3 00000003 ANSA4 00000004 ANSA5 00000005 ANSB0 00000000 ANSB1 00000001 ANSB2 00000002 ANSB3 00000003 ANSB4 00000004 ANSB5 00000005 ANSELA 00000185 ANSELB 00000186 APFCON 0000009C AdvButt 00000005 AdvDone 00000187 AdvHist 0000002E BF 00000000 BLeft 00000027 BRGH 00000002 BRight 0000003B BlnkTim 0000000C C 00000000 CCP1CON 00000017 CCP1IE 00000002 CCP1IF 00000002 CCP1M0 00000000 CCP1M1 00000001 CCP1M2 00000002 CCP1M3 00000003 CCP1X 00000005 CCP1Y 00000004 CCP2CON 0000001D CCP2IE 00000000 CCP2IF 00000000 CCP2M0 00000000 CCP2M1 00000001 CCP2M2 00000002 MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 24 SYMBOL TABLE LABEL VALUE CCP2M3 00000003 CCP2SEL 00000000 CCP2X 00000005 CCP2Y 00000004 CCPR1H 00000016 CCPR1L 00000015 CCPR2H 0000001C CCPR2L 0000001B CHS0 00000002 CHS1 00000003 CHS2 00000004 CHS3 00000005 CKE 00000006 CKP 00000004 CLeft 00000031 CPSCH0 00000000 CPSCH1 00000001 CPSCH2 00000002 CPSCH3 00000003 CPSCON0 00000108 CPSCON1 00000109 CPSON 00000007 CPSOUT 00000001 CPSRNG0 00000002 CPSRNG1 00000003 CREN 00000004 CRight 0000004D CSRC 00000007 CT45Don 00000277 ChkT45 0000026A D 00000005 DATA_ADDRESS 00000005 DC 00000001 DC1B0 00000004 DC1B1 00000005 DC2B0 00000004 DC2B1 00000005 DHrT12 00000001 DHrT24 00000002 DHrU12 00000002 DHrU24 00000004 DTLim45 00000037 DTilt 00000034 D_A 00000005 DigTim 0000000A DispHrT 00000042 DispHrU 00000043 DispLp 000001E5 DispLpN 000001FF DispTim 00000031 Display 00000030 DoAdv 0000016E DoSet 00000121 MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 25 SYMBOL TABLE LABEL VALUE DoTD 000000F5 DoTime 00000221 DoneS 00000167 DoneSet 00000007 DoneT 0000010B DoneTD 00000003 F 00000001 FERR 00000002 FHr12 00000001 FHr24 00000000 FSR 00000004 FVRCON 0000009D FVREN 00000006 FVRST 00000007 FirstHr 0000003F GIE 00000007 GO 00000001 GO_DONE 00000001 GetTilt 00000250 GotAdv 00000177 GotSet 0000012D GotTD 00000101 H24A 00000188 H24Got 0000018D H24No 0000018C H24S 00000143 H24Set 00000001 HangLp 000000DA HangTim 00000006 HrMinLp 000000BA Hrs24 00000007 HrsA 000001AB HrsS 0000014F HrsSet 00000002 HrsTim 0000001A I2C_DATA 00000005 I2C_READ 00000002 I2C_START 00000003 I2C_STOP 00000004 ICSL 00000003 ICSS 00000002 INDF 00000000 INTCON 0000000B INTE 00000004 INTEDG 00000006 INTF 00000001 IOC 00000096 IOC0 00000000 IOC1 00000001 IOC2 00000002 IOC3 00000003 IOC4 00000004 IOC5 00000005 MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 26 SYMBOL TABLE LABEL VALUE IOC6 00000006 IOC7 00000007 IOCB 00000096 IOCB0 00000000 IOCB1 00000001 IOCB2 00000002 IOCB3 00000003 IOCB4 00000004 IOCB5 00000005 IOCB6 00000006 IOCB7 00000007 IOCIE 00000003 IOCIF 00000000 IRCF0 00000004 IRCF1 00000005 IRP 00000007 IncHrs 000001D1 IsAdv 00000172 IsSet 00000128 IsTD 000000FC LBData 00000039 LBlank 00000002 LBlink 00000000 LCData 0000003A LDigit 00000028 LHrT12 00000001 LHrT24 00000002 LHrU12 00000003 LHrU24 00000004 LastHrT 00000040 LastHrU 00000041 LdDigs 0000001A LdHrs 00000014 LdMinD 0000000E LdMins 00000008 LdSecs 00000002 MinScLp 000000C3 MinTim 00000020 NOT_A 00000005 NOT_ADDRESS 00000005 NOT_BO 00000000 NOT_BOR 00000000 NOT_DONE 00000001 NOT_PD 00000003 NOT_POR 00000001 NOT_RBPU 00000007 NOT_RC8 00000006 NOT_T1SYNC 00000002 NOT_TO 00000004 NOT_TX8 00000006 NOT_W 00000002 NOT_WRITE 00000002 NoHBlnk 000000B3 MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 27 SYMBOL TABLE LABEL VALUE NoHWrap 000001DE NoHrC 000001E4 NoSet 0000016D NoTD 0000010E NotSet 00000000 NotTD 00000000 OERR 00000001 OPTION_REG 00000081 OSCCON 00000090 OSCTUNE 00000091 OffLoop 0000009A OffTim 000000C0 P 00000004 PCL 00000002 PCLATH 0000000A PCON 0000008E PEIE 00000006 PIE1 0000008C PIE2 0000008D PIR1 0000000C PIR2 0000000D PMADR 0000010D PMADRH 0000010F PMADRL 0000010D PMCON1 0000018C PMDATA 0000010C PMDATH 0000010E PMDATL 0000010C PMRD 00000000 PORTA 00000005 PORTB 00000006 PORTC 00000007 PORTE 00000009 PR2 00000092 PS0 00000000 PS1 00000001 PS2 00000002 PSA 00000003 PausTim 00000030 PwrBlnk 0000000C PwrDisp 00000004 PwrDown 000000D5 PwrOff 00000000 PwrTilt 00000008 R 00000002 RBData 0000003B RBIE 00000003 RBIF 00000000 RBlank 00000003 RBlink 00000001 RC8_9 00000006 RC9 00000006 RCD8 00000000 MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 28 SYMBOL TABLE LABEL VALUE RCData 0000003C RCIE 00000005 RCIF 00000005 RCREG 0000001A RCSTA 00000018 RD 00000000 RDigit 00000029 READ_WRITE 00000002 RP0 00000005 RP1 00000006 RX9 00000006 RX9D 00000000 R_W 00000002 S 00000003 SMP 00000007 SPBRG 00000099 SPEN 00000007 SREN 00000005 SSPADD 00000093 SSPBUF 00000013 SSPCON 00000014 SSPEN 00000005 SSPIE 00000003 SSPIF 00000003 SSPM0 00000000 SSPM1 00000001 SSPM2 00000002 SSPM3 00000003 SSPMSK 00000093 SSPOV 00000006 SSPSTAT 00000094 SSSEL 00000001 STATUS 00000003 SYNC 00000004 SecA 000001BC SecCnt 00000044 SecLp 000000C8 SecS 0000015B SecSet 00000005 SecTim 00000014 SetButt 00000004 SetDig 0000002A SetHist 0000002B SetHr12 00000193 SetHr24 0000019F SetLoop 0000010F SetTOut 00000040 SetTim 0000003D Start 0000005F T0CS 00000005 T0IE 00000005 T0IF 00000002 T0SE 00000004 MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 29 SYMBOL TABLE LABEL VALUE T0XCS 00000000 T1CKPS0 00000004 T1CKPS1 00000005 T1CON 00000010 T1GCON 0000008F T1GGO 00000003 T1GGO_DONE 00000003 T1GPOL 00000006 T1GSPM 00000004 T1GSS0 00000000 T1GSS1 00000001 T1GTM 00000005 T1GVAL 00000002 T1G_NOT_DONE 00000003 T1INSYNC 00000002 T1OSCEN 00000003 T1SYNC 00000002 T2CKPS0 00000000 T2CKPS1 00000001 T2CON 00000012 T45Set 00000006 TDDig 0000002D TDHist 0000002C TDLoop 000000DF TDTOut 0000000F TDTim 0000003E THrs 00000020 TMR0 00000001 TMR0IE 00000005 TMR0IF 00000002 TMR1CS0 00000006 TMR1CS1 00000007 TMR1GE 00000007 TMR1GIE 00000007 TMR1GIF 00000007 TMR1H 0000000F TMR1IE 00000000 TMR1IF 00000000 TMR1L 0000000E TMR1ON 00000000 TMR2 00000011 TMR2IE 00000001 TMR2IF 00000001 TMR2ON 00000002 TMinA 000001AE TMinD 00000026 TMinS 00000153 TMinSet 00000003 TMins 00000022 TOUTPS0 00000003 TOUTPS1 00000004 TOUTPS2 00000005 TOUTPS3 00000006 MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 30 SYMBOL TABLE LABEL VALUE TRISA 00000085 TRISB 00000086 TRISC 00000087 TRISE 00000089 TRMT 00000001 TSecs 00000024 TUN0 00000000 TUN1 00000001 TUN2 00000002 TUN3 00000003 TUN4 00000004 TUN5 00000005 TX8_9 00000006 TX9 00000006 TX9D 00000000 TXD8 00000000 TXEN 00000005 TXIE 00000004 TXIF 00000004 TXREG 00000019 TXSTA 00000098 Tilt45A 000001C1 Tilt45S 0000015F TiltTim 0000000E TiltX 00000001 TiltY 00000000 TimLeft 00000038 TimeNop 00000243 TimeRet 0000024D TltHist 0000002F UA 00000001 UHrs 00000021 UMinA 000001B5 UMinD 00000027 UMinS 00000157 UMinSet 00000004 UMins 00000023 USecs 00000025 W 00000000 WCOL 00000007 WPU0 00000000 WPU1 00000001 WPU2 00000002 WPU3 00000003 WPU4 00000004 WPU5 00000005 WPU6 00000006 WPU7 00000007 WPUB 00000095 WPUB0 00000000 WPUB1 00000001 WPUB2 00000002 WPUB3 00000003 MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 31 SYMBOL TABLE LABEL VALUE WPUB4 00000004 WPUB5 00000005 WPUB6 00000006 WPUB7 00000007 WaitOff 0000021C WtDigit 00000217 WtLoop1 00000219 WtOff1 0000021E XTDisp 00000001 XTLim45 00000035 XTMargin 000000FE XTilt 00000032 YTDisp 00000002 YTLim45 00000036 YTMargin 00000002 YTilt 00000033 Z 00000002 _BORV_1_9 00003FFF _BORV_2_5 00003BFF _BOR_NSLEEP 00003DFF _BOR_OFF 00003CFF _BOR_ON 00003FFF _CONFIG1 00002007 _CONFIG2 00002008 _CP_OFF 00003FFF _CP_ON 00003FBF _DEBUG_OFF 00003FFF _DEBUG_ON 00001FFF _EC_OSC 00003FFB _EXTRC 00003FFF _EXTRCIO 00003FFE _EXTRC_OSC_CLKOUT 00003FFF _EXTRC_OSC_NOCLKOUT 00003FFE _HS_OSC 00003FFA _INTOSC 00003FFD _INTOSCIO 00003FFC _INTRC_OSC_CLKOUT 00003FFD _INTRC_OSC_NOCLKOUT 00003FFC _LP_OSC 00003FF8 _MCLRE_OFF 00003FDF _MCLRE_ON 00003FFF _MCLR_DIS 00003FDF _MCLR_EN 00003FFF _PLL_DIS 00002FFF _PLL_EN 00003FFF _PWRTE_OFF 00003FFF _PWRTE_ON 00003FEF _PWRT_DIS 00003FFF _PWRT_EN 00003FEF _VCAP_DIS 00003FFF _VCAP_RA0 00003FCF _VCAP_RA5 00003FDF _VCAP_RA6 00003FEF MPASM 5.34 NWRF.ASM 2-15-2010 21:55:27 PAGE 32 SYMBOL TABLE LABEL VALUE _WDT_OFF 00003FF7 _WDT_ON 00003FFF _XT_OSC 00003FF9 __16LF722 00000001 MEMORY USAGE MAP ('X' = Used, '-' = Unused) 0000 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0080 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 00C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0100 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0140 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0180 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 01C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0200 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0240 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXX-------- All other memory blocks unused. Program Memory Words Used: 632 Program Memory Words Free: 1416 Errors : 0 Warnings : 0 reported, 0 suppressed Messages : 7 reported, 0 suppressed