| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
RS-232 Autobaud PIC16C5X Devices EXAMPLE Author: Thomas Schm
Top Searches for this datasheetAN712 RS-232 Autobaud PIC16C5X Devices EXAMPLE Author: Thomas Schmidt Microchip Technology 104µs 9600Baud BAUDRATE CALCULATION INTRODUCTION This application note describes implementation RS-232 Autobaud routine PIC16C54B microcontroller. Many microcontroller applications require chip-to-chip serial communication. Since PIC16C54B USART, serial communication must performed software. Some applications multiple transmission rates. Multiple transmission rates require software which detects transmission rate adjusts receive transmit routines according transmission rate. asynchronous communication, receiver must know baud rate transmitter, because only data shown Figure transmitted. clock provided transmitter. Example depicts asynchronous transmission character 'A'. character value (ASCII). EXAMPLE ASYNCHRONOUS SERIAL COMMUNICATION Figure shows format data byte transferred serial communication line. Before actual data byte going transmitted, data line high level. first transmitted called start-bit always low, followed actual data. data transmitted with (last-significant-bit) first (most significant bit) last. high level represents level zero bit. final transmitted stop-bit. stop-bit always logic high. Start ASYNCHRONOUS TRANSMISSION CHARACTER Stop Note: Character equivalent 41H=01000001b FIGURE DATA BYTE Autobaud Asynchronous Serial Communication some systems, transmission fixed baud rate. this case, received adjust baud rate that transmitter. Autobaud means that receiver measures transmission time calibration character adjusts delay routines baud rate generation accordingly Start Stop bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 1999 Microchip Technology Inc. number bits transmitted second equal baud rate. inverse baud rate equals transmission time bit. DS00712A-page AN712 SYSTEM This chapter gives overview setup hardware software. Program Flow program flow shown Figure FIGURE Hardware this application, PIC16C54B connected PIC16C54B placed PICDEM1 board. PICDEM1 board provides DSUB9 connector MAX232 interface circuit. PICDEM1 board connected DSUB9 connector serial cable serial port this application, sends calibration character PIC16C54B. PIC16C54B detects transmission rate measuring length transmitted zeros calibration character. transmission time measure software counter. value software counter represents value transmission rate bit. This value used generate delay sampling. hardware setup this application note shown Figure PROGRAM FLOW MAIN ROUTINE Power-Up Autobaud Receive Character Send Character FIGURE Mains HARDWARE SETUP Power supply SERIAL LINK After power-up, PIC16C54B initializes ports waits calibration character from When sends calibration character, PIC16C54B measures transmission rate. This done within autobaud routine. Once transmission rate been detected, send second character. This character received echoed PIC16C54B. This process, receiving transmitting characters, runs infinite loop. software divided into three modular routines: Autobaud routine Receive routine Transmit routine Each routine separate software module easily integrated custom code. communication between PIC16C54B half-duplex. order implement fullduplex communication, please refer AN510 Implementation Asynchronous Serial I/O. PORT PIC16C54B PICDEM1 DS00712A-page 1999 Microchip Technology Inc. AN712 AUTOBAUD ROUTINE This chapter describes theory operation implementation autobaud routine. Note: software designed 8-N-1 communication. Where equals number data bits (start stop included), equal parity equal stop bit. value counter represents value transmission rate zeros. order calculate transmission time bit, value 16-bit counter divided result transmission time bit. While measuring transmission time calculating transmission time bit, autobaud routine check 16-bit counter overflows result division could zero. counter overflow means that transmitted signal slow. division equals zero, that means that incoming signal fast. order adjust transmission rate receiver side, transmitter send known character receiver. This character called calibration character. receiver must know pattern character, measure time receive more bits. From measured time, receiver calculates transmission time bit. This time used receive transmit routine generate baud rate. calibration value used autobaud routine this application note shown Figure Implementation implementation autobaud routine broken into sections. Check start-bit Measure time (increment counter) Divide measured time eight Calculate time half transmission time (divide previous result two). Half baudrate used receive routine place sampling bits middle. Adjust result receive transmit routines Check both calculated results greater than zero. results zero, baudrate cannot generated because received signal fast. FIGURE CALIBRATION CHARACTER AUTOBAUD ROUTINE Start Stop first step, autobaud routine looks startbit. After start-bit been detected, 16-bit software counter will increment until next high transition detected (see Figure This means autobaud routine measures transmission time eight zeros (including start-bit). Each this sections will explained separately following text. entire source code autobaud, well receive transmit routines, given Appendix. Check Start-Bit first step, autobaud routine called registers initialized (see Figure high byte autobaud counter zero. autobaud status register also cleared. autobaud status register contains error flags, which indicate incoming signal fast slow. After initialization, receive checked high transition. When this detected, autobaud routine starts measuring. FIGURE Autobaud CHECK START clrf clrf clrf clrf clrf AUTOBAUD_LOW AUTOBAUD_HIGH AUTOHALF_LOW AUTOHALF_HIGH AUTOB_STATUS reset register reset register reset register reset register reset autobaud status register TestStartBit btfsc goto PORTA, TestStartBit check start-bit Start-bit found 1999 Microchip Technology Inc. DS00712A-page AN712 Measure Time Receive Calibration Word After start-bit detected, autobaud routine measures time receive calibration character. source code this section shown Figure calibration character pattern 10000000b. autobaud routine increments 16-bit counter until high transition found. registers 16-bit counter called AUTOBAUD_HIGH (high byte) AUTOBAUD_LOW (low byte). high byte overflows error flag SIGNAL_SLOW register, AUTOBAUD_STATUS will set. overflow means that incoming signal slow, because takes more cycles increment counter than transmit full calibration character. Figure Calculate Transmission Time After bits received measured time divided eight, because time receive eight zeros measured. division simply done shifting 16-bit counter three times right. Zeros shifted into counter from left side. transmission time stored registers AUTOBAUD_LOW AUTOBAUD_HIGH. FIGURE Autobaud TestBitHigh MEASURE TIME RECEIVE CALIBRATION WORD clrf btfsc goto incfsz goto incfsz goto goto AUTOBAUD_LOW PORTA, Calculate AUTOBAUD_LOW, TestBitHigh AUTOBAUD_HIGH, TestBitHigh Signal2Slow reset register Test stream stream, calculate time increment Autobaud register test high increment high byte autobaud register test stream High byte overflow. Transmitted signal slow clock speed FIGURE Autobaud CALCULATION TRANSMISSION TIME clrf AUTOBAUD_LOW reset register divide measure time zero where transmitted including start-bit) Initialize count register Counter number rotates clear carry rotate autobaud high register rotate autobaud register decrement counter divide Calculate Divide movlw movwf decfsz goto 0x03 COUNTER STATUS, AUTOBAUD_HIGH,f AUTOBAUD_LOW, COUNTER, Divide DS00712A-page 1999 Microchip Technology Inc. AN712 Calculate Half Time After transmission time calculated, transmission time half time computed. This value needed received routine place sampling middle each bit. After start been detected receive routine, routine waits times before first data sampled. This ensures that sampling always happens middle bit. calculation half time done simply shifting 16-bit counter right once. result division stored registers AUTOHALF_HIGH AUTOHALF_LOW. source code this section autobaud routine shown Figure Adjust Transmission Times Receive Transmit Routine value 16-bit counter full time value half time have adjusted receive transmit routine. Each count register AUTOBAUD_LOW AUTOHALF_LOW stands instruction cycles, because took five instruction cycles count. Since receive transmit routines have software overhead storing restoring data, this overhead subtracted from counter values. After each adjustment, result checked negative. this case, error flag SIGNAL2FAST will set. Figure FIGURE Autobaud CalcHalfBit CALCULATION HALF TIME clrf movwf movwf AUTOBAUD_LOW STATUS, AUTOBAUD_HIGH,w AUTOHALF_HIGH AUTOBAUD_LOW, AUTOHALF_LOW reset register Calculate half time clear carry rotate autobaud high register copy result into AUTOHALF_HIGH register rotate autobaud high register copy result into AUTOHALF_LOW register FIGURE COUNTER ADJUSTMENT CHECK COUNTERS NEGATIVE clrf movlw AUTOBAUD_LOW reset register 18-19 instruction cycles overhead from transmit receive routine. This overhead must subtracted from iterations Adjust byte from Autobaud counter result negative? (equal=0 will checked ErrorCheck). result negative Signal fast receive transmit routine subtract from byte half time subtract from byte half time result negative? (equal=0 will checked ErrorCheck). result negative Signal fast receive transmit routine Autobaud AdjustLowByte subwf btfss goto movlw subwf btfss goto AUTOBAUD_LOW, STATUS, Signal2Fast 0x02 AUTOHALF_LOW, STATUS, Signal2Fast DS00712A-page 1999 Microchip Technology Inc. AN712 Check Both Counter Values Zero After adjustment, both counter values full half time checked zeros. this case, error flag SIGNAL2FAST set. both counters greater than equal one, autobaud routine returns main routine. source code this section autobaud routine shown Figure FIGURE CHECK COUNTER VALUES Autobaud clrf reset register check AUTOBAUD_HIGH AUTOBAUD_LOW zero. This means transmission time byte high AUTOBAUD_HIGH,w copy high byte autobaud counter register into w-register AUTOBAUD_LOW, AUTOBAUD_HIGH AUTOBAUD_LOW? STATUS, result zero? ErrorCheckHalf Result zero, therefore finish autobaud routine Signal2Fast Signal fast routine AUTOHALF_HIGH,w copy high byte autobaud counter register into w-register AUTOHALF_LOW, AUTOBAUD_HIGH AUTOBAUD_LOW? STATUS, result zero? EndAutoBaud Result zero, therefore finish autobaud routine Error: delay half time zero, therefore delay cannot generated with delay routines. Incoming signal fast clock speed. AUTOB_STATUS, SIGNAL_FAST error flag 0x00 return operating system AUTOB_STATUS, SIGNAL_SLOW error flag 0x00 Return operating system AUTOBAUD_LOW ErrorCheck movf xorwf btfss goto goto ErrorCheckHalf movf xorwf btfss goto Signal2Fast Signal2Slow EndAutoBaud retlw retlw TRANSMIT ROUTINE source code transmit routine shown Figure FIGURE SOURCE CODE TRANSMIT ROUTINE Transmit routine Transmits first Software overhead instruction cycles (including call DelayFullBit routine, return from delay routine included) Number bit's transmit Initialize count register Generate start-bit Generate Delay bit-time Rotate receive register Test transmitted Transmit Check carry Transmit zero call Delay routine Decrement count register Transmit next Generate Stop Delay Stop Return operating system 1999 Microchip Technology Inc. Transmit TransmitNext movlw movwf call btfsc btfss call decfsz goto call retlw BITS COUNTER PORTA, DelayFullBit RXTX_REG, STATUS, PORTA, STATUS, PORTA, DelayFullBit COUNTER, TransmitNext PORTA, DelayFullBit 0x00 DS00712A-page AN712 first step, transmit routine initializes register Count After initialization, RXTX_REG register rotated position right. bit-0 RXTX_Reg stored carry flag. carry checked whether `0'. carry set, TX-pin also set, otherwise TX-pin cleared. After bits transmitted, stop-bit send. delay transmission generated DELAYFULLBit routine. FIGURE RECEIVE ROUTINE SAMPLING Sample Sample Note Note Delay generated using delay value from register AutoBaud2 Delay generated using delay value from register AutoBaud RECEIVE ROUTINE source code receive routine shown Figure receive routine first resets receive register initializes Count register with After initialization, routine checks start-bit. When start detected ,the receive routine waits times transmission time before sampling next bit. This ensures that bits sampled middle beginning (see Figure 12). delay half time generated routine DelayHalfBit. After delay, sample stored register RXTX_REG. FIGURE SOURCE CODE RECEIVE ROUTINE Receive Routine receive routine instruction cycles iteration including call DelayFullBit routine Clear receive register Number bits receive Load number bits into counter register Test start Startbit found Wait until middle start Ignore start-bit sample first data middle zero carry zero zero clear carry Rotate receive register Call Delay routine decrement receive count register Receive next back operation system Receive ReceiveStartBit clrf movlw movwf btfsc goto call call btfsc btfss call decfsz goto retlw RXTX_REG BITS COUNTER PORTA, ReceiveStartBit DelayHalfBit DelayFullBit PORTA, STATUS,C PORTA, STATUS,C RXTX_REG, DelayFullBit COUNTER, ReceiveNext 0x00 ReceiveNext 1999 Microchip Technology Inc. DS00712A-page AN712 time measured using software timer. software timer started when start-bit detected. start-bit detected when transition from high occurs. Once start-bit detected, software timer counts until high transition detected. Measuring Length First Each Character Transmitted This method measures transmission time first from transmitted character. measured value used adjust delay counter receiving following bits. measurement done each character received. Variations oscillator frequency compensated using this method. disadvantage this method that transmitted characters need zero transition first bit. This limits number characters which transmitted. DELAY ROUTINES delay routine half time full time identical program flow. high byte zero, only byte will decremented. decrementing, byte stored temporary register. When byte zero, delay routine returns either receive transmit routine. high byte zero, byte will decremented n-times, where value stored high byte. SOFTWARE PERFORMANCE performance autobaud routine shown. TABLE Oscillator Frequency SOFTWARE PERFORMANCE Min. Baudrate Baud Baud Baud Max. Baudrate 19200 Baud 38400 Baud 57600 Baud OTHER POSSIBLE AUTOBAUD IMPLEMENTATIONS There several other methods implement autobaud routine. These methods briefly described below. implementations given within this application note. Measuring Length Using Timer Instead using software counter, timer used. This would require modifications autobaud receive transmit routines. disadvantage this method that timer dedicated autobaud routine. DS00712A-page 1999 Microchip Technology Inc. APPENDIX AUTO16B3.ASM Title RS-232 Autobaud routine Author Thomas Schmidt Application Engineer Standard Microcontroller ASSP Products Date 04.01.1999 Revision Last Modified 04.01.1999 Description purpose this program detect automatically Baudrate RS-232* transmitter. detected baudrate used adjust delay routine transmit receive routine. This program measures transmission time incoming calibration character. Based measured time transmission time calculated. This value used software delay routine generate delay bit. delay routine called from transmit receive routine. user free modify main routine. user chooses modify receive transmit routine modify well software adjustment autobaud routine. 3-17-1999 11:28:13 1999 Microchip Technology Inc. LIST P=16C54B, r=hex Include files #include "P16C5X.INC" LIST P16C5X.INC LIST Standard Header File, Version 4.00 Microchip Technology, Inc. definitions #define receive pin, connected #define transmit pin, connected Register definitions cblock 0x08 AUTOBAUD_LOW byte bit-time counter AUTOBAUD_HIGH high byte bit-time counter MPASM 02.20.04 Intermediate 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00001 00002 00313 00026 00027 00028 00029 00030 00031 00032 00033 00034 AN712 DS00712A-page 00000008 00000009 00035 00036 00037 00038 00039 0000000A 0000000B 0000000C 0000000D 0000000F 00000010 endc AN712 DS00712A-page AUTOHALF_LOW AUTOHALF_HIGH AUTOB_STATUS TEMP1, TEMP2 RXTX_REG COUNTER byte half time high byte half time status byte Autobaud routine temporary registers receive register receive Transmit counter register definitions register AUTOB_STATUS #define SIGNAL_FAST signal-to-fast flag AUTOB_STATUS byte. This indicates that incoming signal fast AUTOB_STATUS.SIGNAL_FAST=0 Signal AUTOB_STATUS.SIGNAL_FAST=1 Signal #define SIGNAL_SLOW signal-to-slow flag AUTOB_STATUS byte. This indicates that incoming signal slow AUTOB_STATUS.SIGNAL_SLOW=0 Signal AUTOB_STATUS.SIGNAL_SLOW=1 Signal fast slow Other definitions #define BITS number bits receive Fuse configuration _CONFIG _CP_OFF&_WDT_OFF&_XT_OSC Reset vector 0x1FF goto Begin Program Start 0x00 0FFF 0FF9 01FF 01FF 0A00 1999 Microchip Technology Inc. 0000 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 1999 Microchip Technology Inc. Begin Initialization clrf PORTB latches PORTB clrw reset W-Register tris PORTB initialize TRIS register clrf PORTA reset latches PortA movlw b'11110111' R2=RX, RA3=TX tris PORTA initialize TRIS register PORTA Main routine. main routine detects first transmission time incoming calibration character. After that routine receives transmits incoming characters. call Autobaud call Autobaud routine movf AUTOB_STATUS, check error occurred btfsc STATUS, AUTOB_STATUS=0 (means error occurred) goto Main goto Main DoForever error occurred. incoming signal either fast slow. autobaud status register AUTOB_STATUS displayed PORTB order indicated that error occurred. receive transmit routine will called. movwf PORTB display AUTOB_STATUS PORTB goto DoForever error occurred. This error displayed PORTB. Because this error, receive transmit routine will called. Main error occurred. There receive transmit characters. call Transmit transmit received character back transmitter call Receive receive next character goto Main forever Autobaud TestStartBit Autobaud routine clrf AUTOBAUD_LOW reset register clrf AUTOBAUD_HIGH reset register clrf AUTOHALF_LOW reset register clrf AUTOHALF_HIGH reset register clrf AUTOB_STATUS reset autobaud status register btfsc PORTA, check start-bit goto TestStartBit start-bit found btfsc goto PORTA, Calculate test stream stream, calculate time TestBitHigh 0000 0001 0002 0003 0004 0005 0066 0040 0006 0065 0CF7 0005 0006 0007 0008 0009 090F 020C 0643 0A0C 000A 0026 000B 0A0B 000C 0952 000D 0942 000E 0A0C 000F 0010 0011 0012 0013 0014 0015 0068 0069 006A 006B 006C 0645 0A14 AN712 DS00712A-page 0016 0645 0017 0A1D 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 AN712 DS00712A-page incfsz goto incfsz goto goto AUTOBAUD_LOW, TestBitHigh AUTOBAUD_HIGH,f TestBitHigh Signal2Slow increment Autobaud register test high increment high byte autobaud register test stream high byte overflow. Transmitted signal slow clock speed Calculate Divide Calculation transmission time movlw 0x03 initialize count register movwf COUNTER counter number rotates STATUS, clear carry AUTOBAUD_HIGH,f rotate autobaud high register AUTOBAUD_LOW, rotate autobaud register decfsz COUNTER, decrement counter goto Divide divide CalcHalfBit Calculate transmission time half time (means divide transmission time two). STATUS, clear carry AUTOBAUD_HIGH,w rotate autobaud high register movwf AUTOHALF_HIGH copy result into AUTOHALF_HIGH register AUTOBAUD_LOW, rotate autobaud high register movwf AUTOHALF_LOW copy result into AUTOHALF_LOW register AdjustLowByte Adjust 16-bit counter receive transmit routine. This means that overhead instruction cycles receive/transmit routine subtracted from transmission time half bit. movlw 18-19 instruction cycles overhead from transmit/receive routine. This overhead must subtracted from iterations subwf AUTOBAUD_LOW, adjust byte from Autobaud counter btfss STATUS, result negative? (equal=0 will checked ErrorCheck). result negative goto Signal2Fast signal fast receive transmit routine movlw 0x02 subtract from byte half time subwf AUTOHALF_LOW, subtract from byte half time btfss STATUS, result negative? (equal=0 will checked ErrorCheck). result negative goto Signal2Fast signal fast ErrorCheck check means movf btfss goto AUTOBAUD_HIGH AUTOBAUD_LOW zero. This transmission time byte high AUTOBAUD_HIGH,f copy high byte autobaud counter register onto itself STATUS, zero-flag set? ErrorCheckHalf therefore check next byte 0018 0019 001A 001B 001C 03E8 0A16 03E9 0A16 0A40 001D 001E 001F 0020 0021 0022 0023 0C03 0030 0403 0329 0328 02F0 0A1F 0024 0025 0026 0027 0028 0403 0309 002B 0308 002A 0029 0C03 002A 00A8 002B 0703 002C 002D 002E 002F 0A3E 0C02 00AA 0703 0030 0A3E 1999 Microchip Technology Inc. 0031 0229 0032 0743 0033 0A38 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 1999 Microchip Technology Inc. ErrorCheckHalf movf btfss goto goto movf btfss goto movf btfss goto AUTOBAUD_LOW, STATUS, ErrorCheckHalf Signal2Fast AUTOHALF_HIGH,f STATUS, EndAutoBaud AUTOHALF_LOW, STATUS, EndAutoBaud copy byte autobaud register onto itself zero-flag set? byte zero therefore check next byte yes, signal fast. Therefore flag copy high byte autobaud counter onto itself zero-flag set? finish autobaud routine check byte zero-flag set? therefore finish autobaud routine yes, High byte AUTOHALF register zero there incoming signal fast generate delay Therefore SIGNAL_FAST flag Signal2Fast Error: delay half time zero, therefore delay cannot generated with delay routines. incoming signal fast clock speed. AUTOB_STATUS, SIGNAL_FAST error flag retlw 0x00 return main routine AUTOB_STATUS, SIGNAL_SLOW error flag Signal2Slow EndAutoBaud retlw 0x00 return main routine Receive Routine clrf RXTX_REG clear receive register movlw BITS number bits receive movwf COUNTER load number bits into counter register btfsc PORTA, test start goto ReceiveStartBit start-bit found call DelayHalfBit wait until middle start-bit call DelayFullBit ignore start-bit sample first data middle btfsc PORTA, zero one? STATUS,C carry btfss PORTA, zero? STATUS,C zero clear carry RXTX_REG, rotate value into receive register call DelayFullBit call Delay routine decfsz COUNTER, decrement receive count register goto ReceiveNext receive next retlw 0x00 return main routine 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 0228 0743 0A38 0A3E 022B 0743 0A41 022A 0743 0A41 003E 050C 003F 0800 0040 052C 0041 0800 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 0042 0043 0044 0045 0046 0047 0048 006F 0C08 0030 0645 0A45 0972 0961 0049 004A 004B 004C 004D 004E 004F 0050 0051 0645 0503 0745 0403 032F 0961 02F0 0A49 0800 00205 00206 00207 00208 00209 00210 Receive 00211 00212 00213 ReceiveStartBit 00214 00215 00216 00217 00218 ReceiveNext 00219 00220 00221 00222 00223 00224 00225 00226 AN712 DS00712A-page AN712 DS00712A-page Transmit TransmitNext Transmit routine movlw BITS number bit's transmit movwf COUNTER initialize count register PORTA, generate start-bit call DelayFullBit generate Delay bit-time RXTX_REG, rotate receive register btfsc STATUS, test transmitted PORTA, transmit btfss STATUS, check carry PORTA, transmit zero call DelayFullBit call Delay routine decfsz COUNTER, decrement counter register goto TransmitNext transmit next PORTA, generate Stop call DelayFullBit delay Stop retlw 0x00 return main routine DelayFullBit Delay routine 16-bit counter (delay full time) movf AUTOBAUD_HIGH,w copy content Autobaud high register into btfss STATUS, high byte goto LoadHighByte high byte zero goto DecLowByteOnly decrement only byte LoadHighByte DecLowByte1 movwf clrf decfsz goto decfsz goto TEMP2 TEMP1 TEMP1, DecLowByte11 TEMP2, DecLowByte1 load TEMP2 with content AUTOBAUD_HIGH reset TEMP1 register decrement byte until result zero decrement byte decrement byte again DecLowByteOnly DecLowByte2 DecLowByte11 DecLowByte22 movf movwf decfsz goto retlw goto goto AUTOBAUD_LOW, copy byte from autobaud register TEMP1 into TEMP1 TEMP1, decrement byte until zero DecLowByte22 extra cycle delay 0x00 return from subroutine DecLowByte1 additional cycle delay DecLowByte2 additional cycle delay Delay routine 16-bit counter (delay half time) 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F 0060 0C08 0030 0465 0961 032F 0603 0565 0703 0465 0961 02F0 0A56 0565 0961 0800 0061 0062 0063 0064 0209 0743 0A65 0A6B 0065 0066 0067 0068 0069 006A 002E 006D 02ED 0A70 02EE 0A67 1999 Microchip Technology Inc. 006B 006C 006D 006E 006F 0070 0071 0208 002D 02ED 0A71 0800 0A67 0A6D 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 0072 0073 0074 0075 LoadHighByteH DecLowByteH1 movwf clrf decfsz goto decfsz goto AUTOHALF_LOW, copy byte from autobaud register TEMP1 into TEMP1 TEMP1, decrement byte until zero DecLowByteH22 extra cycle delay 0x00 return from subroutine DecLowByteH1 additional cycle delay DecLowByteH2 additional cycle delay TEMP2 TEMP1 TEMP1, DecLowByteH11 TEMP2, DecLowByteH1 load TEMP2 with content AUTOHALF_HIGH reset TEMP1 register decrement byte until result zero decrement byte decrement byte again 020B 0743 0A76 0A7C DelayHalfBit movf btfss goto goto AUTOHALF_HIGH,w STATUS, LoadHighByteH DecLowByteOnlyH copy content Autobaud high register into high byte high byte zero decrement only byte 1999 Microchip Technology Inc. DecLowByteOnlyH movf movwf DecLowByteH2 decfsz goto retlw DecLowByteH11 goto DecLowByteH22 goto 0076 0077 0078 0079 007A 007B 002E 006D 02ED 0A81 02EE 0A78 007C 007D 007E 007F 0080 0081 0082 020A 002D 02ED 0A82 0800 0A78 0A7E 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 Program Memory Words Used: Program Memory Words Free: AN712 DS00712A-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 searchesUC3854A - UC3854A UC3854A Datasheet UC3854B - UC3854B UC3854B Datasheet TDA1547 - TDA1547 TDA1547 Datasheet SC-88 - SC-88 SC-88 Datasheet SC-70 - SC-70 SC-70 Datasheet PIC16F62X - PIC16F62X PIC16F62X Datasheet PDF-5C - PDF-5C PDF-5C Datasheet OSO5GA4131A - OSO5GA4131A OSO5GA4131A Datasheet HSP48410 - HSP48410 HSP48410 Datasheet ADNS-3040 - ADNS-3040 ADNS-3040 Datasheet 1N914 - 1N914 1N914 Datasheet
Privacy Policy | Disclaimer |