| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
HERE PRACTICAL DEMONSTRATION IMPLEMENT COST-EFFECTIVE SWITCH DEBOUNCE
Top Searches for this datasheetPRACTICAL SOFTWARE DEBOUNCE USING Z893XX HERE PRACTICAL DEMONSTRATION IMPLEMENT COST-EFFECTIVE SWITCH DEBOUNCE USING ON-CHIP RESOURCES Z893XX 16-BIT FIXEDPOINT DSP. cost-effective switch debounce implemented using on-chip resources Z893XX? There many possible methods, most difficult impractical. Switching from mode alternate operational mode sometimes evokes manual interrupt. while interrupt source perfectly adequate mode task switching generated shot external pulse generator), noise from switch will often trigger multiple interrupts leading unpredictable switches. noisy, low-cost switches, simple network used debounce adequate, using external hardware generate single interrupt edge cost effective. This app. note provides solution: software debounce coupled simple switch implement variable-level software debounce with minimal software overhead. Note following interrupt structure: Table Interrupt Structure Reset Vector INT1 INT0 Reset Vector 0000h Timer/Counter Used Internal CODEC Interrupt Used Debounce Sinewave Generation External Debounce Switch Interrupt Selects Effect EXT0-EXT7 Switch Audio Output Z89321 ER/W, INT0 CODEC EA1, 29C18 CODEC Hardware hardware interface very straightforward. necessary hardware incorporated Z89391 Application Development (Z8939100ZCO), which integrates emulator with evaluation section including CODEC. (This ordered directly from Zilog complete ready-to-use evaluation platform.) There only handful components, excluding emulator portion. entire emulation section, course, replaced with single DSP. (Refer Figures which show complete Z89391 schematic diagram.) input switch simply hardwired hardware interrupt INT0. demonstrate effectiveness this solution, sinewave generator been added software. output this sinewave generator through CODEC simple amplified speaker system. Z893XX's on-board CODEC greatly simplifies interface. Although CODECs simultaneously supported, CODEC been chosen demonstration purposes. connected main frame synchronization signal. Figure Z89321 Hardware Block Diagram AP96DSP0500 Practical Software Debounce Using Z893XX Figure Z89391 Schematic Diagram-Part AP96DSP0500 Practical Software Debounce Using Z893XX Figure Z89391 Schematic Diagram-Part AP96DSP0500 Practical Software Debounce Using Z893XX Figure Z89391 Schematic Diagram-Part AP96DSP0500 Practical Software Debounce Using Z893XX Figure Z89391 Schematic Diagram-Part AP96DSP0500 Practical Software Debounce Using Z893XX Figure Z89391 Schematic Diagram-Part AP96DSP0500 Practical Software Debounce Using Z893XX Figure Z89391 Schematic Diagram-Part AP96DSP0500 Practical Software Debounce Using Z893XX Figure Z89391 Schematic Diagram-Part AP96DSP0500 Practical Software Debounce Using Z893XX Software software flowchart (refer Figure that follows shows primary Interrupt Service Routines (ISRs). Code operation been integrated into practical working code wherever possible. Since built-in CODEC interface available, many applications will require using this event. practical result that only first interrupt from switch will have practical effect until debounce counter times out. software debounce required first, processor simply idles until internal CODEC interrupt occurs. sinewave generator simply serviced next phase sinewave through hardware µ-law compression CODEC should audible through speaker. delay counter incremented after every entry CODEC reset after reached maximum count. time debounce time which another interrupt from INT0 will acknowledged calculated follows. INT0 CODEC Save Debfl Set? Save Incr Delay Debfl Debmx? Reset Delay Reset Delay Maxeff? Reset Debfl Incr Effect Tone Restore Restore INT0 Cod1 Figure Software Debounce Flowchart AP96DSP0500 Practical Software Debounce Using Z893XX Emulator 24.00 SCLK FSYNC 24/(3x2x2) 2.0/256 provide delay software Four tones selected: kHz, kHz, kHz, after each depression switch. quick depressions switch within delay time will have effect. switch depressed held depressed more than milliseconds then released, then release will treated another interrupt. variable debmx should adjusted compensate intended application. overview CODEC interface registers provided here reference. Therefore, every entry CODEC1 1/125 microseconds. Assuming width switch noise milliseconds, then: debmx 00,000/125 3200 %0c80 variable debmx debounce maximum start code. software debounce required, processor simply idles until internal CODEC interrupt occurs switchgenerated INT0 interrupt occurs. switch-generated INT0 occurs, then debounce flag delay counter reset that until first interrupt from switch effect. Note: delay counter counts from reset value zero increments equal sampling period. EXT5-1 µ/Law Comp EXT5-2 EXT6-1 µ/Law Comp EXT6-2 SCLK Control Logic/Registers Full-Duplex 8-/16-/64-Bit Synchronous Serial Port Double-Buffered Input Output Hardware µ/Law Compression Support Figure CODEC Interface Registers AP96DSP0500 Practical Software Debounce Using Z893XX SOURCE CODE ;Sinewave generator real hardware with software debounce. ;The step-size delta calculated according sinewave frequency generated (delta N*f/fs). ;This program uses following data: ;Output sinewave linear automatically converted hardware µ-law when output CODEC. Frame sync ;used CODEC. ;Written Z89391 Application Development Kit, Z8939100ZCO. ;Constant Definitions Occupy Memory debmx maxeff 0c80 ;Debounce time ;Maximum number different tones 2000 1500 1000 selectable INT0 sampling frequency Sinewave table scaled Sinewave output CODEC1 (EXT6) table length ;BANK1 Variables phaseequ deltaequ delayequ debflequ %101 %102 %103 %104 ;Debounce interrupt flag AP96DSP0500 Practical Software Debounce Using Z893XX ;Code Section segment code init: ;**************************** Initialize Registers ;**************************** p0:0, #%00 @p0:0, #%00 p0:1, #%00 @p0:1, #%00 a,#0 phase,a a,#39 a,#16 delta,a ;Initialize phase ;1209 1209 8000 ;500 8000 ;Pointer initialized bank0 location ;Initialize bank location value ;Pointer initialized bank0 location ;Initialize bank location value %0000 ;Initialize Codec Interface Emulator Testing EXT7, #%C00D ;Emulator 24.000 ;SCLK 24/(3x2x2) ;FSYNC 2.0/256 ;Load EXT7-1 with 1100 0000 0000 1101 ;CODEC Enabled, Internal Fsync generation ;8-bit µ-law compression ;SCLK/FSYNC ratio kHz) ;SCLK 12.288/(3X2) (divide internal) EXT7, #%C000 ;Load EXT7-2 with 1100 0000 0000 0000 ;CODEC Enabled, Internal SCLK generation AP96DSP0500 Practical Software Debounce Using Z893XX ;************************ ;Wait CODEC Interrupt ;************************ SIEF ;Enable Interrupts Loop1: int0: Loop1 ;Wait CODEC interrupt ;-;Software ;debfl ;and then noise debounce. Only interrupt allowed time int0. debounce flag.It after first interrupt reset until delay elapsed make sure that from first switch push causes unexpected change. ;-ld a,debfl nz,endint0 a,#%1 debfl,a delay,a ;Load with flag ;Set reset, change effect ;Change ;Set flag ;Clear ;Reset delay AP96DSP0500 Practical Software Debounce Using Z893XX ;-;select effect ;-ld seleff: a,@p1:1+ a,p1:1 a,#maxeff mi,seleff p1:1,#%0 a,p1:1 ;Increment p1:1 effect selector ;Load with p1:1 effect selector ;p1:1 initialized with p0:0 ;Goes 0,1,2,3,0,1,2,3. ;Start over ;Load with p1:0 ;sll needed address effect table ;Track table jumps words apart ;state p1:1 acc. effectable: effect0: effect1: a,#32 delta,a endint0 ;1000 8000 a,#16 delta,a endint0 ;500 8000 effect0 effect1 effect2 effect3 ;Perform effect ;Perform effect ;Perform effect ;Perform effect a,#effectable pc,a AP96DSP0500 Practical Software Debounce Using Z893XX effect2: effect3: endint0: sief CODEC1: ;-;Provide delay software debounce. Every entry CODEC1 microseconds. Assume width switch noise milliseconds. ;debmx 400,000/125 3200 %0c80 ;-ld debres: Generate tone ;-ld SIEF EndInt: SIEF ;Enable interrupts ;Return main program a,phase a,delta a,#%0ff phase,a x,#costbl @p0:1,a a,@@p0:1 EXT6,a @P0:0+, ;Points cosine table entry ;Retrieve cosine table value ;Output sine CODEC1 ;Load Data bank ;Enable interrupts ;Restore last phase ;Add step delta 1209hz) ;Ensure phase+delta greater then ;Modulo increment phase ;Load cosine table start address a,delay a,#%1 delay,a a,#debmx mi,debres debfl,a ;Load with delay ;Increment ;Store delay next delay ;Compare with debounce less than delay, then reset ;Clear ;Reset flag ;enable interrupts ;return main program a,#64 delta,a ;2000 2000 8000 a,#48 delta,a endint0 ;1500 8000 AP96DSP0500 Practical Software Debounce Using Z893XX Cosine Table costbl: 4095, 4075, 4016, 3918, 3783, 3611, 3404, 3165, 2895, 2597, 2275, 1930, 1567, 1188, 798, 401, -401, -798, -1188, -1567, -1930, -2275, -2597, -2895, -3165, -3404, -3611, -3783, -3918, -4016, -4075, -4094, -4075, -4016, -3918, -3783, -3611, 4093,4090,4083;cosine table 4064,4050,4034 3995,3972,3946 3888,3855,3820 3743,3701,3657 3563,3512,3459 3348,3289,3228 3100,3034,2965 2823,2750,2674 2519,2439,2357 2190,2105,2018 1841,1750,1659 1473,1379,1284 1092,995, 700,600, 301,200, -100,-200,-301 -501,-600,-700 -897,-995,-1092 -1284,-1379,-1473 -1659,-1750,-1841 -2018,-2105,-2190 -2357,-2439,-2519 -2674,-2750,-2823 -2965,-3034,-3100 -3228,-3289,-3348 -3459,-3512,-3563 -3657,-3701,-3743 -3820,-3855,-3888 -3946,-3972,-3995 -4034,-4050,-4064 -4083,-4090,-4093 -4093,-4090,-4083 -4064,-4050,-4034 -3995,-3972,-3946 -3888,-3855,-3820 -3743,-3701,-3657 -3563,-3512,-3459 AP96DSP0500 Practical Software Debounce Using Z893XX -3404, -3165, -2895, -2597, -2275, -1930, -1567, -1188, -798, -401, 401, 798, 1188, 1567, 1930, 2275, 2597, 2895, 3165, 3404, 3611, 3783, 3918, 4016, 4075, -3348,-3289,-3228 -3100,-3034,-2965 -2823,-2750,-2674 -2519,-2439,-2357 -2190,-2105,-2018 -1841,-1750,-1659 -1473,-1379,-1284 -1092,-995,-897 -700,-600,-501 -301,-200,-100 100,200, 501,600, 897,995, 1092 1284,1379,1473 1659,1750,1841 2018,2105,2190 2357,2439,2519 2674,2750,2823 2965,3034,3100 3228,3289,3348 3459,3512,3563 3657,3701,3743 3820,3855,3888 3946,3972,3995 4034,4050,4064 4083,4090,4093 ;**************************** ;Reset Vector Initialization ;**************************** %0FFC init EndInt COCDEC1 int0 vector reset=init Initialize Reset Interrupt vectors ;Reset Vector 0000h ;Interrupt Counter used ;Interrupt Internal CODEC Interrupt ;Interrupt selects effect ;Reset vector AP96DSP0500 Other recent searchesTMS320C6474 - TMS320C6474 TMS320C6474 Datasheet LS02-1A66-S-500W - LS02-1A66-S-500W LS02-1A66-S-500W Datasheet LPT825 - LPT825 LPT825 Datasheet 19NMOHF - 19NMOHF 19NMOHF Datasheet LPT2400NMOHF - LPT2400NMOHF LPT2400NMOHF Datasheet LH28F160BJB-BTL90 - LH28F160BJB-BTL90 LH28F160BJB-BTL90 Datasheet B4930 - B4930 B4930 Datasheet
Privacy Policy | Disclaimer |