The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

Measure Tilt Using PIC16F84A ADXL202 Author: Rodger Richey Microc


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



AN715
Measure Tilt Using PIC16F84A ADXL202
Author: Rodger Richey Microchip Technology Inc.
This application note will focus surface micromachined capacitive ADXL accelerometers from Analog Devices, particular ADXL202. example application will ADXL202 accelerometer with PIC16F84A tilt meter. PIC16F84A good match with ADXL202 because acceleration measurements digital only. Secondly, Data EEPROM used store calibration constants restore reset. external interface also changed easily accommodate display shown this application note) serial interface outside world.
INTRODUCTION
Recent advances accelerometer sensor technology, especially with silicon micromachined types, have driven cost these devices down significantly. today, could obtain accelerometer less than axis. Measurement acceleration derivative properties such vibration, shock, tilt become very commonplace wide range products. first might think seismic activity machinery performance monitoring, would automotive airbags, sports training products, computer peripherals ever cross your mind? technology behind acceleration sensors advanced provide very cost effective user friendly solution almost application. There many types sensors that measure acceleration, vibration, shock, tilt. These sensors include piezo-film, electromechanical servo, piezoelectric, liquid tilt, bulk micromachined piezo resistive capacitive sensors, well surface micromachined capacitive. Each these sensors distinct characteristics output signal sensor, cost develop, type operating environment. Measurement acceleration also provide velocity single integration position double integration. Vibration shock used machine health determination well motion shock detection alarms. Static acceleration gravity used determine tilt inclination provided that sensor responsive static acceleration.
MEMs SENSOR: THEORY OPERATION
recent years silicon micromachined sensor made tremendous advancements terms cost level on-chip integration acceleration and/or vibration measurements. implementing additional BiMOS circuitry on-chip, these products only provide sensor also signal conditioning single package that requires external components complete circuit. Some manufacturers have taken this approach step further converting analog output sensor digital format such duty cycle. This method only lifts burden designing fairly complex analog circuitry sensor also reduces cost board area. Because these advances, micromachined accelerometer finding into such products joysticks airbags that were previously impossible price size limitations sensor. Figure shows block diagram ADXL202.
1999 Microchip Technology Inc.
DS00715A-page
AN715
FIGURE ADXL202 BLOCK DIAGRAM
+3.0V +5.25V
XFilt Self Test
Sensor Demod Oscillator Demod Sensor
Rfilt Duty Cycle Modulator (DCM)
ADXL202
Rfilt
YFilt
Rset
surface micromachined device composed springs, masses motion sensing components. These sensors standard integrated circuit processing techniques standard wafer fabs, i.e., additional cost user special processes fabs. shown Figure normal processes take place applying layers oxide polysilicon. Then using photolithography selective etching sensor created 3-dimensional structure suspended above substrate free move directions. surrounding area becomes signal conditioning output circuitry.
FIGURE
SILICON STRUCTURE ADXL202 (SIDE VIEW)
SENSOR OXIDE SUBSTRATE
core sensor surface micromachined polysilicon structure mass that suspended silicon wafer each axis. polysilicon "springs" hold mass provides resistance movement acceleration forces. Both mass substrate have plates that form differential capacitor where fixed plates substrate driven 180° phase. Figure shows exaggerated diagram sensor. movement mass unbalances differential capacitor resulting square wave output with amplitude proportional acceleration. Each axis demodulator that rectifies signal determines direction acceleration. This output duty cycle modulator (DCM) that incorporates external capacitors bandwidth each axis. analog signal filtered converted duty cycle output DCM. external resistor sets period duty cycle output. acceleration produces duty cycle output. low-cost, digital, microcontroller used measure acceleration timing both duty cycle period each axis. Refer Figure interaction connections between various circuits inside device described above. Some advantages with micromachined sensors that they cost most have on-chip signal conditioning.
SENSOR
SUBSTRATE
DS00715A-page
1999 Microchip Technology Inc.
AN715
FIGURE SENSOR MECHANICAL OPERATION
VIEW
PROOF MASS (BEAM) TETHER
APPLIED ACCELERATION
CS1<CS2 FIXED OUTER PLATES ANCHOR
CONFIGURING ADXL202
application ADXL202 simple tilt meter that shows X-axis Y-axis tilt pitch roll aeronautical buffs). design procedure somewhat iterative since bandwidth, period, microcontroller counter resolution play important roles minimum resolution measurement. Analog Devices simplified design procedure providing Excel spreadsheet entitled "The XL202 Interactive Designer" that downloaded their website www.analog.com shown Appendix specifications system +5VDC operation, +/-1.0 degree tilt resolution, samples channel second, microcontroller should operate 4MHz less. Through iterative process, designer determine external component values noise resolution acceleration measurement without having prototype single circuit. Step spreadsheet shown Appendix designer will enter supply voltage which should between 3.0V 5.25V. will enter 5.0V. Analog bandwidth entered Step which calculates values external capacitors. bandwidth directly determines noise floor resolution accelerometer therefore have adjusted provide desired results based calculations later spreadsheet. Enter 10Hz resulting capacitance 0.50µF. Since 0.50µF standard, modify bandwidth standard value. Using 10.5Hz yields capacitor 0.47µF. Step spreadsheet calculates peak-to-peak (P-P) noise acceleration measurements. designer must estimate amount time that actual signal will above noise using multiplier. this step enter which turn reveals
that peak-to-peak noise will 0.46 degrees tilt. designer must evaluate noise estimation because this noise determines smallest acceleration resolution that accelerometer have. this noise estimation acceptable, then bandwidth must lowered reduce noise. This example well within degree specification will continue. next steps period duty cycle output measurement resolution counter microcontroller. Both sample rate channel percentage time ADXL202 will powered entered Step designer also enters time required calculate acceleration channels spreadsheet then calculates period duty cycle output corresponding external resistor. will samples second channel part will powered 100% time. Analog Devices already calculated time acquire channels perform calculations 20ms. this time, takes calculations based previous application note, leaving 17ms signal acquisition. This relates 17,000 instruction cycles PICmicro® running 4MHz. Step counter rate microcontroller used calculate measurement resolution counter degrees tilt. spreadsheet also determines size counter microcontroller prevent overflow. specifications, microcontroller clocked 4MHz resulting 1MHz timer frequency (Timer0). With this timer rate, resolution digital section ADXL202 0.06 degrees tilt. counter required acquire digital output must 15-bits. easily implement 15-bit counter using Timer0 byte count each Timer0 overflow increment upper byte counter. designer must again determine this
1999 Microchip Technology Inc.
DS00715A-page
AN715
resolution acceptable. increase resolution, either increase counter rate (Step decrease number samples second (Step Step checks aliasing errors sample rate. Nyquist requirements specify that sample rate needs faster than bandwidth factor Analog Devices recommends that least factor used minimize dynamic errors from sampling technique. case the, ratio 11.2 which according Nyquist Analog Devices more than sufficient. spreadsheet calculates that ratio low, designer must increase sample rate Step decrease bandwidth Step results spreadsheet calculates minimum resolution acceleration measurement noise resolution counter Step also provides minimum resolution tilt measurement. calculated minimum resolution degrees tilt which acceptable according specification. this resolution acceptable, then bandwidth (Step acquisition rate (Step counter rate (Step would have adjusted reduce noise. spreadsheet also offers designer ability explore oversampling signal affects noise expense sacrificing bandwidth Step Finally, Step provides estimated drift point temperature effects.
TILT METER APPLICATION
tilt meter application, value tilt X-axis Y-axis displayed 2-line 8-character matrix display. only other function push button switch perform simple calibration cycle. PIC16F84A makes ideal companion ADXL202 because calibration parameters sensor stored on-chip Data EEPROM memory retrieval usage later calculations. Using ADXL202 conjunction with PICmicro® only reduces time market product also overall system cost power consumption. Figure shows schematic simple tilt meter. convenience, battery used with LM78L05 regulator provide power circuit. ADXL202 configured shown ADXL202 Interactive Designer spreadsheet with 0.47µF capacitors XFILT YFILT pins. resistor 1.0625M called spreadsheet connect RSET pin. Since duty cycle generator's current source that determines frequency only accurate approximately 10%, resistor used. error between resistors will corrected measurement duty cycle output pins from ADXL202 XOUT YOUT connected respectively.
DS00715A-page
1999 Microchip Technology Inc.
FIGURE
TILT METER SCHEMATIC
0.1UF XFILT YFILT XOUT YOUT
1999 Microchip Technology Inc. DS00715A-page
0.47UF
0.47UF
ADXL202 1.0M
0.1UF OSC1 OSC2
0.1UF
RA4/T0CKI MCLR RB0/INT PIC16F84A
4MHz 33PF 33PF
78L05 VOUT
AN715
0.1UF Title
Microchip Technology Incorporated TILT SENSOR Size Document Number TILT.SCH Date: June 1999 Sheet
AN715
microcontroller circuit also very simple. 4MHz crystal uses 33pF capacitors complete oscillator circuit. push button switch connected RB4. This internal pull-up resistors reducing need external circuitry. display driven using 4-bit mode which only requires pins control pins data. Refer specifications Hitachi HD44780 controller application note, AN587, "Interfacing PICmicros® Module", more interface information. controls lines R/W, connect RB5, RA3, RA2. data lines connected RB<0:3>. There also potentiometer connected display control contrast. Acceleration vector quantity with both direction magnitude. acceleration vector broken into vectors ADXL202, X-axis Y-axis. ADXL202 responsive both static acceleration gravity well acceleration motion. main problem with using this type accelerometer measure degrees tilt that sensitive motion that can't distinguish between gravity motion. user must implement some type time weighted filter remove effects motion from measurement (not implemented this design). When tilt angle varied along sensitive Y-axis, acceleration vector changes ADXL202 responds changing duty cycle outputs. angle tilt defined following equation: arcsin[ (V(out)-V(zero Scale factor(V/g)) This difficult calculation 8-bit microcontroller, therefore calculation will simplified. spite this, still yield very good results (shown later firmware section). firmware centered around duty cycle measurement. technical note from Analog Devices titled "Using ADXL202 Duty Cycle Output" shows very efficient method measuring period duty cycle waveforms. Figure shows waveforms from XOUT YOUT. most obvious method measuring these waveforms measure time from rising edge falling edge next rising edge each waveforms. While very simple, this method takes complete cycles complete process. take closer look Figure will that high time XOUT YOUT centered about each other. this advantage. Figure shows waveform measurement points improved measurement scheme. counter started. program then records times looking points Figure that:
(counter
Since have already established that center aligned with center equation reduces
T1y/2 T1x/2 Tc)/2 Tb/2
This technique only reduces measurement time cycles, also only calculates once.
FIGURE
ADXL202 DUTY CYCLE OUTPUT
DS00715A-page
1999 Microchip Technology Inc.
AN715
FIGURE ADXL202 DUTY CYCLE MEASUREMENT
that system reading duty cycle outputs ADXL202 displaying results display, need consider system calibrated. first calibration step initial calibration tilt sensor with respect gravity. simplest method position system such that X-axis Y-axis both level. When instructed calibrate, PIC16F84A will calculate duty cycle output both axis period Several readings taken averaged improve accuracy measurements. These values stored both well EEPROM calibration constants. scale factor also used calibration process create n-bit result. These constants defined T2cal, value during calibration phase. must stored because vary over temperature jitter from measurement another. ZXcal, value during calibration phase. ZYcal, value during calibration phase. scale factor equal (T2cal bit_scale_factor) T2cal] needs calculated only once. Since each axis will this factor hard coded firmware. bit_scale_factor used determine size result. Since looking result degree tilt count), scale factor would 180. Therefore, assigned value 720. This simplification that mentioned earlier.
Once have calculated calibration constants apply them duty cycle measurements degree tilt. following formulas give degree tilt each axis:
ZXactual ZXcal T2actual T2cal ZYactual (ZYcal T2actual T2cal
T2actual current measurement This formula adjusts value changes temperature jitter.
XAcceleration (T1x ZXactual) T2actual YAcceleration (T1y ZYactual) T2actual
values current measurements each axis. results XAcceleration YAcceleration degrees tilt X-axis Y-axis directions properly scaled degree count. This method calibration very simple will suffer from small errors variance duty cycle (which assumed 12.5%) from part next.
1999 Microchip Technology Inc.
DS00715A-page
AN715
order math operations deliberate preserve accuracy result. math operations done fixed point math. Several variables used math operations. following table shows inputs each routine location result routine.
TABLE
Operation
MATH OPERATIONS VARIABLE USAGE
Operand ACCHI, ACCLO ACCHI, ACCLO ACCHI, ACCLO PRODW3, PRODW2, PRODW1, PRODW0 Operand ARGH, ARGL ARGH, ARGL ARGH, ARGL DIV1, DIV0 Result ACCHI, ACCLO ACCHI, ACCLO PRODW3, PRODW2, PRODW1, PRODW0 ANS1, ANS0
Addition Subtraction Multiply Divide
calculating Zactuals formula (2), multiply Zcal T2actual takes place first followed division result T2cal. When calculating tilt (really scaled acceleration) formulas (4), subtraction Zactual from takes place first, followed multiplication result finally division result T2actual. Finally, last pieces code display Data EEPROM access. code derivative that found application note, AN587, "Interfacing PICmicro® Microcontrollers Module". Most changes were related different pins used data control. Data EEPROM routines code directly from PIC16F84A data sheet DS35007 reads writes. WriteCal routine takes calibration constants writes them Data EEPROM. This routine only called when calibration cycle performed. RestoreCal routine called when PIC16F84A reset. calibration constants grouped sequentially memory that these routines indirect addressing shorten length code.
CONCLUSION
applications, type acceleration sensor depends system requirements well property being measured. Some accelerometers better suited towards measuring vibration shock such piezo-film piezoelectric. Others used tilt measurements such liquid tilt micromachined types. type sensor selected then dictates signal conditioning circuitry requirements. Some accelerometers have response, some Some sensors have analog outputs, others digital. other words, accelerometer does into applications. This application note shown that designer quickly easily complete accelerometer based design using ADXL sensors from Analog Devices. microcontroller further simplifies design giving designer more integrated, lower cost solution data measurement application.
DS00715A-page
1999 Microchip Technology Inc.
AN715
REFERENCES
Data Sheets ADXL202 Data Sheet, Analog Devices Inc., Rev. ADXL210 Data Sheet, Analog Devices Inc., Rev. Pr.A PIC16F84A Data Sheet, Microchip Technology Inc., DS35007A Technical Notes From Analog Devices
Using ADXL202 Duty Cycle Output Accelerometer Design Applications Compact Algorithm Using ADXL202 Duty Cycle Output Interactive Designer ADXL202
1999 Microchip Technology Inc.
DS00715A-page
APPENDIX ADXL202 INTERACTIVE DESIGNER
DS00715A-page 1999 Microchip Technology Inc.
AN715
XL202 Interactive Designer
Enter values below. When your design complete values your design will print this page.
XFilt
XFilt
Self Test
Self Test
Sensor
Sensor Demod
Rfilt
Demod Rfilt
Analog Analog Duty Duty Cycle Cycle (ADC)
Oscillator
Oscillator
ADXL202
ADXL202
Rfilt Rfilt
Demod Demod
(ADC)
Sensor Sensor
Parameters Supply voltage Analog Bandwidth Acquisition Rate Resolution (g's) Resolution (deg tilt) Microcontroller counter rate Power cycling Tmax Tmin Zero drift Tmax Zero drift Tmin
10.5 0.008 0.47 100% 0.02 0.02
readings second tilt time
YFilt
YFilt
Component Values Supply Decoupling Xcap, Ycap Rset
0.47 1062.5 kohm
Rset
Rset
will asked enter variety design parameters important your applications. This will include such issues fast signal need measure, what required update acquisition rate, what counter speed your microcontroller. After entering target values (inputs) spreadsheet will calculate outputs such resolution accelerometer. then iterate input values trade parameters necessary meet your design goals. Only enter values that bold.
1999 Microchip Technology Inc. DS00715A-page
Enter your nominal supply voltage XL202 will operate from 3.0V 5.25V. Enter your nominal supply voltage here.
What fastest signal want able observe? this step will determine bandwidth analog stage accelerometer. bandwidth generally determines noise floor thus resolution accelerometer. later section will also calculate digital noise sources from stage; combination these noise sources determines total noise floor. will measuring real world acceleration, such human vehicle motion. What part signal content important? signals transient, such shock impulse, want higher bandwidth. Human motion often measured 10Hz less. Don't forget consider filter delays that could result between stimulus response accelerometer, (dominated filter). Component values Xfilt Yfilt capacitor calculated below. will probably want iterate standard capacitor value. Enter desired Bandwidth Estimate noise peak peak noise accelerometer best indicator resolution accelerometer. Noise statistical process, best described measurement, (available datasheet). noise then estimated using statistical estimation. need select estimation. table below tells various noise multipliers, predict amount time actual signal will EXCEED estimated noise. lower multiplier, more likely that noise event will exceed limit. Enter multiplier Multiplier time signal will exceed estimate 32.00% 4.60% 0.27% 0.01% Iterate Look noise estimate; this noise limited resolution, (the smallest signal resolve). this acceptable your application? should consider adjusting bandwidth down reduce noise improve resolution. Calculated noise analog output Xfilt Yfilt Noise(rms) Xfilt, Yfilt 0.002 (max RMS) Noise( P-P) Xfilt, Yfilt 0.008 (max P-P) Noise(P-P) Xfilt, Yfilt 0.47 tilt (max P-P) Note: Noise level inversely proportional supply voltage Note Decrease Noise (increase resolution) decreasing 10.5 Value 0.47 Component Value!
17mg/deg tilt
AN715
DS00715A-page 1999 Microchip Technology Inc.
AN715
fast would like acquire signals? this section will begin design digital output, microcontroller interface. will input acquisition rate, i.e. many times second want reading from accelerometer. also asked long part should powered each second. Note that only want samples second, intend keep part powered time, then will need faster acquisition rate order reasonable values output. program requests that input time required multiplies divides calculate acceleration. 3.0ms time required Microchip 16C63 running Mhz. This section generates component value Rset resistor. Enter desired acquistion rate Each Channel second 100% Calculate Acquisition Time Maximum time available acquire channels Time required calculate channels Time left signal acquisition
time part will powered second
20.0 17.0 (two channels)
This implies requirement value period Thus, Value Rset 1062.5 kohm
This Sample Rate Component Value!
Enter counter rate your Microcontroller calculate resolution digital output. Section calculated resolution analog section. this section will calculate resolution digital output; fuction rate (calculated section counting rate your microcontroller. Please note that counting rate different, usually slower than microcontroller clock rate. output this calculation measure quantization error counter. some cases limit ultimate resolution; will explore this Counter Rate 17000 counts bits Resolution 1062.5 Counts Resolution 0.001 Quantization size Resolution 0.06 Tilt Based 17mg/deg tilt Note: Increase resolution increasing counter rate decreasing samples second
Note: will need counter size avoid overflowing counter
Check aliasing other errors sampling: cases sample rate (1/T2) needs faster than bandwidth analog section factor least order meet requirements Nyquist. Nyquist notwithstanding, ratio least recommend minimize dynamic errors that endemic sampling techniques. your ratio low, improve either increasing sample rate increasing acquistion rate section decreasing analog bandwidth section Ratio sample rate (1/T2) analog 11.2 Good!
1999 Microchip Technology Inc. DS00715A-page
Estimate total resolution (iterate meet design objective) position bring together various calculation above determine resolution complete analog digital design. ultimate resolution determined both noise analog output (Xcap Ycap) quantization size counter system. this point check total system resolution meets your requirements. does not, then revisit bandwidth Xfilt Yfilt, acquistion rate counting rate reduce noise. also want consider digital filtering, (oversampling) reduce noise expense sampling rate discussed next section. Noise analog section Resolution digital output- counter Estimated Total Noise (resolution): Estimated Total Noise (resolution): Noise (Resolution) limited 0.008 (max P-P) 0.001 0.008 tilt 17mg/deg Bandwidth Xfilt, Yfilt; reduce bandwidth This noise contribution analog output Xcap, Ycap This quantization noise digital output This total noise, which root square analog digital noise. lower noise desired (section
Option: Reduce noise oversampling expense bandwidth) Another design option digital filtering (averaging) order reduce noise, expense bandwidth. averaging several samples effect filtering signal. Implementing averages samples simple right shifts microcontroller code (very efficient). oversampling work, samples need taken rate faster than times analog bandwidth. Note: make sure oversampling sample don't want oversampling!
Estimated Noise (resolution) with average Note: Samples should taken about:
Samples 95.2381 apart
Noise before oversampling Noise after oversampling Bandwidth before oversampling Bandwidth after oversampling
0.008 0.008 10.5 10.5
Reduction
Estimated Drift Zero point estimate zero temperature shift entering your expected temperature range below estimate drift mg/C (from data sheet). Note that zero drift positive negative, general very linear. axis Yaxis drift uncorrelated. Drift from Value Drift Drift tilt 0.02 tilt 17mg/deg 0.02 tilt 17mg/deg
Drift degree Temp Temp
0.002
Tmax Tmin
AN715
AN715
APPENDIX TILT SENSOR FIRMWARE FLOWCHART
Start
Initialize
Xout
Display Message Restore Calibrator Constants Read Accel Check Accel T2calHi: T2calLo T2Hi: T2Lo Read Accel ZXcalHi: ZXcalLo T1XHi: T1XLo Find ZActual ZYcalHi: ZYcalLo T1YHi: T1YLo Write Data EEPROM Display Done Message Enable Timer0 Interrupts Xout Clear Timer0
Calculate Accel Display tilt Display Delay
Xout
Capture Timer0
Yout
Calibrate Reading X-Axis (ZXcal T2cal Calibrate Reading Y-Axis (ZYcal T2cal
Return
Yout
Calculate X-Axis Tilt (T1X ZXactual) T2actual
Capture Timer0 Start
Return
Calculate Y-Axis Tilt (T1Y ZYactual) T2actual Return
Yout
Capture Timer0 T1YEnd Calculate T1YEnd-T1YStart Calculate Return
DS00715A-page
1999 Microchip Technology Inc.
AN715
APPENDIX TILT MOTOR SOURCE CODE LISTING
00001 list p=16f84a 00002 include <p16f84a.inc> 00001 LIST 00002 P16F84A.INC Standard Header File,Version 2.00 Microchip Technology 00134 LIST 00003 2007 3FF1 00004 _config 00005 ;Assembled using MPASM V2.30 00006 ;PORTA defines 00007 #define XOUT 00008 #define YOUT 00009 #define 00010 #define 00011 00012 ;PORTB defines 00013 #define 00014 #define 00015 00016 00017 EQUATES 00018 00019 cblock 0x0c 0000000C 00020 T1XHi 0000000D 00021 T1XLo 0000000E 00022 ArgL 0000000F 00023 ArgH 00000010 00024 AccHi 00000011 00025 AccLo 00000012 00026 DivCnt 00000013 00027 PRODW3 00000014 00028 PRODW2 00000015 00029 PRODW1 00000016 00030 PRODW0 00000017 00031 DIV0 00000018 00032 DIV1 00000019 00033 ANS0 0000001A 00034 ANS1 0000001B 00035 T2Hi 0000001C 00036 T2Lo 0000001D 00037 T1YStartLo 0000001E 00038 T1YStartHi 0000001F 00039 T1YEndLo 00000020 00040 T1YEndHi 00000021 00041 T1YHi 00000022 00042 T1YLo 00000023 00043 ZXcalHi 00000024 00044 ZXcalLo 00000025 00045 ZYcalHi 00000026 00046 ZYcalLo 00000027 00047 T2calHi 00000028 00048 T2calLo 00000029 00049 ZXActualHi 0000002A 00050 ZXActualLo 0000002B 00051 ZYActualHi 0000002C 00052 ZYActualLo 0000002D 00053 XAccel 0000002E 00054 YAccel
1999 Microchip Technology Inc.
DS00715A-page
AN715
0000002F 00055 Temp0 00000030 00056 Temp1 00000031 00057 Temp2 00000032 00058 Temp3 00000033 00059 Timer0H 00000034 00060 EADR 00000035 00061 EDATA 00062 endc 00063 0000000E 00064 Count1 ArgL 0000000F 00065 Count2 ArgH 0000002F 00066 Temp Temp0 00000019 00067 ANS0 00000019 00068 LDATA 00000017 00069 Digit0 DIV0 00000018 00070 Digit1 DIV1 00071 00000002 00072 0x02 000000D0 00073 0xd0 00074 0000 00075 0x0000 0000 2808 00076 goto Start start program 00077 0004 00078 0x0004 0004 0AB3 00079 incf Timer0H,F 0005 110B 00080 INTCON,T0IF 0006 118B 00081 INTCON,RBIE 0007 0009 00082 retfie 00083 0008 00084 Start 0008 1283 00085 STATUS,RP0 0009 0185 00086 clrf PORTA 000A 0186 00087 clrf PORTB 000B 1683 00088 STATUS,RP0 ;Bank1 000C 3003 00089 movlw B'00000011' ;Set ports 000D 0085 00090 movwf TRISA 000E 3010 00091 movlw B'00010000' 000F 0086 00092 movwf TRISB 0010 300F 00093 movlw B'00001111' 0011 0081 00094 movwf OPTION_REG 0012 1283 00095 STATUS,RP0 ;Bank0 0013 21E1 00096 call OpenXLCD ;Initialize 0014 22C6 00097 call RestoreCal ;Restore calibration constants 0015 178B 00098 INTCON,GIE 00099 0016 00100 Main 0016 20F2 00101 call CheckCal ;Check need calibrate 0017 2020 00102 call ReadAccel ;Read acceleration 0018 2060 00103 call FindZActual ;Calibrate readings 0019 2085 00104 call CalculateAccel ;Calculate tilt (acceleration) 001A 2194 00105 call DisplayAccel ;Display results 001B 30FF 00106 movlw 0xff ;Delay while 001C 22A2 00107 call Delay_Ms_4MHz 001D 30FF 00108 movlw 0xff 001E 22A2 00109 call Delay_Ms_4MHz 001F 2816 00110 goto Main again 00111 00112 00113 00114 ;=========== Acceleration Measurement/Calculation Routines ==========
DS00715A-page
1999 Microchip Technology Inc.
AN715
00115 00116 00117 ;ReadAccel 00118 This subroutine acquires calculates T1X, T1Y, 00119 registers T1XHi,T1XLo 00120 registers T1YHi,T1YLo 00121 registers T2Hi,T2Lo 00122 0020 00123 ReadAccel 0020 00124 EDGE1 0020 1805 00125 btfsc PORTA,XOUT ;Wait XOUT 0021 2820 00126 goto EDGE1 0022 00127 EDGE2 0022 1C05 00128 btfss PORTA,XOUT ;Wait high XOUT 0023 2822 00129 goto EDGE2 0024 0181 00130 clrf TMR0 ;Clear Timer 0025 01B3 00131 clrf Timer0H 0026 110B 00132 INTCON,T0IF ;Enable Timer0 overflow interrupt 0027 168B 00133 INTCON,T0IE 0028 00134 EDGE3 0028 1805 00135 btfsc PORTA,XOUT ;Look falling edge XOUT 0029 2828 00136 goto EDGE3 002A 0801 00137 movf TMR0,W ;Save Timer0H:TMR0 002B 008D 00138 movwf T1XLo 002C 0833 00139 movf Timer0H,W 002D 008C 00140 movwf T1XHi 002E 00141 EDGE4 002E 1885 00142 btfsc PORTA,YOUT ;Look level YOUT 002F 282E 00143 goto EDGE4 0030 00144 EDGE5 0030 1C85 00145 btfss PORTA,YOUT ;Look rising edge YOUT 0031 2830 00146 goto EDGE5 0032 0801 00147 movf TMR0,W ;Save Timer0H:TMR0 start 0033 009D 00148 movwf T1YStartLo 0034 0833 00149 movf Timer0H,W 0035 009E 00150 movwf T1YStartHi 0036 00151 EDGE6 0036 1885 00152 btfsc PORTA,YOUT ;Look falling edge YOUT 0037 2836 00153 goto EDGE6 0038 0801 00154 movf TMR0,W ;Save Timer0H:TMR0 0039 009F 00155 movwf T1YEndLo 003A 0833 00156 movf Timer0H,W 003B 00A0 00157 movwf T1YEndHi 003C 128B 00158 INTCON,T0IE 00159 003D 0820 00160 movf T1YEndHi,W ;Calculate 003E 0090 00161 movwf AccHi 003F 081F 00162 movf T1YEndLo,W 0040 0091 00163 movwf AccLo 0041 081E 00164 movf T1YStartHi,W 0042 008F 00165 movwf ArgH 0043 081D 00166 movf T1YStartLo,W 0044 008E 00167 movwf ArgL 0045 210E 00168 call Sub16x16 0046 0810 00169 movf AccHi,W 0047 00A1 00170 movwf T1YHi 0048 0811 00171 movf AccLo,W 0049 00A2 00172 movwf T1YLo 004A 0820 00173 movf T1YEndHi,W ;CALCULATE 004B 0090 00174 movwf AccHi ;2*(T2Hi,T2Lo) (T1YEndHi:T1YEndLo)+
1999 Microchip Technology Inc.
DS00715A-page
AN715
004C 081F 00175 movf T1YEndLo,W 004D 0091 00176 movwf AccLo 004E 081E 00177 movf T1YStartHi,W 004F 008F 00178 movwf ArgH 0050 081D 00179 movf T1YStartLo,W 0051 008E 00180 movwf ArgL 0052 2107 00181 call Add16x16 0053 080C 00182 movf T1XHi,W (T1YStartHi:T1YStartLo) 0054 008F 00183 movwf ArgH 0055 080D 00184 movf T1XLo,W 0056 008E 00185 movwf ArgL 0057 210E 00186 call Sub16x16 ;ACCHI,ACCLO 2*T2 0058 1003 00187 STATUS,C 0059 0C90 00188 AccHi,F 005A 0C91 00189 AccLo,F 005B 0810 00190 movf AccHi,W 005C 009B 00191 movwf T2Hi 005D 0811 00192 movf AccLo,W 005E 009C 00193 movwf T2Lo 005F 0008 00194 return 00195 00196 00197 0060 00198 FindZActual 00199 This subroutine finds value ZActual 00200 axis. 00201 Output ZXActualHi ZXActualLo X-axis 00202 ZYActualHi ZXActualLo Y-axis. 00203 0060 00204 FindZActual 0060 0823 00205 movf ZXcalHi,W ;First X-axis 0061 0090 00206 movwf AccHi 0062 0824 00207 movf ZXcalLo,W 0063 0091 00208 movwf AccLo 0064 081B 00209 movf T2Hi,W 0065 008F 00210 movwf ArgH 0066 081C 00211 movf T2Lo,W 0067 008E 00212 movwf ArgL ;PRODW3,PRODW2,PRODW1,PRODW0 0068 211A 00213 call Mul16x16 0069 0827 00214 movf T2calHi,W 006A 0098 00215 movwf DIV1 006B 0828 00216 movf T2calLo,W 006C 0097 00217 movwf DIV0 006D 2165 00218 call Div32x16 ;ANS1,ANS0 (ZXcal T2cal 006E 081A 00219 movf ANS1,W 006F 00A9 00220 movwf ZXActualHi 0070 0819 00221 movf ANS0,W 0071 00AA 00222 movwf ZXActualLo 0072 0825 00223 movf ZYcalHi,W ;Same thing Y-axis 0073 0090 00224 movwf AccHi 0074 0826 00225 movf ZYcalLo,W 0075 0091 00226 movwf AccLo 0076 081B 00227 movf T2Hi,W 0077 008F 00228 movwf ArgH 0078 081C 00229 movf T2Lo,W 0079 008E 00230 movwf ArgL ;PRODW3,PRODW2,PRODW1,PRODW0 007A 211A 00231 call Mul16x16 007B 0827 00232 movf T2calHi,W 007C 0098 00233 movwf DIV1 007D 0828 00234 movf T2calLo,W
DS00715A-page
1999 Microchip Technology Inc.
AN715
007E 0097 00235 movwf DIV0 007F 2165 00236 call Div32x16 ;ANS1,ANS0 (ZYcal T2cal 0080 081A 00237 movf ANS1,W 0081 00AB 00238 movwf ZYActualHi 0082 0819 00239 movf ANS0,W 0083 00AC 00240 movwf ZYActualLo 0084 0008 00241 return 00242 00243 00244 00245 ;CalculateAccel 00246 This subroutine performs acceleration calculation 00247 each axis. formula 00248 ACCEL (T1-Zactual) T2actual] 00249 Output XAccel YAccel 00250 0085 00251 CalculateAccel 0085 0829 00252 movf ZXActualHi,W ;Check acceleration positive 0086 020C 00253 subwf T1XHi,W negative comparing 0087 1C03 00254 btfss STATUS,C ;T1X ZXactual 0088 28A5 00255 goto ;Jump ZXactual 0089 1D03 00256 btfss STATUS,Z ;Test T1XHI=ZX_ACTUAL_HI 008A 288F 00257 goto ;Jump ZXactual 008B 082A 00258 movf ZXActualLo,W 008C 020D 00259 subwf T1XLo,W 008D 1C03 00260 btfss STATUS,C 008E 28A5 00261 goto ;Jump ZXactual 008F 00262 008F 080C 00263 movf T1XHi,W ;T1X ZXactual 0090 0090 00264 movwf AccHi 0091 080D 00265 movf T1XLo,W 0092 0091 00266 movwf AccLo 0093 0829 00267 movf ZXActualHi,W 0094 008F 00268 movwf ArgH 0095 082A 00269 movf ZXActualLo,W 0096 008E 00270 movwf ArgL 0097 210E 00271 call Sub16x16 0098 3002 00272 movlw 0099 008F 00273 movwf ArgH 009A 30D0 00274 movlw 009B 008E 00275 movwf ArgL 009C 211A 00276 call Mul16x16 ;PRODW3,PRODW2,PRODW1,PRODW0 00277 (T1X ZXactual) 009D 081B 00278 movf T2Hi,W 009E 0098 00279 movwf DIV1 009F 081C 00280 movf T2Lo,W 00A0 0097 00281 movwf DIV0 00A1 2165 00282 call Div32x16 ;ANS1:ANS0= 00A2 0819 00283 movf ANS0,W [K*(T1X-ZXactual)]/T2actual 00A3 00AD 00284 movwf XAccel ;The result will signed 8-bit 00A4 28BB 00285 goto DoYCalc 00A5 00286 00A5 0829 00287 movf ZXActualHi,W ;ZXactual 00A6 0090 00288 movwf AccHi 00A7 082A 00289 movf ZXActualLo,W 00A8 0091 00290 movwf AccLo 00A9 080C 00291 movf T1XHi,W 00AA 008F 00292 movwf ArgH 00AB 080D 00293 movf T1XLo,W 00AC 008E 00294 movwf ArgL
1999 Microchip Technology Inc.
DS00715A-page
AN715
00AD 210E 00295 call Sub16x16 00AE 3002 00296 movlw 00AF 008F 00297 movwf ArgH 00B0 30D0 00298 movlw 00B1 008E 00299 movwf ArgL 00B2 211A 00300 call Mul16x16 ;PRODW3,PRODW2,PRODW1,PRODW0 00301 (ZXactual T1X) 00B3 081B 00302 movf T2Hi,W 00B4 0098 00303 movwf DIV1 00B5 081C 00304 movf T2Lo,W 00B6 0097 00305 movwf DIV0 00B7 2165 00306 call Div32x16 ;ANS1,ANS0 00B8 0919 00307 comf ANS0,W [K*(ZXactual-T1X)]/T2actual 00B9 3E01 00308 addlw 0x01 ;The result will signed 8-bit 00BA 00AD 00309 movwf XAccel 00BB 00310 DoYCalc 00BB 082B 00311 movf ZYActualHi,W ;Check acceleration positive 00BC 0221 00312 subwf T1YHi,W negative comparing 00BD 1C03 00313 btfss STATUS,C ;T1Y ZYactual 00BE 28DB 00314 goto ;Jump ZYactual 00BF 1D03 00315 btfss STATUS,Z ;Test T1YHI=ZY_ACTUAL_HI 00C0 28C5 00316 goto ;Jump ZYactual 00C1 082C 00317 movf ZYActualLo,W 00C2 0222 00318 subwf T1YLo,W 00C3 1C03 00319 btfss STATUS,C 00C4 28DB 00320 goto ;Jump ZYactual 00C5 00321 00C5 0821 00322 movf T1YHi,W ;T1Y ZYactual 00C6 0090 00323 movwf AccHi 00C7 0822 00324 movf T1YLo,W 00C8 0091 00325 movwf AccLo 00C9 082B 00326 movf ZYActualHi,W 00CA 008F 00327 movwf ArgH 00CB 082C 00328 movf ZYActualLo,W 00CC 008E 00329 movwf ArgL 00CD 210E 00330 call Sub16x16 00CE 3002 00331 movlw 00CF 008F 00332 movwf ArgH 00D0 30D0 00333 movlw 00D1 008E 00334 movwf ArgL 00D2 211A 00335 call Mul16x16 ;PRODW3,PRODW2,PRODW1,PRODW0 00336 (T1Y ZYactual) 00D3 081B 00337 movf T2Hi,W 00D4 0098 00338 movwf DIV1 00D5 081C 00339 movf T2Lo,W 00D6 0097 00340 movwf DIV0 00D7 2165 00341 call Div32x16 ;ANS1,ANS0 00D8 0819 00342 movf ANS0,W [K*(T1Y-ZYactual)]/T2actual 00D9 00AE 00343 movwf YAccel ;The result will signed 8-bit 00DA 0008 00344 return 00DB 00345 00DB 082B 00346 movf ZYActualHi,W ;ZYactual 00DC 0090 00347 movwf AccHi 00DD 082C 00348 movf ZYActualLo,W 00DE 0091 00349 movwf AccLo 00DF 0821 00350 movf T1YHi,W 00E0 008F 00351 movwf ArgH 00E1 0822 00352 movf T1YLo,W 00E2 008E 00353 movwf ArgL 00E3 210E 00354 call Sub16x16
DS00715A-page
1999 Microchip Technology Inc.
AN715
00E4 3002 00355 movlw 00E5 008F 00356 movwf ArgH 00E6 30D0 00357 movlw 00E7 008E 00358 movwf ArgL 00E8 211A 00359 call Mul16x16 ;PRODW3,PRODW2,PRODW1,PRODW0 00360 (ZYactual T1Y) 00E9 081B 00361 movf T2Hi,W 00EA 0098 00362 movwf DIV1 00EB 081C 00363 movf T2Lo,W 00EC 0097 00364 movwf DIV0 00ED 2165 00365 call Div32x16 ;ANS1,ANS0 00EE 0919 00366 comf ANS0,W ;[K*(ZYactual-T1Y)]/T2actual 00EF 3E01 00367 addlw 0x01 ;The result will signed 8-bit 00F0 00AE 00368 movwf YAccel 00F1 0008 00369 return 00370 00371 00372 00373 ;CheckCal 00374 This subroutine reads pushbutton switch (RB4) 00375 low, performs simple calibration routine. 00376 00F2 00377 CheckCal 00F2 1A06 00378 btfsc PORTB,CAL low? 00F3 0008 00379 return then exit routine 00F4 2276 00380 call DisplayCal 00F5 2020 00381 call ReadAccel then perform read cycle 00F6 081B 00382 movf T2Hi,W ;Save measured values 00F7 00A7 00383 movwf T2calHi ;calibration registers 00F8 081C 00384 movf T2Lo,W 00F9 00A8 00385 movwf T2calLo 00FA 080C 00386 movf T1XHi,W 00FB 00A3 00387 movwf ZXcalHi 00FC 080D 00388 movf T1XLo,W 00FD 00A4 00389 movwf ZXcalLo 00FE 0821 00390 movf T1YHi,W 00FF 00A5 00391 movwf ZYcalHi 0100 0822 00392 movf T1YLo,W 0101 00A6 00393 movwf ZYcalLo 0102 22B9 00394 call WriteCal ;Write calibration data EEPROM 0103 2292 00395 call DisplayDone ;Write message display 0104 00396 CCLoop 0104 1E06 00397 btfss PORTB,CAL ;Wait pushbutton switch 0105 2904 00398 goto CCLoop ;released 0106 0008 00399 return 00400 00401 00402 00403 00404 ;=================== Mathematical Operations ======================== 00405 00406 00407 ;Add16x16 00408 This subroutine performs 16-bit 16-bit addition. 00409 Note that this routine does check possible overflow 00410 results i.e., 17-bit sum. 00411 Inputs AccHi:AccLo ArgH:ArgL 00412 Result AccHi:AccLo 00413 (AccHi:AccLo) (AccHi:AccLo)+(ArgH:ArgL) 00414
1999 Microchip Technology Inc.
DS00715A-page
AN715
0107 00415 Add16x16 0107 080E 00416 movf ArgL,W ;Add bytes together 0108 0791 00417 addwf AccLo,F 0109 1803 00418 btfsc STATUS,C ;Check carry addtion 010A 0A90 00419 incf AccHi,F yes, increment AccHi 010B 080F 00420 movf ArgH,W ;Add high bytes together 010C 0790 00421 addwf AccHi,F 010D 0008 00422 return 00423 00424 00425 ;Sub16x16 00426 This subroutine performs 16-bit 16-bit subtraction. 00427 Inputs AccHi:AccLo ArgH:ArgL 00428 Result AccHi:AccLo 00429 (AccHi:AccLo) (AccHi:AccLo)-(ArgH:ArgL) 00430 010E 00431 Sub16x16 010E 098E 00432 comf ArgL,F ;2's complement ArgH:ArgL 010F 0A8E 00433 incf ArgL,F 0110 1903 00434 btfsc STATUS,2 0111 038F 00435 decf ArgH,F 0112 098F 00436 comf ArgH,F 0113 080E 00437 movf ArgL,W ;Now perform 16-bit addition 0114 0791 00438 addwf AccLo,F 0115 1803 00439 btfsc STATUS,W 0116 0A90 00440 incf AccHi,F 0117 080F 00441 movf ArgH,W 0118 0790 00442 addwf AccHi,F 0119 0008 00443 return 00444 00445 00446 ;Mul16x16 00447 This subroutine performs 16-bit 16-bit multiplication. 00448 produces 32-bit number. Multiplication checked 00449 performed correctly, 00450 Inputs (AccHi:AccLo) (ArgH:ArgL) 00451 Output (PRODW3:PRODW2:PRODW1:PRODW0) 00452 (PRODW3:PRODW2:PRODW1:PRODW0) (AccHi:AccLo) (Argh:ArgL) 00453 011A 00454 Mul16x16 011A 01AF 00455 clrf Temp0 ;Clear temporary variables used 011B 01B0 00456 clrf Temp1 this routine 011C 01B1 00457 clrf Temp2 011D 01B2 00458 clrf Temp3 011E 0196 00459 clrf PRODW0 011F 0195 00460 clrf PRODW1 0120 0194 00461 clrf PRODW2 0121 0193 00462 clrf PRODW3 0122 0811 00463 movf AccLo,W 0123 00AF 00464 movwf Temp0 ;Move contents AccHi:AccLo 0124 0810 00465 movf AccHi,W ;into Temp1:Temp0 0125 00B0 00466 movwf Temp1 0126 0890 00467 movf AccHi,F ;Test AccHi:AccLo 0000 0127 1D03 00468 btfss STATUS,Z 0128 292C 00469 goto CheckNext ;AccHi:AccLo zero 0129 0891 00470 movf AccLo,F 012A 1903 00471 btfsc STATUS,Z 012B 2960 00472 goto Equal0 ;AccHi:AccLo 0000 012C 00473 CheckNext 012C 088F 00474 movf ArgH,F ;Test ArgH:ArgL 0000
DS00715A-page
1999 Microchip Technology Inc.
AN715
012D 1D03 00475 btfss STATUS,Z 012E 2932 00476 goto DoMultiply ;ArgH:ArgL zero 012F 088E 00477 movf ArgL,F 0130 1903 00478 btfsc STATUS,Z 0131 2960 00479 goto Equal0 ;ArgH:ArgL 0000 0132 00480 DoMultiply 0132 088F 00481 movf ArgH,F ;Test ArgH:ArgL been reduced 0133 1D03 00482 btfss STATUS,Z 0134 2938 00483 goto TestLSB ;ArgH:ArgL been reduced 0135 088E 00484 movf ArgL,F 0136 1903 00485 btfsc STATUS,Z 0137 0008 00486 return ;ArgH:ArgL been reduced zero 00487 multiplication isdone 0138 00488 TestLSB 0138 1003 00489 STATUS,C ;Shift ArgH:ArgL right 0139 0C8F 00490 ArgH,F 013A 0C8E 00491 ArgL,F 013B 1C03 00492 btfss STATUS,C ArgH:ArgL 013C 295A 00493 goto DoShift ;Jump 013D 082F 00494 movf Temp0,W then 013E 0796 00495 addwf PRODW0,F ;PRODW3:PRODW2:PRODW1:PRODW0 013F 1C03 00496 btfss STATUS,C ;PRODW3:PRODW2:PRODW1:PRODW0 0140 294A 00497 goto ADD2 ;Temp3:Temp2:Temp1:Temp0 0141 3001 00498 movlw 0x01 ;Add carry necessary 0142 0795 00499 addwf PRODW1,F 0143 1C03 00500 btfss STATUS,C 0144 294A 00501 goto ADD2 0145 3001 00502 movlw 0x01 ;Add carry PRODW1 overflows 0146 0794 00503 addwf PRODW2,F result addition 0147 1C03 00504 btfss STATUS,C ;previous carry 0148 294A 00505 goto ADD2 0149 0A93 00506 incf PRODW3,F 014A 00507 ADD2 014A 0830 00508 movf Temp1,W 014B 0795 00509 addwf PRODW1,F 014C 1C03 00510 btfss STATUS,C 014D 2953 00511 goto ADD3 014E 3001 00512 movlw 0x01 014F 0794 00513 addwf PRODW2,F 0150 1C03 00514 btfss STATUS,C 0151 2953 00515 goto ADD3 0152 0A93 00516 incf PRODW3,F 0153 00517 ADD3 0153 0831 00518 movf Temp2,W 0154 0794 00519 addwf PRODW2,F 0155 1C03 00520 btfss STATUS,C 0156 2958 00521 goto ADD4 0157 0A93 00522 incf PRODW3,F 0158 00523 ADD4 0158 0832 00524 movf Temp3,W 0159 0793 00525 addwf PRODW3,F 015A 00526 DoShift 015A 1003 00527 STATUS,C ;Shift temp registers left 015B 0DAF 00528 Temp0,F 015C 0DB0 00529 Temp1,F 015D 0DB1 00530 Temp2,F 015E 0DB2 00531 Temp3,F 015F 2932 00532 goto DoMultiply 0160 00533 Equal0 0160 0196 00534 clrf PRODW0 ;Since arguement equals zero
1999 Microchip Technology Inc.
DS00715A-page
AN715
0161 0195 00535 clrf PRODW1 ;PRODW3,PRODW2,PRODW1,PRODW0 0162 0194 00536 clrf PRODW2 0163 0193 00537 clrf PRODW3 0164 0008 00538 return 00539 00540 00541 ;Div32x16 00542 This subroutine performs 32-bit 16-bit division. 00543 Division performed binary long division. 00544 Inputs (PRODW3:PRODW2:PRODW1:PRODW0) (DIV1:DIV0). 00545 Output (ANS1:ANS0) 00546 (ANS1:ANS0) (PRODW3:PRODW2:PRODW1:PRODW0) (DIV1:DIV0) 00547 0165 00548 Div32x16 0165 019A 00549 clrf ANS1 ;Clear result registers 0166 0199 00550 clrf ANS0 0167 3011 00551 movlw 0x11 ;DivCnt 0168 0092 00552 movwf DivCnt 0169 00553 0169 0818 00554 movf DIV1,W 016A 0213 00555 subwf PRODW3,W DIV1 PRODW3 016B 1C03 00556 btfss STATUS,C 016C 2973 00557 goto NoSub ;Jump DIV1 PRODW3 016D 1D03 00558 btfss STATUS,2 DIV1 PRODW3 016E 297C 00559 goto DoSubs ;Jump DIV1 PRODW3 016F 0817 00560 movf DIV0,W DIV0 PRODW2 0170 0214 00561 subwf PRODW2,W 0171 1803 00562 btfsc STATUS,C 0172 297C 00563 goto DoSubs ;Jump DIV0 PRODW2 0173 00564 NoSub 0173 1003 00565 STATUS,C ;Clear carry 0174 0D99 00566 ANS0,F ;Add ANS1,ANS0 0175 0D9A 00567 ANS1,F 0176 1003 00568 STATUS,C ;Clear carry 0177 0D96 00569 PRODW0,F ;Shift PRODW3,2,1,0 left 0178 0D95 00570 PRODW1,F 0179 0D94 00571 PRODW2,F 017A 0D93 00572 PRODW3,F 017B 2991 00573 goto ChkCnt 017C 00574 DoSubs 017C 0813 00575 movf PRODW3,W 017D 0090 00576 movwf AccHi 017E 0814 00577 movf PRODW2,W 017F 0091 00578 movwf AccLo 0180 0818 00579 movf DIV1,W 0181 008F 00580 movwf ArgH 0182 0817 00581 movf DIV0,W 0183 008E 00582 movwf ArgL 0184 210E 00583 call Sub16x16 ;(PRODW3:2) (PRODW3:2)-(DIV1:0) 0185 0810 00584 movf AccHi,W 0186 0093 00585 movwf PRODW3 0187 0811 00586 movf AccLo,W 0188 0094 00587 movwf PRODW2 0189 1403 00588 STATUS,C 018A 0D99 00589 ANS0,F 018B 0D9A 00590 ANS1,F ;Add ANS1:ANS0 018C 1003 00591 STATUS,C 018D 0D96 00592 PRODW0,F ;Shift PRODW3,2,1,0, left 018E 0D95 00593 PRODW1,F 018F 0D94 00594 PRODW2,F
DS00715A-page
1999 Microchip Technology Inc.
AN715
0190 0D93 00595 PRODW3,F 0191 00596 ChkCnt 0191 0B92 00597 decfsz DivCnt,F ;Check operations 0192 2969 00598 goto then loop 0193 0008 00599 return 00600 00601 00602 00603 00604 ;====================== Display Routines ============================ 00605 00606 00607 ;DisplayAccel 00608 This subroutine takes values XAccel YAccel 00609 displays ASCII equivalent display. 00610 0194 00611 DisplayAccel 0194 223E 00612 call BusyXLCD ;Wait busy 0195 3001 00613 movlw 0x01 ;Reset cursor home position 0196 221C 00614 call WriteCmdXLCD line 00615 0197 1FAD 00616 btfss XAccel,7 ;Check XAccel negative 0198 29A0 00617 goto XSpace 0199 223E 00618 call BusyXLCD negative 019A 302D 00619 movlw ;Print display 019B 2254 00620 call WriteDataXLCD 019C 092D 00621 comf XAccel,W ;2's complement XAccel 019D 3E01 00622 addlw 0x01 019E 00AD 00623 movwf XAccel 019F 29A3 00624 goto DispX 01A0 00625 XSpace ;Not negative 01A0 223E 00626 call BusyXLCD 01A1 3020 00627 movlw ;Print space display 01A2 2254 00628 call WriteDataXLCD 01A3 00629 DispX 01A3 082D 00630 movf XAccel,W ;Convert XAccel 2-digit ASCII 01A4 22AC 00631 call Bin2Ascii 01A5 223E 00632 call BusyXLCD 01A6 0818 00633 movf Digit1,W ;Write upper digit 01A7 2254 00634 call WriteDataXLCD 01A8 223E 00635 call BusyXLCD 01A9 0817 00636 movf Digit0,W ;Write lower digit 01AA 2254 00637 call WriteDataXLCD 01AB 223E 00638 call BusyXLCD 01AC 30DF 00639 movlw 0xdf ;Write degrees symbol 01AD 2254 00640 call WriteDataXLCD 01AE 223E 00641 call BusyXLCD 01AF 3020 00642 movlw ;Write Pit" 01B0 2254 00643 call WriteDataXLCD ;for word pitch which refers 01B1 223E 00644 call BusyXLCD X-axis 01B2 3050 00645 movlw 01B3 2254 00646 call WriteDataXLCD 01B4 223E 00647 call BusyXLCD 01B5 3069 00648 movlw 01B6 2254 00649 call WriteDataXLCD 01B7 223E 00650 call BusyXLCD 01B8 3074 00651 movlw 01B9 2254 00652 call WriteDataXLCD 01BA 223E 00653 call BusyXLCD 01BB 30A8 00654 movlw 0xa8 ;Change cursor position home
1999 Microchip Technology Inc.
DS00715A-page
AN715
01BC 221C 00655 call WriteCmdXLCD line 00656 01BD 1FAE 00657 btfss YAccel,7 ;Check YAccel negative 01BE 29C6 00658 goto YSpace 01BF 223E 00659 call BusyXLCD negative 01C0 302D 00660 movlw ;Print display 01C1 2254 00661 call WriteDataXLCD 01C2 092E 00662 comf YAccel,W ;2's complement YAccel 01C3 3E01 00663 addlw 0x01 01C4 00AE 00664 movwf YAccel 01C5 29C9 00665 goto DispY 01C6 00666 YSpace ;Not negative 01C6 223E 00667 call BusyXLCD 01C7 3020 00668 movlw ;Print space display 01C8 2254 00669 call WriteDataXLCD 01C9 00670 DispY 01C9 082E 00671 movf YAccel,W ;Convert YAccel 2-digit ASCII 01CA 22AC 00672 call Bin2Ascii 01CB 223E 00673 call BusyXLCD 01CC 0818 00674 movf Digit1,W ;Write upper digit 01CD 2254 00675 call WriteDataXLCD 01CE 223E 00676 call BusyXLCD 01CF 0817 00677 movf Digit0,W ;Write lower digit 01D0 2254 00678 call WriteDataXLCD 01D1 223E 00679 call BusyXLCD 01D2 30DF 00680 movlw 0xdf ;Write degrees symbol 01D3 2254 00681 call WriteDataXLCD 01D4 223E 00682 call BusyXLCD 01D5 3020 00683 movlw ;Write Rol" 01D6 2254 00684 call WriteDataXLCD ;for word roll which refers 01D7 223E 00685 call BusyXLCD Y-axis 01D8 3052 00686 movlw 01D9 2254 00687 call WriteDataXLCD 01DA 223E 00688 call BusyXLCD 01DB 306F 00689 movlw 01DC 2254 00690 call WriteDataXLCD 01DD 223E 00691 call BusyXLCD 01DE 306C 00692 movlw 01DF 2254 00693 call WriteDataXLCD 01E0 0008 00694 return 00695 00696 00697 ;OpenXLCD 00698 This subroutine initializes display. 00699 cleared blank upon exit this routine 00700 01E1 00701 OpenXLCD 01E1 301E 00702 movlw 0x1e ;Delay 01E2 22A2 00703 call Delay_Ms_4MHz 00704 01E3 30F0 00705 movlw 0xf0 ;Write upper byte configuration 01E4 1683 00706 STATUS,RP0 ;value three times 01E5 0586 00707 andwf TRISB,F ;After this read 01E6 1283 00708 STATUS,RP0 01E7 0586 00709 andwf PORTB,F 01E8 3003 00710 movlw 0x03 01E9 0486 00711 iorwf PORTB,F ;Output data port, 8-bit mode 01EA 1505 00712 PORTA,E ;Clock data 01EB 0000 00713 01EC 1105 00714 PORTA,E
DS00715A-page
1999 Microchip Technology Inc.
AN715
00715 01ED 300A 00716 01EE 22A2 00717 00718 01EF 30F0 00719 01F0 0586 00720 01F1 3003 00721 01F2 0486 00722 01F3 1505 00723 01F4 0000 00724 01F5 1105 00725 00726 01F6 300A 00727 01F7 22A2 00728 00729 01F8 30F0 00730 01F9 0586 00731 01FA 3003 00732 01FB 0486 00733 01FC 1505 00734 01FD 0000 00735 01FE 1105 00736 00737 01FF 30F0 00738 0200 0586 00739 0201 1486 00740 0202 1505 00741 0203 0000 00742 0204 1105 00743 00744 0205 300F 00745 0206 1683 00746 0207 0486 00747 0208 1283 00748 00749 0209 223E 00750 020A 302F 00751 020B 221C 00752 00753 020C 223E 00754 020D 3008 00755 020E 221C 00756 00757 020F 223E 00758 0210 300F 00759 0211 221C 00760 00761 0212 223E 00762 0213 3001 00763 0214 221C 00764 00765 0215 223E 00766 0216 3013 00767 0217 221C 00768 00769 0218 223E 00770 0219 3080 00771 021A 221C 00772 021B 0008 00773 00774 movlw 0x0a ;Wait ~5ms call Delay_Ms_4MHz movlw 0xf0 andwf PORTB,F movlw 0x03 iorwf PORTB,F PORTA,E PORTA,E
;Output data port, 8-bit mode ;Clock data
movlw 0x0a ;Wait ~5ms call Delay_Ms_4MHz movlw 0xf0 andwf PORTB,F movlw 0x03 iorwf PORTB,F PORTA,E PORTA,E movlw 0xf0 andwf PORTB,F PORTB,1 PORTA,E PORTA,E movlw 0x0f STATUS,RP0 iorwf TRISB,F STATUS,RP0 call BusyXLCD ;Function Set: 4-bit mode, lines, movlw 0x2f ;5x8 dots call WriteCmdXLCD call BusyXLCD ;Display Cntrl: display, cursor movlw 0x08 call WriteCmdXLCD call BusyXLCD ;Display Cntrl: display cursor movlw 0x0f ;blinking call WriteCmdXLCD call BusyXLCD ;Clear Display movlw 0x01 call WriteCmdXLCD call BusyXLCD ;Shift Cntrl: cursor moves left movlw 0x13 call WriteCmdXLCD call BusyXLCD ;Set DDRAM address movlw 0x80 call WriteCmdXLCD return
;Output data port, 8-bit mode ;Clock data
;Output data port, 4-bit mode
1999 Microchip Technology Inc.
DS00715A-page
AN715
00775 00776 00777 ;WriteCmdXLCD 00778 This subroutine writes command display using 00779 4-bit interface. 00780 021C 00781 WriteCmdXLCD 021C 1283 00782 STATUS,RP0 021D 0099 00783 movwf ;Save command WREG 021E 30F0 00784 movlw 0xf0 ;Setup data port write 021F 1683 00785 STATUS,RP0 0220 0586 00786 andwf TRISB,F 0221 1283 00787 STATUS,RP0 0222 0586 00788 andwf PORTB,F 0223 0819 00789 movf CMD,W ;Write upper 4-bits data port 0224 00AF 00790 movwf Temp 0225 0EAF 00791 swapf Temp,F 0226 300F 00792 movlw 0x0f 0227 052F 00793 andwf Temp,W 0228 390F 00794 andlw 0x0f 0229 0486 00795 iorwf PORTB,F 022A 1185 00796 PORTA,RW ;Set control bits write 022B 1286 00797 PORTB,RS ;and command 022C 0000 00798 022D 1505 00799 PORTA,E ;Clock upper nibble 022E 0000 00800 022F 1105 00801 PORTA,E 0230 30F0 00802 movlw 0xf0 0231 0586 00803 andwf PORTB,F 0232 300F 00804 movlw 0x0f 0233 0519 00805 andwf CMD,W ;Output lower 4-bits data port 0234 0486 00806 iorwf PORTB,F 0235 0000 00807 0236 1505 00808 PORTA,E ;Clock lower nibble 0237 0000 00809 0238 1105 00810 PORTA,E 0239 300F 00811 movlw 0x0f 023A 1683 00812 STATUS,RP0 023B 0486 00813 iorwf TRISB,F 023C 1283 00814 STATUS,RP0 023D 0008 00815 return 00816 00817 00818 00819 ;BusyXLCD 00820 This subroutine monitors busy from display 00821 returns when longer busy. 00822 023E 00823 BusyXLCD 023E 1283 00824 STATUS,RP0 023F 1585 00825 PORTA,RW ;Set read 0240 1286 00826 PORTB,RS ;Read busy bit/address 0241 0000 00827 0242 1505 00828 PORTA,E ;Clock data 0243 0000 00829 0244 1D86 00830 btfss PORTB,3 ;Read busy 0245 2A4D 00831 goto BNHI 0246 1105 00832 PORTA,E ;Still busy 0247 0000 00833 0248 1505 00834 PORTA,E ;Clock lower nibble
DS00715A-page
1999 Microchip Technology Inc.
AN715
0249 0000 00835 024A 1105 00836 PORTA,E 024B 1185 00837 PORTA,RW 024C 2A3E 00838 goto BusyXLCD ;Try again 024D 00839 BNHI 024D 1105 00840 PORTA,E ;LCD busy 024E 0000 00841 024F 1505 00842 PORTA,E ;Clock lower nibble 0250 0000 00843 0251 1105 00844 PORTA,E 0252 1185 00845 PORTA,RW 0253 0008 00846 return 00847 00848 00849 00850 ;WriteDataXLCD 00851 This subroutine writes byte data display 00852 using 4-bit interface. 00853 0254 00854 WriteDataXLCD 0254 1283 00855 STATUS,RP0 0255 0099 00856 movwf LDATA ;Save data LDATA 0256 30F0 00857 movlw 0xf0 ;Setup data port 0257 1683 00858 STATUS,RP0 0258 0586 00859 andwf TRISB,F 0259 1283 00860 STATUS,RP0 025A 0586 00861 andwf PORTB,F 025B 0819 00862 movf LDATA,W ;Write upper nibble data 025C 00AF 00863 movwf Temp data port 025D 0EAF 00864 swapf Temp,F 025E 300F 00865 movlw 0x0f 025F 052F 00866 andwf Temp,W 0260 390F 00867 andlw 0x0f 0261 0486 00868 iorwf PORTB,F 0262 1686 00869 PORTB,RS ;Set control signals write 0263 1185 00870 PORTA,RW data registers 0264 0000 00871 0265 1505 00872 PORTA,E ;Clock upper nibble 0266 0000 00873 0267 1105 00874 PORTA,E 0268 30F0 00875 movlw 0xf0 0269 0586 00876 andwf PORTB,F 026A 300F 00877 movlw 0x0f 026B 0519 00878 andwf LDATA,W ;Write lower nibble data port 026C 0486 00879 iorwf PORTB,F 026D 0000 00880 026E 1505 00881 PORTA,E ;Clock lower nibble 026F 0000 00882 0270 1105 00883 PORTA,E 0271 300F 00884 movlw 0x0f 0272 1683 00885 STATUS,RP0 0273 0486 00886 iorwf TRISB,F 0274 1283 00887 STATUS,RP0 0275 0008 00888 return 00889 00890 00891 ;DisplayCal 00892 This subroutine displays message display 00893 indicating that calibration cycle progress. 00894
1999 Microchip Technology Inc.
DS00715A-page
AN715
0276 00895 DisplayCal 0276 223E 00896 call BusyXLCD 0277 3001 00897 movlw 0x01 0278 221C 00898 call WriteCmdXLCD 0279 223E 00899 call BusyXLCD 027A 3043 00900 movlw 027B 2254 00901 call WriteDataXLCD 027C 223E 00902 call BusyXLCD 027D 3061 00903 movlw 027E 2254 00904 call WriteDataXLCD 027F 223E 00905 call BusyXLCD 0280 306C 00906 movlw 0281 2254 00907 call WriteDataXLCD 0282 223E 00908 call BusyXLCD 0283 3069 00909 movlw 0284 2254 00910 call WriteDataXLCD 0285 223E 00911 call BusyXLCD 0286 3062 00912 movlw 0287 2254 00913 call WriteDataXLCD 0288 223E 00914 call BusyXLCD 0289 3072 00915 movlw 028A 2254 00916 call WriteDataXLCD 028B 223E 00917 call BusyXLCD 028C 3061 00918 movlw 028D 2254 00919 call WriteDataXLCD 028E 223E 00920 call BusyXLCD 028F 3074 00921 movlw 0290 2254 00922 call WriteDataXLCD 0291 0008 00923 return 00924 00925 00926 00927 ;DisplayDone 00928 This subroutine displays message display 00929 indicating that calibration cycle completed. 00930 0292 00931 DisplayDone 0292 223E 00932 call BusyXLCD 0293 30A8 00933 movlw 0xa8 0294 221C 00934 call WriteCmdXLCD 0295 223E 00935 call BusyXLCD 0296 3044 00936 movlw 0297 2254 00937 call WriteDataXLCD 0298 223E 00938 call BusyXLCD 0299 306F 00939 movlw 029A 2254 00940 call WriteDataXLCD 029B 223E 00941 call BusyXLCD 029C 306E 00942 movlw 029D 2254 00943 call WriteDataXLCD 029E 223E 00944 call BusyXLCD 029F 3065 00945 movlw 02A0 2254 00946 call WriteDataXLCD 02A1 0008 00947 return 00948 00949 00950 00951 00952 ;======================= Misc. Routines ============================= 00953 00954
DS00715A-page
1999 Microchip Technology Inc.
AN715
00955 ;Delay_Ms_4MHz 00956 Generic delay routine. Delay length loaded 00957 into WREG before calling. 00958 02A2 00959 Delay_Ms_4MHz 02A2 1283 00960 STATUS,RP0 02A3 008E 00961 movwf Count1 02A4 00962 DLMS2M1 02A4 307C 00963 movlw 0x7c 02A5 008F 00964 movwf Count2 02A6 00965 DLMS2M2 02A6 0000 00966 02A7 0B8F 00967 decfsz Count2,F 02A8 2AA6 00968 goto DLMS2M2 02A9 0B8E 00969 decfsz Count1,F 02AA 2AA4 00970 goto DLMS2M1 02AB 0008 00971 return 00972 00973 00974 00975 ;Bin2Ascii 00976 This routine converts binary number 2-digit ASCII 00977 number. binary number sent WREG. 00978 02AC 00979 Bin2Ascii 02AC 0198 00980 clrf Digit1 ;Clear upper digit 02AD 0097 00981 movwf Digit0 ;Save binary number 02AE 00982 B2A1 02AE 300A 00983 movlw 0x0a ;Repeadedly subtract from 02AF 0217 00984 subwf Digit0,W ;number until result less 02B0 1C03 00985 btfss STATUS,C ;then 02B1 2AB5 00986 goto B2A2 02B2 0097 00987 movwf Digit0 02B3 0A98 00988 incf Digit1,F 02B4 2AAE 00989 goto B2A1 02B5 00990 B2A2 02B5 3030 00991 movlw 0x30 ;Add 0x30 make result 02B6 0797 00992 addwf Digit0,F ;ASCII 02B7 0798 00993 addwf Digit1,F 02B8 3400 00994 retlw 00995 00996 00997 00998 00999 ;==================== Data EEPROM Routines ========================== 01000 01001 01002 ;WriteCal 01003 This subroutine takes bytes starting with address 01004 ZXcalHi writes them internal Data EEPROM. 01005 Calls WriteEE perform actual write sequence. 01006 02B9 01007 WriteCal 02B9 3006 01008 movlw 0x06 ;Load byte counter with 02BA 008E 01009 movwf Count1 02BB 3023 01010 movlw ZXcalHi ;Load starting address into 02BC 0084 01011 movwf 02BD 01B4 01012 clrf EADR ;Start writing data address 02BE 01013 WCLoop 02BE 0800 01014 movf INDF,W ;Load data
1999 Microchip Technology Inc.
DS00715A-page
AN715
02BF 00B5 01015 movwf EDATA 02C0 22D2 01016 call WriteEE ;Call routine write data 02C1 0AB4 01017 incf EADR,F ;Increment address 02C2 0A84 01018 incf FSR,F ;Increment 02C3 0B8E 01019 decfsz Count1,F ;Decrement count 02C4 2ABE 01020 goto WCLoop 02C5 0008 01021 return 01022 01023 01024 01025 ;RestoreCal 01026 This subroutine reads bytes from Data starting 01027 with address saves them starting with ZXcalHi. 01028 Calls ReadEE perform actual read sequence. 01029 02C6 01030 RestoreCal 02C6 3006 01031 movlw 0x06 ;Load byte counter 02C7 008E 01032 movwf Count1 02C8 3023 01033 movlw ZXcalHi ;Load starting address into 02C9 0084 01034 movwf 02CA 01B4 01035 clrf EADR ;Load starting address with 02CB 01036 RCLoop 02CB 22E4 01037 call ReadEE ;Read data from 02CC 0080 01038 movwf INDF ;Save register 02CD 0AB4 01039 incf EADR,F ;Increment address 02CE 0A84 01040 incf FSR,F ;Increment 02CF 0B8E 01041 decfsz Count1,F ;Decrement count 02D0 2ACB 01042 goto RCLoop 02D1 0008 01043 return 01044 01045 01046 ;WriteEE 01047 This subroutine load address data into 01048 special access registers perform write 01049 sequence. 01050 02D2 01051 WriteEE 02D2 1283 01052 STATUS,RP0 02D3 0834 01053 movf EADR,W ;Load address 02D4 0089 01054 movwf EEADR 02D5 0835 01055 movf EDATA,W ;Load data 02D6 0088 01056 movwf EEDATA 02D7 1683 01057 STATUS,RP0 02D8 1208 01058 EECON1,EEIF 02D9 1508 01059 EECON1,WREN write sequence 02DA 3055 01060 movlw 0x55 ;must performed 02DB 0089 01061 movwf EECON2 this order 02DC 30AA 01062 movlw 0xaa ;otherwise write 02DD 0089 01063 movwf EECON2 ;does take 02DE 1488 01064 EECON1,WR ;place correctly 02DF 01065 eBusy 02DF 1E08 01066 btfss EECON1,EEIF ;Wait write complete 02E0 2ADF 01067 goto eBusy 02E1 1108 01068 EECON1,WREN ;Disable writes 02E2 1283 01069 STATUS,RP0 02E3 0008 01070 return 01071 01072 01073 01074 ;ReadEE
DS00715A-page
1999 Microchip Technology Inc.
AN715
01075 This subroutine read from data using 01076 special access registers. 01077 02E4 01078 ReadEE 02E4 1283 01079 STATUS,RP0 02E5 0834 01080 movf EADR,W ;Load address 02E6 0089 01081 movwf EEADR 02E7 1683 01082 STATUS,RP0 02E8 1408 01083 EECON1,RD ;Perform write sequence 02E9 1283 01084 STATUS,RP0 02EA 0808 01085 movf EEDATA,W ;Move data into WREG 02EB 0008 01086 return 01087 01088 01089
MEMORY USAGE ('X' Used, Unused) 0000 X-XXXXXXXXXXXX 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 XXXXXXXXXXXXXXXX 0280 XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 02C0 XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXX- -2000 -All other memory blocks unused. Program Memory Words Used: Program Memory Words Free: Errors Warnings reported,
suppressed
1999 Microchip Technology Inc.
DS00715A-page
Note following details code protection feature PICmicro® MCUs. PICmicro family meets specifications contained Microchip Data Sheet. Microchip believes that family PICmicro microcontrollers most secure products kind market today, when used intended manner under normal conditions. There dishonest possibly illegal methods used breach code protection feature. these methods, knowledge, require using PICmicro microcontroller manner outside operating specifications contained data sheet. person doing engaged theft intellectual property. Microchip willing work with customer concerned about integrity their code. Neither Microchip other semiconductor manufacturer guarantee security their code. Code protection does mean that guaranteeing product "unbreakable". Code protection constantly evolving. Microchip committed continuously improving code protection features product.
have further questions about this matter, please contact local sales office nearest you.
Information contained this publication regarding device applications like intended through suggestion only superseded updates. your responsibility ensure that your application meets with your specifications. representation warranty given liability assumed Microchip Technology Incorporated with respect accuracy such information, infringement patents other intellectual property rights arising from such otherwise. Microchip's products critical components life support systems authorized except with express written approval Microchip. licenses conveyed, implicitly otherwise, under intellectual property rights.
Trademarks Microchip name logo, Microchip logo, FilterLab, KEELOQ, microID, MPLAB, PIC, PICmicro, PICMASTER, PICSTART, MATE, SEEVAL Embedded Control Solutions Company registered trademarks Microchip Technology Incorporated U.S.A. other countries. dsPIC, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, microPort, Migratable Memory, MPASM, MPLIB, MPLINK, MPSIM, MXDEV, PICC, PICDEM, PICDEM.net, rfPIC, Select Mode Total Endurance trademarks Microchip Technology Incorporated U.S.A. Serialized Quick Turn Programming (SQTP) service mark Microchip Technology Incorporated U.S.A. other trademarks mentioned herein property their respective companies. 2002, Microchip Technology Incorporated, Printed U.S.A., Rights Reserved.
Printed recycled paper.
Microchip received QS-9000 quality system certification worldwide headquarters, design wafer fabrication facilities Chandler Tempe, Arizona July 1999. Company's quality system processes procedures QS-9000 compliant PICmicro® 8-bit MCUs, KEELOQ® code hopping devices, Serial EEPROMs microperipheral products. addition, Microchip's quality system design manufacture development systems 9001 certified.
2002 Microchip Technology Inc.
WORLDWIDE SALES SERVICE
AMERICAS
Corporate Office
2355 West Chandler Blvd. Chandler, 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: 480-792-7627 Address: http://www.microchip.com
ASIA/PACIFIC
Australia
Microchip Technology Australia Suite Rawson Street Epping 2121, Australia Tel: 61-2-9868-6733 Fax: 61-2-9868-6755
Japan
Microchip Technology Japan K.K. Benex 3-18-20, Shinyokohama Kohoku-Ku, Yokohama-shi Kanagawa, 222-0033, Japan Tel: 81-45-471- 6166 Fax: 81-45-471-6122
Rocky Mountain
2355 West Chandler Blvd. Chandler, 85224-6199 Tel: 480-792-7966 Fax: 480-792-7456
China Beijing
Microchip Technology Consulting (Shanghai) Co., Ltd., Beijing Liaison Office Unit Bldg. Chaoyangmen Beidajie Beijing, 100027, China Tel: 86-10-85282100 Fax: 86-10-85282104
Korea
Microchip Technology Korea 168-1, Youngbo Bldg. Floor Samsung-Dong, Kangnam-Ku Seoul, Korea 135-882 Tel: 82-2-554-7200 Fax: 82-2-558-5934
Atlanta
Sugar Mill Road, Suite 200B Atlanta, 30350 Tel: 770-640-0034 Fax: 770-640-0307
Singapore
Microchip Technology Singapore Ltd. Middle Road #07-02 Prime Centre Singapore, 188980 Tel: 65-334-8870 Fax: 65-334-8850
Boston
Drive, Suite Westford, 01886 Tel: 978-692-3848 Fax: 978-692-3821
China Chengdu
Microchip Technology Consulting (Shanghai) Co., Ltd., Chengdu Liaison Office 2401, 24th Floor, Ming Xing Financial Tower TIDU Street Chengdu 610016, China Tel: 86-28-6766200 Fax: 86-28-6766599
Taiwan
Microchip Technology Taiwan 11F-3, Tung North Road Taipei, 105, Taiwan Tel: 886-2-2717-7175 Fax: 886-2-2545-0139
Chicago
Pierce Road, Suite Itasca, 60143 Tel: 630-285-0071 Fax: 630-285-0075
Dallas
4570 Westgrove Drive, Suite Addison, 75001 Tel: 972-818-7423 Fax: 972-818-2924
China Fuzhou
Microchip Technology Consulting (Shanghai) Co., Ltd., Fuzhou Liaison Office Unit 28F, World Trade Plaza Wusi Road Fuzhou 350001, China Tel: 86-591-7503506 Fax: 86-591-7503521
EUROPE
Denmark
Microchip Technology Nordic Regus Business Centre Lautrup Ballerup DK-2750 Denmark Tel: 4420 9895 Fax: 4420 9910
Detroit
Tri-Atria Office Building 32255 Northwestern Highway, Suite Farmington Hills, 48334 Tel: 248-538-2250 Fax: 248-538-2260
China Shanghai
Microchip Technology Consulting (Shanghai) Co., Ltd. Room 701, Bldg. East International Plaza Xian Road Shanghai, 200051 Tel: 86-21-6275-5700 Fax: 86-21-6275-5060
Kokomo
2767 Albright Road Kokomo, Indiana 46902 Tel: 765-864-8360 Fax: 765-864-8387
France
Microchip Technology SARL Parc d'Activite Moulin Massy Saule Trapu Batiment Etage 91300 Massy, France Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79
Angeles
18201 Karman, Suite 1090 Irvine, 92612 Tel: 949-263-1888 Fax: 949-263-1338
China Shenzhen
Microchip Technology Consulting (Shanghai) Co., Ltd., Shenzhen Liaison Office 1315, 13/F, Shenzhen Kerry Centre, Renminnan Shenzhen 518001, China Tel: 86-755-2350361 Fax: 86-755-2366086
York
Motor Parkway, Suite Hauppauge, 11788 Tel: 631-273-5305 Fax: 631-273-5335
Germany
Microchip Technology GmbH Gustav-Heinemann Ring D-81739 Munich, Germany Tel: 49-89-627-144 Fax: 49-89-627-144-44
Jose
Microchip Technology Inc. 2107 North First Street, Suite Jose, 95131 Tel: 408-436-7950 Fax: 408-436-7955
Hong Kong
Microchip Technology Hongkong Ltd. Unit 901-6, Tower Metroplaza Hing Fong Road Kwai Fong, N.T., Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431
Italy
Microchip Technology Centro Direzionale Colleoni Palazzo Taurus Colleoni 20041 Agrate Brianza Milan, Italy Tel: 39-039-65791-1 Fax: 39-039-6899883
Toronto
6285 Northam Drive, Suite Mississauga, Ontario 1X5, Canada Tel: 905-673-0699 Fax: 905-673-6509
India
Microchip Technology Inc. India Liaison Office Divyasree Chambers Floor, Wing (A3/A4) O'Shaugnessey Road Bangalore, 025, India Tel: 91-80-2290061 Fax: 91-80-2290062
United Kingdom
Arizona Microchip Technology Ltd. Eskdale Road Winnersh Triangle Wokingham Berkshire, England RG41 Tel: 5869 Fax: 44-118 921-5820
01/18/02
2002 Microchip Technology Inc.

Other recent searches


TC7MZ273FK - TC7MZ273FK   TC7MZ273FK Datasheet
PST993 - PST993   PST993 Datasheet
PE4271 - PE4271   PE4271 Datasheet
MBRF2035 - MBRF2035   MBRF2035 Datasheet
MBRF20150 - MBRF20150   MBRF20150 Datasheet
DPF950 - DPF950   DPF950 Datasheet
B72735D0050H062 - B72735D0050H062   B72735D0050H062 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive