of Ada T sk in f or Se sor an d Co tr l pplic atio aul R PDF document - DocSlides

of Ada T sk in f or Se sor an d Co tr l pplic atio aul R PDF document - DocSlides

2014-12-11 89K 89 0 0

Description

Puk ite DAI NA pukitedainaco ri ti c on rol s of are i t he A pro gra in l ua e ay ot ra k as a popu ar m et d bu t iv en a ch nc e di a ca pa o ren s n part ic ul th e lo ran e ne ed o m in en ce an port abi li ty ca n be et t ro ug t e appli at i ID: 22021

Embed code:

Download this pdf



DownloadNote - The PPT/PDF document "of Ada T sk in f or Se sor an d Co tr l ..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentations text content in of Ada T sk in f or Se sor an d Co tr l pplic atio aul R


Page 1
of Ada T sk in f or Se sor an d Co tr l pplic atio aul R. Puk ite, DAI NA pukite@daina.co ri ti c on rol s of are i t he A pro gra in l ua e ay ot ra k as a popu ar m et d, bu t iv en a ch nc e, di a ca pa o ren s. n part ic ul , th e lo -ran e ne ed o m in en ce an port abi li ty ca n be et t ro ug t e appli at io o A so are e ng ee prin ipl es. A on t e cri ti ci sm s l el le a ga in st A da , th d eba te abl e i ssu s o t m uc co pl ex ty siz e, a d lo perf an e le ad t e ay. Opp nt s al so po in t th De part en o De en se ad pti n A a in al l ne a ppli ca ti s. Th e su al a nt h i s t at i th m il it ary u se s i , i t st be obso et e (w he re i is A a). On th e c on rary, a i s e o e f ew la gu es en in ere d rom t e g ro d to su pp rt bo th sm ll d m ll io -l in es -of -c od pl ic at io s. part ic la , ny of th c urre nt A eri ca a nd Eu ro an de si gn f co erc ia l ai rcra f ig c on rol s te s an a ir tra ic co tro sy st em s a re im en ed in A ssu a co tm en t to a, a cro co put er appl ca ti n ev lo per il l in t at t e A c di co st ru ct s al lo or de el en o so ph sti ca te a pl ic at on s. F r ex ple , a s c nc rr cy f at res rel ie ve s th e ev r o a cqu iri a ti -ta sk in o pe ti sy st em , lt ta sk in l ng ag l ibra es , a /o r a di io al c de f r t as k sch ul ng I f ac , t e lt -in ta sk in f at re o da rem ns a c ns ist nt o ed t oo f r a PC d el ope r o w ish s o de si gn r pro to a m lt e sen so r-base sy st em Wit t e ce t abu da ce o re la ti el i ne pe siv A co pil ers av ai abl e f r DO S, do s, a d ac in sh pla tf rm , th e ber of a us ers as ste ad ly in as ed g t a sta rt in a, it c an h rt to ha e a li in Pas ca l o r la -2, an to a l ess er ex en NS I C o C ++ (to g t sed t st ri ct er t pe c ec in ). Th e sta ard iz ed a la ng ge re eren e an l, a ro st pu bli n a in erpret er (A /E co er (G NA T), reu sa ble co e li brari es, a nd sty e ui es are a va la e th ro h ar us so rce s o t e nt ern t 1] or on an i ex pen iv e D- OM [2]. S ev era l boo s on esi n an pro ram in pr ct ce s a re a so av il abl e. F r a i nt st in A e xa ple , a re ce t arti le d es cribe s t e ev el pm en o a m od l rai lro ad co tro le r a pl ic at io f r a c ll eg c la ss[3] 1. as ki g appl cat a t ask g i s u su al ly n t t e f irs t co ept tro ce in t he le arn g pro ce ss, but f r th e sak of d eren ia in a ro Pa sca l , i m a s w ll be . sh rt, i cl in A a t ask to a p ec e o co al lo s a ppli ca ti co ta n re th n e t rea o c on rol . T us , t as ki a s sed as th sa an g as in ot er co cu rren en appli ca ti s, i s a i te l part o t e l an ag in st ea of ay, e o pera ti g s te . I th e f lo ng esi n an d scri be a sim ple A a ta sk in ex am ple t ha t al lo s th re e ral le l ta sk s to o pe te 2. Desi n a en eri c esi n a co cu rren a pp ca ti on a h ig le el proc es s r ta sk ll be ssi ne ea ch ut om us rat io , be it ta ol ec ti on on ro l ti n, d so . pi cal y, th f ti ns re at at p re et erm ed ti in al s, ki a m ti -ta sk in a ppr ch a n tu ral m appi ng to t he probl em do ai n. F r PC -b se d s te , s om e per di c t ask g f ct io s th t co e to m cl ud : m to in s eri al po rts N, c nt ro ll in a pri nt er , ba ck ro un at a lo in , se co tro , ck ro nd e ck p,
Page 2
o Ad a as ki ng for Sensor nd Co nt rol Appli ca ion periph (DSP , C D-R OM et ) c on rol , an v rio s d ic at ed in erru -to -t ask pi gs Ou ex ple re qui res t hre e ta sk s. T he a s ci ie a s ol ow : (1 ) t ask r ch ec in a d ec oi c on en s o th k ey bo ard bu ev 2 se co s; (2) t ask r di pla t he w ll c oc i n se co s a t 0 sec d in erv al s; (3 ) t ask to be ep on e ev ery 20 sec nd e an t he t as ks t o st art au ti ca ll a er lo di t he pr ram , pref rably a s tra ns paren ly a s p sibl e. F ig re 1 sh s t e ta sk repre sen at io (t e ral le lo ram s re pr sen A t ask s) FI GURE k a si gn ent s d fre que nc es 3. di st in 1 is -p re em ve A da pro ram at ru s th es e ta sk s c cu rren tl y. T e da c e i s sh rt an c ci se. ai pro ce ca ll ed Task_Dem en apsu la es he th ree t as ks , w it t he bo o t he m ai pro ce du re pr ef in as a ta sk . Th th tw ta sk s, Keyboard_H andle an Seconds_Displaye a re spec if ed an t he c od a s est ed ta sk s. F r ea ch ta sk , t e f un ti al e w it in t he lo p i s a ssi ne t d is ay arbit rary in at on th at ul be m re co x in a al a pp ca ti n (see T abl e or am c on en io s) u erst nd th t ask o pe ti , e s o t loop, delay an duratio k ey rd s. On e a ta sk st art s, i ty ic al ly en ers loo a d th n en ou ers dela st at nt . A t dela , ta sk e xe cu io pa ses f an am ou duratio (in sec ds Du t hi s se, t e da ru 0.05 H 0.1 H 0.5 H ey bo ard ask lo oo in as ec k ey bo ard d ec spla w ll c lo e in sec nd be ep t e spea er (1) (2) (3) ti sea rch s f or o er ta sk s t o i ok . I an he r appli ti t ask i s rea dy, t e -t im e w l sw it h ex cu ti t o th t ta sk . Ot he rw is e, t he f rst ta sk dela i te rv al t im es ut a t he e ec te s i ts f ct io al c de . T hi s ro ess th n repe at s v a th loo k rd . n ef ct dela k ey rd s pl ac ed it in t loo bo ie s al lo ta sk sw ch ng to t ak pl ac e t ran spa ren tl y. F ig re sh s th m appi ng o ta sk s o ti ag ra . T he v ti ca l arro s t to w he re dela st at em en s t im e-o t or ea ch t sk . No te t at a er ev ke boa rd i nt erv l (b ee n th a ro s), t e A ru -ti c he ck s or th er run ng ta sk s, ic m o r m ay n be sch ul ed to cc ur at lt es o t e k rd in erv al . I t is w ay , a ta sk sc ed li g is n t base o absolut ti bu t rat er lat iv es . hu s, sc he li g ho d ta ke nt ac co t th e el ay pl s t he t ask ex ec ti ti . Th co st en su re th t su ic ie t t e or s it ch g ee n th ta sk s o cu rs, o th rw ise t e spec if ed d la i nt erv ls ee d t be m if ed (A t th e lo li t, a d la o 0 se nd s ld s im c he ck or an o he r t ask s e l or ig er ri rit bef re ret urn g) Th ex pl e l ste h ere d em stra te s n -pr em pti e ta sk in f r pree pti e a ta sk in , a ai ti t ask w il l pr em pt o r in erru pt a ru in ta sk if i t i s rea dy t ru an as a hi er pri ori y. r t e m st part , i t as k un ti s are a f ra ct io e cl e p rio , an pp ca ti n co si sti ta sk s can be a to at ic al ly sch du ed us in t e on -pree pt iv e appro ac h. Pre em pti n pp i nt rupt s t t as k en ry poi ts sh ld be u se f r appl ic at io ta sk s w it h ig er ge cy or stri ct er ti g ea li ne FI GURE A t mi ng di agr m f t as k s chedul ng ss umi ng t hat t sk e ut on i ns ta nta ne us 0 se 30 se 0 se 20 se st art el ra ti rd clo ck in 40 se im
Page 3
Ada ask ng for Sensor an d Contr Appli cation of 4. Co pi Th e ta sk ng ex am ple a pl ic at on as co pi le w th th eri di n a ve rsi on 1 DOS co pi le r [4]. Th e en ire pr ess requ s r s te . (1) W s et u p a n ew ire ct ory to ho a prog ra l ra ry (f or ex am ple c:\ada\d em ). Th en at t e D OS pro pt w th n th n ew ire ct y, i ssu th an s (2 newli , (3) ada taskdemo.ad (4) bam , t c rea te a d ire ct ry, c pi le t he c e, an t en bui d (i. e. li ) t he A m n pr ram ch ng s a re requ ire d in th co , t en e on h av t o rebu il th co it he ia a il ty amake.exe. Th s i s po ssi ble a s t e co pi le r a ut ti ca ll m ai ta in s th ibra ry nf rm io p to at e, it ou th e pro gra er ee di t o rit e a spec ia l ke il 5. Run g t e ex pl Th e ll in i s t pic al o tpu , w he re th a ke i s pr sse , a pa us e oc cu rs or 2 a m in te , an t en t e b ey i s pre sse a->a Time: 24525.870 Time: 24535.9100 (be ep Time: 24545.980 Time: 24556.0300 (be ep b->b Time: 24566.069 Time: 24576.1200 (be ep Time: 24586.170 Sto ppi ng th pro requ ire s a co tro brea . No ic e th t th t im e tw en cl ck u pd at es i s n t ex ct ly 10 sec nd s bec au se th ispl ay de xe cu es in rac ti on se co (th s c an be t ak n ca re of ad us ti g th duratio ac co rd in t t e s ste cl oc ). Th s s a si ple am e. st da en iro nt s ca lso ac ce ss asse bl er i ne m ac in e co , m ak OS ca ll s, to port s r in erru s, in -ro ut ne s, nd prese t or pac k at a. M st o pera ti g sy st em a su ppo rte , i cl in M cro so Win s. re c pl ex a pp ca ti ns f r co tro li o r m to ri ng in st rum en at io a re el l it in th rea ch of a s c apa it ie ef ren ce [1] F e tr ans fe r pr ot co (F P) s te a re c ons ta ntl c hang ng , the re fo re us e an I er net t oo suc as A chi e, V er ca , or phe r t d o a se rc fo r TP d ec to s or f ma tc hi ng a, a- NA T NU da ans to r) , tc . (c se se nsi ti ay be i mp or ta nt) [2] W nut Cre ek CD- ROM, ui e 26 0, 154 7 Pal os V de s Ma , nut Cr ee , CA 94 596, 1(510) 674- 078 [3] J.W . Mc Cor mi , A Mo el Ra ad f or A a So twa re En ne er ng , Comm ni ti ns f t he CM, Nov mb er 19 92, p. 68 (s pe s ct n o a) [4] Me 10 Pas te ur St ., I ne, CA 9271 8, 1(80 0) 22 1- 522. No w pa rt o f Rat nal S ftwa e, I nc ABLE 1 Li ke Pas ca , Ada i not t pe -s ns ti o we us ca pi ta at on to i mprov bi ty Lowe r- te rms s gni fy Ada re rv key words . T rms ke CHARACTE a nd ASCII.BE ar s st m de pende nt ut uni rs de fi ned. Li ry packa s uch Calenda Text_I a re st anda rd and or ta bl t mos t e nv nme nts whi TT a nd SPI a e prov de wi the s pe fi c Ada ( Me ri di n) compi er de ntifie Ca Exam pl Bu re se rv owe task, delay, begin, with , packag te m l ra Upp CHARACTER, ASCII.BE ta rd A l ra Mi Text_IO, Calenda Othe r l ra ri Mi TTY, SPI Use r- ef ne Mi Time, Char, Keyboard_Int erval, Task_Dem
Page 4
o Ad a as ki ng for Sensor nd Co nt rol Appli ca ion st in 1 : C pl et e co e or task_demo.ad with Calendar; -- li brary package for system cloc with Text_IO; -- li brary package for file and standard I with TTY; -- li brary package for console I with SPIO; -- li brary package for special IO function procedure Task_Demo i package Clock_IO i s new Text_IO.Fixed_IO( duration ) Keyboard_Interval : constant duration := 2.0; -- in second Clock_Interval : constant duration := 10.0 Beep_Interval : constant duration := 20.0 task Keyboard_Hand ler; -- Specificatio task Seconds_Displ ayer; -- Specificatio task body Keyboard _Handler is Char : CHARACTE begi loop -- Echo k eyboard at frequency 1/Keyboard_Interva delay Keyboa rd_Interval while TTY.Ch ar_Ready loo Char := T TY.Get Text_IO.P ut( "->" ) Text_IO.P ut( Char ) SPIO.Flus end loop end loop end Keyboard_Handl er task body Seconds_ Displayer i Time : duration begi loop -- Displa y clock at frequency 1/Clock_Interva delay Clock_ Interval Time := Cale ndar.Seconds( Calendar.Clock ) Text_IO.Put( " Time:" ) Clock_IO.Put ( Time ) Text_IO.New_ Line end loop end Seconds_Displa yer begi loop -- Beep s peaker at frequency 1/Beep_Interva delay Beep_Inte rval TTY.Put( ASCII. BEL ) end loop end Task_Demo

About DocSlides
DocSlides allows users to easily upload and share presentations, PDF documents, and images.Share your documents with the world , watch,share and upload any time you want. How can you benefit from using DocSlides? DocSlides consists documents from individuals and organizations on topics ranging from technology and business to travel, health, and education. Find and search for what interests you, and learn from people and more. You can also download DocSlides to read or reference later.