Datasheets.org.uk - 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*)

 

 

J.Stockinger INTRODUCTION on-chip Analog Digital Converter (ADC)


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



USING ANALOG INPUTS MULTIPLE DECODING
J.Stockinger
INTRODUCTION on-chip Analog Digital Converter (ADC) useful peripheral integrated into silicon family members. flexibility port structure allows multiplexing 13/8 Analog Inputs into converter 28/20 device ST6210/15 ST6220/25 families, enabling full freedom circuit layout. Many other members family also offer Analog Digital converter. more novel practical applications this converter, decode number keys. technique connect keys resistive voltage dividers converter inputs. example detection using keys illustrated this note. Using Analog Digital converter this fashion does require static current avoids false detection. BASIC CIRCUIT basic circuit decoder consists pull-up resistor connected Analog Digital converter input with first directly switching ground. following keys then connected sequence input through serial resistors. number keys which detected depends tolerance resistors used. seen that more than pressed same time, detected will next chain closest input. This also allows keys keyboard prioritized.
AN431 09,92
1/14
ANALOG KEYBOARD
PRINCIPLE OPERATION combination pull-up resistor, serial resistors pressed form resistive voltage divider, generating different voltage input each pressed. serial resistors selected order give equal distribution voltage between each switch combination give best noise margin between keys. When pressed, voltage input given activated voltage divider. This analog voltage converted digital value used determine which switch closed. successive conversions made avoid influence bounce. Figure Analog Keyboard resistor matrix
Figure Multiple press
2/14
ANALOG KEYBOARD
Table code ranges
Valid Code Range
18-1A 30-33 49-4E 63-68 7C-81 97-9B B0-B4 CA-CD E5-E6
Distance next
pressed, voltage measured always zero. keys, resistor values should selected such that voltage second from VDD/n, 2xVDD/n, 3xVDD/n (n-1)xVDD/n. Resistor values from tolerance used must selected meet this requirement. recommended resistor values 10-key keyboard with resistors from series, used with pull-up resistor, shown table more current allowed, then resistor used which case serial resistor values should divided
Table Used resistors Tolerance Resistor
Value
10000 1100 1300 1800 2400 3300 5100 8200 16000 51000
9800 1078 1274 1764 2352 3234 4998 8036 15680 49980
10200 1122 1326 1836 2448 3366 5202 8364 16320 52020
3/14
ANALOG KEYBOARD
PRACTICAL LIMITATIONS Theoretically, ideal power supply, resistors, keys could detected. Practically however, necessary take into account potential errors coming from: power supply resistivity resistor tolerance error power supply tolerance normally neglected providing noise present frequency within above frequency range delay resistive divider, reference normally provided power supply ST6. family members with external reference voltage inputs, AVDD AVSS used instead VSS. sensitivity normally neglected, resistance divider high comparison resistivity significant, should added "serial" pull-down resistance different dividers. resistivity variation must also added tolerance serial pull-down resistor (see resistor tolerance following). resistor tolerance affects tolerance dividers. situations must taken into account: minimum value pull-up combined with maximum values pull-down maximum voltage divider input. maximum value pull-up combined with minimum values pull-down minimum voltage input. These cases give maximum voltage variation each divider (see Table voltage variation ranges dividers must overlap otherwise cannot decoded, even with ideal converter. Table Effective Divider Resistors
Active 1078 2352 4116 6468 9702 14700 22736 38416 88396 1122 2448 4284 6732 10098 15300 23664 39984 92004
Realistic converters require margin between range variation. case significant variation resistivity, maximum resistivity added value pulldown resistor case case error needs added resistivity cannot less than
4/14
ANALOG KEYBOARD
linearity converter normally specified LSB, therefore minimum distance needed between edges resistance tolerance ranges. best results, minimum should used (see Table Table Voltage ADC-Input,Converter Results supply)
(Rxmin-Rpmax) Active 0.00 0.48 0.94 1.44 1.94 2.44 2.95 3.45 3.95 4.48 hex. dec. 0.00 0.51 1.00 1.52 2.04 2.54 3.05 3.54 4.02 4.52 hex. dec. (Rxmax-Rpmin)
Table AD-Converter Results
Active Error Range (LSB) Distance next Valid Range 18-1A 30-33 49-4E 63-68 7C-81 97-9B B0-B4 C9-CD E5-E6
5/14
ANALOG KEYBOARD
EXTENSION WAKE family members with Analog input capacity also generate wakeup operation (from WAIT STOP modes) pressing key. This achieved modification circuit shown figure pull-up resistor connected additional port bit. During polling, this additional port output mode active high, thus effectively switching pull-up resistor. resistance pull-up resistor must high enough give significant voltage drop, resulting error must calculated taken into account. other used Analog input original circuit. During wait press, first pin, used pull pull-up resistor high while polling, switched into high impedance state (e.g. open drain output mode). second pin, used input while polling, switched interrupt input with pullup mode. internal pull-up range 100k, comparison external resistor used during polling. pressed interrupt will generated voltage second below Schmitt trigger level threshold. serial resistors keyboard chain must high this case, therefore maximum number keys reduced comparison normal mode.
Figure Keyboard wake-up circuit
Figure Keyboard reading
Figure Interrupt configuration
6/14
ANALOG KEYBOARD
APPENDIX Input Polling
SGS-THOMSON GRAFING APPLICATION NOTE inputs multiple decoding With inbuilt converter easy implement small routine which enables port pin, con* figured input, decode different switches* that necessary port input Then program runs endless loop until connected keys pushed. value from data register then used decide program will continue,on reaction key-push. ;***REGISTERS*** ddrpb orpb drpb adcr .def .def .def .def .def .def 0c5h 0cdh 0c1h 0d0h 0d1h 0ffh ;port data direction register ;port option register ;port data register ;A/D data register ;A/D control register ;accumulator ;***CONSTANTS*** inpall peg1_2 peg2_3 peg3_4 peg4_5 peg5_6 peg6_7 peg7_8 peg8_9 peg9_10 .equ .equ .equ .equ .equ .equ .equ .equ .equ .equ 000h 00ch 025h 03eh 058h 072h 08ch 0a5h 0beh 0d9h ;used setting pins input ;border distinguish between switch1 ;border distinguish between switch2 ;border distinguish between switch3 ;border distinguish between switch4 ;border distinguish between switch5 ;border distinguish between switch6 ;border distinguish between switch7 ;border distinguish between switch8 ;border distinguish between switch9
switch2 switch3 switch4 switch5 switch6 switch7 switch8 switch9 switch10
7/14
ANALOG KEYBOARD
loop:
sw1:
jrnz jrnz jrnz jrnz jrnz
;sets port pins input ;option register: ;sets high, rest drpb,01h ;direction register: ;sets high, rest becomes analog input pb1-7 become input with pull-up, used here (only analog input same time) adcr,30h ;A/D control register: 0011 0000 -activate converter -start conversion -disable interrupt 6,adcr,loop ;loop until Conversion ;set (indicator that conversion ;been completed) a,adr ;load with result ;conversion ;now result compared with ;switches a,peg1_2 ;compare with peg1_2 ;A/D result smaller than peg1_2 switch1 pressed: jump a,peg2_3 a,peg3_4 a,peg4_5 a,peg5_6 ;compare with peg2_3 ;A/D result smaller than peg2_3 switch2 pressed: jump ;compare with peg3_4 ;A/D result smaller than peg3_4 switch3 pressed: jump ;compare with peg4_5 ;A/D result smaller than peg4_5 switch4 pressed: jump ;compare with peg5_6 ;A/D result smaller than peg5_6 switch5 pressed: jump
ddrpb,inpall orpb,01h
sw2:
sw3:
sw4:
sw5:
8/14
ANALOG KEYBOARD
sw6:
jrnz jrnz jrnz jrnz
a,peg6_7 a,peg7_8 a,peg8_9 a,peg9_10 sw10
;compare with peg6_7 ;A/D result smaller than peg6_7 switch6 pressed: jump ;compare with peg7_8 ;A/D result smaller than peg7_8 switch7 pressed: jump ;compare with peg8_9 ;A/D result smaller than peg8_9 switch8 pressed: jump ;compare with peg9_10 ;A/D result smaller than peg9_10 switch9 pressed: jump ;A/D result greater than peg9_10 switch10 pressed:
sw7:
sw8:
sw9:
sw10:
;*** routines handling reaction individual presses ;*** included here. s10:
9/14
ANALOG KEYBOARD
APPENDIX Input Interrupt
SGS-THOMSON GRAFING APPLICATION NOTE inputs multiple decoding With inbuilt converter easy implement small routine with which recognize nine connected keys pushed creating interrupt. program then decide will react pushed. ;***REGISTERS*** ddrpb orpb drpb adcr .def .def .def .def .def .def .def 0c5h 0cdh 0c1h 0c8h 0d0h 0d1h 0ffh ;port data direction register ;port option register ;port data register ;interrupt option register ;A/D data register ;A/D control register ;accumulator ;***CONSTANTS*** inpall peg1_2 peg2_3 peg3_4 peg4_5 peg5_6 peg6_7 peg7_8 peg8_9 .equ .equ .equ .equ .equ .equ .equ .equ .equ 000h 00ch 025h 03eh 058h 072h 08ch 0a5h 0beh ;used setting pins input ;border distinguish between switch1 ;border distinguish between switch2 ;border distinguish between switch3 ;border distinguish between switch4 ;border distinguish between switch5 ;border distinguish between switch6 ;border distinguish between switch7 ;border distinguish between switch8
switch2 switch3 switch4 switch5 switch6 switch7 switch8 switch9
en_kint (enable key-interrupt) sets registers that pushing will cause interrupt. This subroutine must called re-enable interrupt (e.g. after handling service routine)
10/14
ANALOG KEYBOARD
en_kint: ddrpb,inpall orpb,02h drpb,01h ;sets port pins input ;option register: sets high, rest ;data register: sets high, rest becomes input, pull-up, becomes input with pull-up int. pb2-7 become input with pull-up, used here ;interrupt option register: enable interrupts reset falling edge int.input(#2) ;return calling address
ior,10h
;*** hd_kint (handle interrupt) interrupt service routine ;*** evaluates data resulting pushing key. ;*** Interrupt vector (0ff4h 0ff5h) must point (jump) hd_kint. hd_kint: drpb,03h ddrpb,01h ;data register: 0000 0011 ;data direction register: 0000 0001 becomes output ;option register: 0000 0011 pb0: push-pull output pb1: ADC-input pb2-7 become input with pull-up, used here ;A/D control register: 0011 0000 -activate converter -start conversion -disable interrupt ;waits until Conversion (indicator that conversion been completed) ;load with result conversion ;now result compared with values which represent different switches
orpb,03h
adcr,30h
loop:
6,adcr,loop
a,adr
11/14
ANALOG KEYBOARD
sw1:
jrnz jrnz jrnz jrnz jrnz jrnz jrnz jrnz
a,peg1_2 a,peg2_3 a,peg3_4 a,peg4_5 a,peg5_6 a,peg6_7 a,peg7_8 a,peg8_9
;compare with peg1_2 ;A/D result smaller than peg1_2 switch1 pressed: jump ;compare with peg2_3 ;A/D result smaller than peg2_3 switch2 pressed: jump ;compare with peg3_4 ;A/D result smaller than peg3_4 switch3 pressed: jump ;compare with peg4_5 ;A/D result smaller than peg4_5 switch4 pressed: jump ;compare with peg5_6 ;A/D result smaller than peg5_6 switch5 pressed: jump ;compare with peg6_7 ;A/D result smaller than peg6_7 switch6 pressed: jump ;compare with peg7_8 ;A/D result smaller than peg7_8 switch7 pressed: jump ;compare with peg8_9 ;A/D result smaller than peg8_9 switch8 pressed: jump ;A/D result bigger than peg8_9 switch9 pressed: jump
sw2:
sw3:
sw4:
sw5:
sw6:
sw7:
sw8:
sw9:
;*** routines handling reaction individual presses ;*** included here
12/14
ANALOG KEYBOARD
;*** Each routine must with following lines order enable ;*** another interrupt when next pressed. call en_kint enable another interrupt reti
return:
13/14
ANALOG KEYBOARD
SOFTWARE INCLUDED THIS NOTE GUIDANCE ONLY. SGSTHOMSON SHALL HELD LIABLE DIRECT, INDIRECT CONSEQUENTIAL DAMAGES WITH RESPECT CLAIMS ARISING FROM SOFTWARE.
Information furnished believed accurate reliable. However, SGS-THOMSON Microelectronics assumes responsability consequences such information infringement patents other rights third parties which result from use. license granted implication otherwise under patent patent rights SGS-THOMSON Microelectronics. Specifications mentioned this publication subject change without notice. This publication supersedes replaces information previously supplied. SGS-THOMSON Microelectronics products authorized critical components life support devices systems without express written approval SGS-THOMSON Microelectronics. 1994 SGS-THOMSON Microelectronics rights reserved. Purchase Components SGS-THOMSON Microelectronics conveys license under Philips Patent. Rights these components system granted provided that system conforms Standard Specification defined Philips. SGS-THOMSON Microelectronics Group Companies Australia Brazil France Germany Hong Kong Italy Japan Korea Malaysia Malta Morocco Netherlands Singapore Spain Sweden Switzerland Taiwan Thailand United Kingdom U.S.A.
14/14

Other recent searches


WP7083SED - WP7083SED   WP7083SED Datasheet
SSP45N20A - SSP45N20A   SSP45N20A Datasheet
MO-038AB - MO-038AB   MO-038AB Datasheet
LV5254LG - LV5254LG   LV5254LG Datasheet
EL5102 - EL5102   EL5102 Datasheet
EL5103 - EL5103   EL5103 Datasheet
EL5202 - EL5202   EL5202 Datasheet
EL5203 - EL5203   EL5203 Datasheet
EL5302 - EL5302   EL5302 Datasheet
FN7331 - FN7331   FN7331 Datasheet
AT697 - AT697   AT697 Datasheet
ASR152IWW - ASR152IWW   ASR152IWW Datasheet

 

Privacy Policy | Disclaimer
© 2013 Datasheets.org.uk