0% found this document useful (0 votes)
377 views88 pages

Elektor 2007 br.01 PDF

Uploaded by

sokolsokol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
377 views88 pages

Elektor 2007 br.01 PDF

Uploaded by

sokolsokol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 88
lektor Fa lectronics leadimg the way EXPLORER-16 Microchip PIC24F Design Ser — I eS heron Chester <=> > GLY l CD-ROM UY N =H [oy eat WV BV 3K oo) acer vena labcenter, Tne tied to amaty the From a pheno eardge to ine eel 19 70 can Ws {Sur latte eth the CD or timer np on You HEFL pie The conga sultable fr 12" LPs and sa Bons for RIAA equation ofl the aly ed 78 Paste note tat ne ip ofthis design means ts only rede: sor bu os ee Tee ocea oe eri ad woes ere By mong Jour hand etween the metal antennae fate ul Sum effec! The Therein Mi prover on ts pracecesn by sows aches to ‘etal gual by proving beter waveform. With ‘mute of ono fue nsuments masa! potent tony led by the stl and inaginaton of fs player sds stan PCB ith overs, machined cae th ieee cd fe me Requires 9-22VDC' wall sdopter (Maplin sucoie £13.99) Hand Controller IR Remote Control Extender MKII || Digital Adjusters Operate your OVD payer ital decade using te reat conta ron ster or. pcs up the Sal from te emote cont and ses twa ure cbt mated LED lcsed Gove the ins eproved model fetes et te oc, copale of wansiting Foxtel Sigal emote conto gnawing te Pace 400 sie decoder pried Wont panel PCD program the sree the nd is pot required for oe fase, PCB, LED, and Requires 9VDC wal cerpeneni, ‘aptor opin segran £1099) Log on to Porm eene en (eater DS Pay Pa Cn ere este Ge eaeensentara coe tetany Eee Pareterr rene cnt Battery Zapper MKII “This fl altacks 2 comune cals of Tale in wet lead ei al bates slphation. The cae Teverse the damaging supeon elec Tis pew Improved unt estures a batery heath checker eo crest poten aganst baal sulfated bates test plas for DMM tnd connection fora batery charger Kit " ‘zeen pied bd PCB ‘This hand contr used fo ttupoing/pageamming the icependanteecronic boost controle Ki Ghoti eqn feature abe Ee CD, and easy to use puss natons It ean be vied 10 emanenty connec o pay the shuts ur value 20” 149.99 650 515399 10 6500s fro0- E1939 20 ‘Max weight 12 (skg)-Meavier parcels POA. Minimum order £20. ete roduc te dpa rm Aust Seah cete y Sosy scfhigh level energy '@ Galactic Voice Kit Be the eny of everyone at the nent Interplanetary Conference for Ei Beings wih this glue voce simulator kt lect apd deh cont iow you to vary the elect to malate everyting from the ‘etal chalenged CPO, tthe hysteria ‘antng of Dales el-bent on exerrinaing Syting ot nated dove. The ‘includes PCB with High Performance Electronic —>>Relai Gene Projects for Cars Book —Sesgialv gnome = Daan ung Goro dei Sih i ar epe aa Pach reeanien Tose Sea nna emai ee resent ores cymes one oer cae eine ee Dg iota tel abel Sa ele ett htore sce ee Cred baareesict toe soak for Independent Electronic Boost Controller Iran be ate in crite ith aay electronic Dood nial ig te any concn or cars without electronic boost conal using @ ‘Stent fom avec ete Ths deal or Sthing betwean sy, a raelsteet mode, of Peformance! wet weather mode Boost cave SSleaion vias dashboard sth nd a programmed wing tne handheld digital eontoer chown el. Ki supped wath rcined ease ond amponens. Sabie for Fad engine management ‘ystems oni a mn cemsved et am inrace and spay, nel aduster futons er 3 iti pin ies rye z COPE PC Oscilloscopes & Analyzers DSO Test Instrument Software for BitScope Mixed Signal 11 Oscilloscopes 4 fale! elec 2 Channel BitScope Pocket Analyzer BitScope DSO Software for Windows and Linux sont ofiare fer your ined signal scope, 0 suppor them al waveforms lve [ust Ike an analog scope tegration means you can View the same daia ia of @button, students or oe replayed Data exports avalase for use wn third nary stare feels ana SnScope's nenworked ‘ata acqustion capabilies are lly supported. Teaming up If you are notin the electronics industry or without @ formal qualifice tion inthe fiald, it may be good to reclise that electronics as a pastime would be non-existan without the wide dveriy of manufacturers of equipment, tools, components ond, recenily, software to run on your PC, ol forgeting a growing number of PCBiosrder service providers. Alhough some readers have expressed a desire to see a version of Elaktor Electronics without any ‘advertising pages, short discussions ‘on the phone or by email are vsvally sulficiant to agree thot theie vision is unreolisic. For one thing, our odvertsers make up for @ goed part of our income, the ether main pillars being subscribers, newsstand soles ‘ond product sales. On the other hand, from o reader viewpoint, ad- vertisers are the galeway to services ‘and products (including components ‘and tools) that are essenial to enjoy clactronics as a postime, or pursue it at ony level in education, Sure, od hands with « fully looded workshop may object to sesing bast cally the some advertisers for years fon end. But then, when I was leorr- ing about electronics ot 2 relatively young oge, |bolieve | got as much information and fun aut of browsing ates comporing component prices fond seeing the big nomas in industry, than from actually reading articles, tying fo understand it al and bul ing circuits infront fm lLam hoppy to say that Elektor Electonics is ofracting on inereos- ing number of companies, big and small, adveriser ot no, wishing to fun projects with us. Without their input we would not have been able to publish hugely successul project ike the ESIM DVD (October 2006; mis: cellanzous sofware suppliers), RFIDs (September 2006; Philips/ACG/Vi sioncard) ond RBC Tom Thumb (Fab- ruary 2006; Renesas/Glynn) in the past year. With this Janvory 2007 issue come hwo massive contribu: tions, one from edverisrs Mirachip cond labeenterin the form of @ fee CDROM coupled 100 16-bit micro- conta devlapmen ki he ther from Colinbus offering 0 kit of parts tocomemble oiling machine for use in the electronics of mechanical work shop. Both deals have token us much cffort to arrange exclusively for you —or should I say ‘fr your pleasure’ ‘More isin the pipeline Jon Buiting, Editor he Ssironics Milling If ever you dreame: your own mil workshop but four expensive, we hav solution for you. Working in close collab: g mac we present Profiler, a construction kit that ena- bles you to build a pro- fessional milling mac for a fraction of the cost of a ready-made model nine IFever there was a golden opportunity to move on to 16-bit microcomputing at a serious level, join Microchip, Labcenter and Elekior with their groundbreaking Explorar-16 project. As a kick off, you get a free CD2OM this month, allowing you to install ‘Microchip MPLAB IDE as a development platform, MPLAB C30 for language compiling and Proteus VSM for some really powerful simulation right up too complete PIC24F system. 20 Explorer-16 (1) The most advanced oe atomic clocks are breath- 58 takingly accurate, many millions of times more so than the best quartz-bosed clocks. How do they manage il? 60 Jens Nickel reporis. Filly years after the launch the first arifcial satelite, it seems fiting to build a clock in the shope of the Spuinik-| that combines a nostalgic Nixie tube display with @ modern microcontroller and a lightweight state of the high-volt age supply in a single design. Volume 33 January 2007 no. 361 The Quest for Accuracy ‘Profiler’ Milling Machine Explorer-16 (1) Sputnik Time Machine Berlin Clock Remake Text at the Speed of Light FPGA Course (8) Design Tips Blinking Christmas decoration Test beeper for your stereo Improving RFID Reader Sensitivity Display Recycling technology Clocking, Texas Style Turbo Tricks Scoot me up, Scotty Warp Speed on Demand Colophon Mailbox News & New Products Elektor SHOP. Sneak Preview Electromechanical switching technology Hexadoku lektor lectronics SS Volume 33, Number 361, January 2007 ISSN 0768/4519, jae "ear Elec sins at pring pple to master laconic ny persona levy presenting contruction projects and speing evelopment Sacre nd normation ecg. Graphic design DI CD Manag Deer / Pub: Masheting astm Serves e © Segment bv. 2007 Printed in the Netheriands pooling for standard boards Bre eee a from 3 working days onwards Revie) Online price calculation niece ais} = pooling with more options Cine crete) 7 up to 8 layers oI Hey, from 1 to 1000 pieces One ee CUT dia) = from 3 working days onwards Interested? Contact us; +44 2088 167 005 or Sa Eerie stort iets igat sla) ee ear Www.eurocircuits.com oS ANS pasar ElmScan 5 USB Scan Tool + Disgnote any car wth EOBD + 9600 oF 36400 baud {Based onthe ELM327 C+ Supported by more software than ‘Support all EOBD and OBO. any other OBD interface protocols + Inaxpensiva Y ISOIS7ES-+ (CAN) + Full Speed USB LL 1801423044 (Keyword 2000) + Automatic protocol detection Y1SOPI41-2 + Package includes cables, sofware iaso vow (CO, and Quick Stare Guide 1850 Pw + Buy from your loca UK dstrbutors! www.ElmScan5.com/elektor 6 eon eleicnks - 1/2007 is another major milestone in the evolution of this extremely 2S popular software tool. Try a demonstration copy of Easy-PC */ ‘and prepare to be amazed at the power, versatility and remarkable value for money. M Layer & Via Stack Previews Blind & Buried Via Support Teardrop Pads Draw Spacing Cl Plus many mare exciting features. Fully integrated Schematics & PCB layout in a single application complete with forward and back annotation. Design and rules checks at all stages ensure integrity at all times. Professional manufacturing outputs allow you to finish the design process with ease. Stop press... Stop press... Stop press... Stop press Easy-PC imports Eagle files as well as Tsien Boardmaker 2 files 6 ‘all for brochure, prices & CD on +4 (0)1684 773662 ‘or e-mail alas@numberonecom you ean also download a demo from www.num ‘Oak Lane, Bredon, Tewkesbury, Gls, GL20 TLR, United Kingdom ee I ql lH ,erone.cor No Compromise Oscilloscope Cee at ens eon Pee eee ae ee ee Penticton eter every engineer can affor 1GSis sampling rate 250MHz bandwidth 128M sample buffer memory 125MS/s 12 bit AWG bul in PicoScope 5203 32M buffer £ 2199 PicoScope 5204 128M buffer £3299 VI08T ltr deci INFO & MARKET PULULT) 4 Electronics for youngsters Dear Jan — I have been sub- scribing fo Elekior Elecronics for a couple of years - and quite fronkly | think you are missing a tick or wo. Many of your projects are exire ‘mely clever and interesting, cond in quite a few designs i ‘oniicipaes the reader has ac ‘quired « PhD in Elecironics or ‘Communications Technology! The bulk of your projects are for too complex for he moj ‘ity of 11-15 years olds! You ‘need to nurture and encoure: g¢ this age group — they are potentilly your future readers ‘and contributors! My advice is o allocate 15- 20% of the magazine to less complex projects that school 1 Hexadoku November 2006 solution i 1 [Ay4]FJe]clo[9]@]7]3]1|5]6]2]8]0]! 1 (el7[el2[4[ola[alelr[elols[a|sic|} 1 {olelols|7|2lelslalclolel1lalelrlr ‘ [clsjols{s[elelrl4|2[olslel7|olal! i (efelelats|slalilF[ololel2talci7| i ‘ I7[cls[r[s[alole|s{4[s[2[olalele| ! 1 [3[e/plel2|cl4[elels|al7lolF lio]; '{2[r[alolrlel7(olclelels|slelsia|: | [sfol2[s[al7[slclols{s[a[selFle] | i folF[s|BliJelslelslal4|plalci7|2|1 1 Slelstelols[olsi2i7{F [ciel i alo}! 1 LJalcl7folFl2[(4le[s[Blelslslola|; ' {afe[elolelals(olalelclrl[7ialai4 | (Efol7{efel+lF[e[stel2lalc|o[4ls 1 [Fl2|1|clo/9[3[7|Blo[s|4jAlslela | eistelalel4tc[2olel7|+[Flolels pupils will ind inspiring ond eagerly wont to buil, test ond run. 4) Each “junior” project needs to be carefully packaged ‘and include o comprehen- sive Ports lis. b) Contain list of Tost Equipment. ¢} The availabilty of o PCB. 4) If software is included in the project — the source Tines need labelling in on ‘unambiguous’ man- nar to explain the program steps. 1 The inclusion of a Flow Diagram would be an advantage. §) What software ond hard ‘wore are required to run the program Finally, 0 good starting point fora ‘junior’ project, ere those constructed using the Porallax BASIC Stomp | and I chips. Quite complex circus can be designed and built, and there is on element of programming involved. From my experionce of projects in post issues of your mago- zinel You ond your contributors might understand the gob- bledegook included in some (of your software listing, but an ‘eleven year old will ruggle for ‘aviile, then give up and put the magazine in the shreddec ‘and the partially tested PCB in the bin! [imagine quite o few ‘adult Elekior readers have gone cdown this route) David Jack (UK) ‘Many thonks for your email feedback of he level you supply fs few and far between and he- refore much oppracicted. agree thot mony of cur projects are ambitious, certainly camper ‘2d fo those I gt io #08 in other magazines. Having said thot | should attempt 10 adjust your view somawhat by pointing out ‘he following oricles tha! op- ‘peated in recent issues, which I believe should not deter 1-15 yor ol I. Atleast 10 t0 20 items in zach Summer Circuits edition published these past 37 years. 2. The Modding & Tweaking pages authored by student Jeroen Domburg 3. Selected items from the “Design Thos’ pages in o number of recent issues 4. Non-constrectional anicles like the ones on Cubesors, FIDs, Electrosmag alc, which, although enlikely t0.be fully understood, do present @ mind challenge to 1115 year old, as wall ot topical information on the role of electronics in todoy’s society 5. los of free downloads with published aricles; even if the associated project is not actualy built for even unde: stood), source code listings ete. ore great os educational material, 6. A number of lesser’ pro ‘grams on our free e-SIM ovo. 7. All projects in our ree 24. page HRMX supplement supplied with the December 2006 issue. In fact @ number of these circuits were sup- plied fous by youngsters! Sedly, our ‘Mini Cieuits' articles were discontinued due to lack of interest and feedback particulary from the age group you mention, 25 wall oF their teachers. Also, from @ commercial point of view, sales of PCBs specially designed for these projecis were negli ble. We will, however, consider publishing Mini Cicuits again. We are grat for encouraging us to look after the coming gene ration in respect ofpublcatonson 1 I, lsorSorp Tina (O5n) = Suppers 8-bH or 16-bit dota Flexible Waichdog Timer (WDT) with on-chip, low-power = Supparts 16 addres ! 1. RC eter for eile operation ‘Hardware rea-ime clock/ealendr (RIC): 1 1° !e-Cicit Serial Programming” (ICSP™) and r-Cireut ~ Provides lock, calendar and clorm functions Emulation ICE} via 2 pins © Five 16-bit timers/counters with programmable prescaler | 1 ora 1a ie a 1 | Anslogve feotures © Fie 16:btcompore/PHM output © 10-bit, up to 16-channel analogue-fo-digital Converter © High-current sink/source on select I/O pins: ! ghar i 18 mA/IB mA 1 500 kp conversion rate © Configurable ependrin ouput onda UO pins 1 Conversion eveiable during seep and idle eee eee 1 CS ae a race er ee ee 1 «eis 2 JANDS-ON PIC24F DESIGN SERIES Explorer-16 eronip ICRAF Design Series Fig. Agar sig ctw othe thre ail, hawloma ssn ‘ons ins oncr-bow ddan elected pc orth poe 6 ied. MPLAB IDE v. 7.50 follows 0 traditional Windows program insiall procedure. At some point you will see this message: The publisher could not be vetfe. Are you sure you want fo run this software? Click Run to continue. MPLAB C30 Compiler v 2.05 - Student Edition i asim isclltion. The Release Notes document thoi’ available atthe end of the instalation is particularly worthwhile to read (and print) Proteus VSM 7.00 Demo is also easy to install py by excaping he delouly enggored by he inal program. The Guided Tour of the MPLAB viewer you'll see neor the end ofthe installation has some interesting information ond shows the effort that Labcentar and Mi Explorer-16 recip IC2tF Catign Series " 2 ss MPLAB IDE v7.50 MPLAB C30 Compiler v2.05 - Student Edition ==. Proteus VSM v7.00 Qo Microcne ae Eaisiss ‘ig the empone! isl as forthe CD-ROM appli wih iia, crochip have put into their cooperation for the Explorer- 16 project. (MPLAB IDE Paradoxically — considering ils size and power — litle rods ba vid bout is enowned PC poeecontek ler development platform from Microchip. The reason is simple: MPLAB hos been around for many years now cond has matured into the de focio development platform for PIC MCUs. The program, or suite of ulliies, realy), is comprehensive, userfriendly and marked by excellent support not jus by virtue ofthe Help file functions but also through Microchip's online Forum ond technical support, MPLAB Integrated Development Environment (IDE) iso development plaiform for the Microchip Technology PIC MCU and dsPIC® microcontroller families, MPLAB IDE includes the following components: MPASM™ Assembler; MPSIM™ software simulator; MPUNK™ linker; Source Level Debugger; Online Help; Project ond setup wizards; Project Manager; Visual Device Intilizer; Programmer's Editor; drivers for various hardware tools. Special versions of « number of ullites like the assembler tnd linker, cre supplied for the dsPIC30 devices. With MPLAB IDE you ean: © write, build ond debug source code; ulomaticolly locate errors in source files for editing; Jebug with breakpoints; inglestep the program with softwore simulator, incircuit debugger o in-ircult emulator; view variables in watch windows; rogram code with cerfain programmers; ¢ Find quick onswers fo questions using the MPLAB IDE ondine help. ‘MPLAB looks rather dead when launched. To see some action on the screen follow File + Open Workspace and then novigate to the ‘examples’ folder. Various projects ‘can be opened there, Although not very meoningfl just yet, they allow the newcomer to explore o large number (of functions without ‘serious consequences” Imporionly, release notes forall uilifies in MPLAB con be found ot Start ~All Programs + Microchip > MPLAB IDE ¥. 7.50 -* Documeniation, This screen also lists ‘install cand repair’ vilies. Even on iniroductory discussion of he features packed info MPLAB and the best way to use them for your PIC projects would easily fil an entre magazine hence is be- yond the scope of this article. Noto worry, the complete ‘MPLAB Users Guide ond various other pdf documents are ‘accessible via the CDROM install serean under ‘View Design Series literature’. Plus, here's MPLAB Getting Started. MPLAB C30. The free Explorer-16 CDROM contains the student edi tien of the Microchip €30 compiler, version 2.05. This is «fly functioning C compiler for the first 60 days after srhich a number ofthe cleverest optimisations are diva bled. Ifyou start using the C30 compiler now, you will have a full version of the product all the way till he tice ariel instalment, The functions disabled after 60 doys are described by Microchip os: ‘procedural abstraction’ and ‘optimisation ceptions 02, .03 and -Os'. Not too worrying, we'd say. Everything else works the some os the fll version and ba electrons = 12087 with the huge memory copacity on the PIC24F128 used, code size optimisation is unlikely to become a problem. Ofcourse, you ore free fo use C30 for any smaller 16-bit PIC MCU or dsPIC® DSC you may have available, just give ita ty. ‘The student edition of C30 may be upgraded to ful edi tion by purchasing a licence key from Microchip. Good news: with the publication ofthe February 2007 ‘issue, buyers of the Explorer-16 Development Board will be able to purchase the ful version of C30 ai a discounted price by returning a voucher enclosed in the box. MPLAB C30 seems fo be a lesser known ‘plugin’ of he MPLAB environment so © short initoduction is given here {realising that the real work starts wih coding your own C programs, compiling, debugging ond finally transferring them to 0 PIC — bul stop, do your simulation fis!) ‘MPLAB C30 isa fully ANSI compliant compiler with standard libraries for ell popular PICs ineluding the latest dsPIC® DSC devices. Its fully integrated with the MPLAB IDE for high level debugging ot the source code level. This compiler comes complele with ils own assembler, linker ond librarian to vite mixed-mode C and ossembly programs and lik the resulting object fils ino 0 single executable file. The MPLAB C30 library includes functions for string me: ripulation, dynamic memory allocation, dota conversion, ekeeping, and math funclions (tigonomelric, expone ‘ond hyperbolic} The ‘small code mede'’ offered by C30 takes edvoniage ‘of a more eficient form of call instructions, while th ‘small data mode!’ supports the use of compact instruc- tions for accessing data in SFR space. Allinough C30 is embedded into the MPLAB environment, {you sil be abla'c run as 4 separaie Command line p> ‘gram, Use the ‘Open Workspace’ menu item in MPLAB ‘end navigate to MPLAB C30 —+ Examples + MPLAB {ink30. The example ‘Locate_access EEPROM’ is shown in Figure 5 with the Program Memory and File Registers viewers open. The complete C30 Users Guide is accessible vie the menu con the CDROM, os discussed with MPLAB. Allernatively, navigate to the folder ‘Documentation’ on the CD-ROM. Proteus VSM. ‘The circuit simulation component of the Explorer.16 project is presented fo you courtesy of out long-sland- ing advertiser labeenter Electronics. VSM (virial systems modelling) is par ofthe Proteus Design Suite which also comprises: ISIS schematic capture; © ProSPICE mixed mode simulation; «© ARES PCB design. Speco ote Explorer 6 proecLbeair oe sp 1g ¢ lorge number of sample designs featuring the FTG, PICT, PCL, PICTS ond, of course, he HCDAF. You can run any software code you like on the amples but to experiment on your own hardware designs you will need fo purchase the ful Protzus VSM package. Alterna ively, you can tke advantage of «special ofr exchisive to Elekior readers by visting www.labcenter.co.uk/rod teis/elettoreiorhios * Ta get a taster, if you stor « copy of ISIS via Start Lo- beenter — Proteus 7 Demonstration -+ ISIS 7 Damo, you are invited to view @ number of examples. Some nice cones are found in the Tutorials folder. Or - deren iia f Kick start to Proteus ' VSM within MPLAB ‘This short demonsivtion wll show you how the basics of how to configure and run a Proteus VSM simulation under the contrel of the MPLAB IDE. 1. Downlood the file Demo zp from the Explorer-16 page you con reach via worw.clekior.com, Save the Unzipped Demo! folder the direcion: e*\progrom fies\ microchip\mplob«30\examples. 2. Lounch the MPLABIDE ‘application, go to the File ‘menu, select the Open Werkspace command, navigate into the Damo} directory ond open the Domol.mew workspace. 3. Goo the Debugger ‘Manu in the MPLAB IDE, select the Selec Tool cam- ‘mond and then Proteus Si This configures MPLAB fo use Proteus 65 the too of choice for debvaging. 4. You should now see tha} the Proteus VSM Viewer hos opened inside MPLAB. Use the Open icon on the viewer ond select the Demol schematic rom the resuling file selector 5. Now select ‘Build All from the Debugger manu, 6, Now that we have the schematic ond project we on stort the simulation. Use the green bution ot the top of the MPLAB IDE fo conned the Proteus Simulation fo MPLAB. a pe SS SI a 7. As this pont he simulation is povsed at me zr, Sort the Simulation by clicking on the Play but fon necr the top right of ‘he MPLAB IDE This will cexecule he program code cad the VSM View wll sow you the eects of your program on the design. 8. Use the red button ot the “top of the MPLAB IDE to disconnect the VSM View- er from MPLAB ond sion. the simulation. A more detoiled demonstration of debugging follows late in = ” the series. cen a Reel ne i ee ee alone 25 Figure 5. PLA oO in ction. Vu windows on be epned wha he progam ‘sdang in meson and gris, Like C30, VSM is embedded in MPLAB; you'll find it un- der Debugger ~ Teal. If you are dying to see it in action at this point, follow the &.step kick star to VSM/MPLAB shown in the Kiek start to Proteus VSM within MPLAB inset. This impressive demo requires an archive file colled Demol.2ip to be downloaded from the Ex plorer16 page of our website. You can also apply the same procedure to any of he preinstalled Viral Evalue fion Boards. More about VSM on [4]. ‘Next month We reckon the amount of software presented in this ar cle will keep you busy for about a month. In the February 2007 issue we'll discuss the Explorer-16 hardware (on special offer then} and show is frst application which is ‘elated to sposch reproduction. This will tke us along C30 ond MPLAB to see how the software is built. We'll ‘lso delve into Proteus VSM to demonstrate that simula- tion is now a firmly established — if not essential — step in prototyping microcontroller circuits Web links [1] Microchip PIC24F1128GA Family Data Sheet: wo mierachip.com/downloeds/en/DaviceDoc/39754b.poh [3] PICIBF to PICZ4F Migration, on Overview: wa .mierochip.com/dewnloude/en/DevieeDoc/397640,pah [4] Protous VEN woralabcantarce.uk/areduelsem_overievthtm Ge lie lens - 007 16-bit PIC24 MCUs and dsPIC® Digital Signal Controllers PIC24F, low-cost entry level PIC24H, 40 MIPS high performance dsPIC30F/33F for seamless DSP integration Easy migration from 8-bit MCUs Common core instruction set and architecture Peripheral and Pin compatible families One development tool platform for all products Free MPLAB® IDE Integrated | Development Environment Other tools include C-compiler, programmer and In-Circuit Emulator Visualise...16-bit Microcontrollers with 32-bit Performance and 8-bit Simplicity Today's embedded systems demand more. The 16-bit hardware designs. For the most demanding applications PIC® microcontroller families from Microchip give you the dsPIC digital signal controller families seamlessly the performance and flexibility you need with 8-bit integrate high-performance DSP capabilities with the simplicity. Pin and code compatibility lowers risk, and PIC microcontroller core. allows re-use of development tools, software and microch _pinecr «6 A MICROCHIP | www mnicrochip.com/16bit Oe TIME MEASUREMENT The Quest for Ac Time measurement using atomic clocks Jens Nickel Of all nature’s physical quantities it is time that we know how to measure best. The most advanced atomic clocks are breathtakingly accurate, many millions of times more so than the best quartz-based clocks. How do they manage if? Fig Sunil roth let des nae on nis exeple amegsiing ales lies ponder charge in they enser ot wig. (Plog German ase, Frngen 14) Before we get down to business we should confess thai based on this principle has continuously improved, from ‘we are going to dedge the question ‘what is ime?" in this the earliest sundials (Figure 1} to modern astronomical otcle by using the rather unhelp- ful definition ‘ime is what a clock measures’. A clock les us put @ rtumber on the duration of an event ‘or on how long ago an event oc- curted. The precision of the meas- urement depends on how small the briefest basic interval is that the lock can resolve, and the repeat bility of the measurement depends con the extent to which these basic fime intervals can be kept constant To test he repeatability of a meas- urement we need access to anoth- er, more accurate, clock. The first ‘clock’ used by mankind ‘was the rotation of he Eerth. Over the centuries the precision of clocks ‘igre The eco tobes dois has ingrred atte by moe than 2 ee of ‘maga: olor ol niin. slr demos - 0007 uracy insiruments. As recently 08 the lost century the repeat ability ofthis measurement was considered ‘perfect’ and the second was defined as one 86400th of 6 mean solar day [1]. It was not possible to detect ony changes to this period, es nothing of remolely comparable accuracy was ovailable (Figure 2) History of timekeeping \Woterclocks superseded sundials in antiquity: and in the Middle Ages glassblowing technology improved to the point where they in turn could be replaced by sondiilled hourglasses. The first me- chanical clocks dete from the thirteenth century, driven frst by weights and later by springs, the loter making for 6 more compact construction. In 1657 the Dutch: mon Christian Huygens developed the frst functional pendulum clock, claimed fo have an accuracy of around 10 s per day [2]. Thot may not sound very impros. sive, but his revolutionary design paved the way for orders of mognitude improvements in ‘accuracy. External influences on the pendulum ware identified ond eliminated one by one, execily as would later kappen with electronic clocks. Among the sources of inaccuracy were temperature and feedback from the clock mechanism fo the pendulum, ‘A diving force behind these developments was neviga- tion: only with the help of a chronometer having good longterm stability could one determine one's longitude when on the open sea, The first electrical clock (Figure 3) was olso based on o pendulum Developments ultimately culminated in @ highlyce- curate pendulum clock us- ing pendulums suspended ina vacuum and o kind of masierslave arrangement [3], achieving o final ac- ge Tha at lec dks aed perl ejection with sleemogee Ts ecopl by ‘Ander Bi wes made 15, Slee there was oi elo ttt fine th ml ented sown eo toy by bung oss ef disor ess inthe poe (togoph: Geman eck eszu,Frangea (1) VME «aera SI Base units Physical quantities such os csistonce ore mecsured in fixed unis, in thie cose ‘the Ohm. So that on Ohm represents the some resistance in every laboretory in the world its value must be defined. Tiss simple: if «voltage of one Volt op- pears ceross o companant and a current of one Ampae flows, the resistance is fone Ohm. The Ohm is therefore devived from other unite, which, in urn, must of course be defined themselves. The Volt hoppens to be defined in terms of other units, but the Ampére isa “base unit. The choice here i somewhat arbitrary: the lows of physics will not change if we define the Ampere via the Ohm rather than vice versa. However, international agreement has been reached on the use of even bose units ‘These SI base units [8] must ba dafined somshow, and there are vorious op- tions aycilable, The classical though rethar awkward, approach, is to have @ ‘stondara’ somewhere in the world. At present this isl how the kilogram is defined: one kilogram i the mass of the ‘ur-kilogrom, made of e special alloy ‘ond kept atthe International Bureau of Weights and Measures af Sevres nacr Paris, under several glass envelopes. A more elegant way to dafine @ uni is vio fo measurement rule. For example, since 1967 the second has bean defined os 9 192 631 770 times the period ofthe radiotion corresponding tothe transition ‘between the two hyperfine levels ofthe ground state ofthe 139Cs atom, Using 6 coesium atomic dock allows a precise stendord for the secand to be ‘ovaileble anywhere in the world — even potentially in every housel ‘The Ampere is defined vie an experimental procedure where a carefuly-cantal- led valiage end resistonce are used (9. The reazone why the Ampere was never- haloes chosen as @ base unit are historical. Clocks at the German Federal Institute for Physical Technology (PTB) ‘The Germon FedecolInettute for Phycol Technology (PTB) in Brounachweig isthe body ‘responsible fr providing © statutory time relerence for the whole of Germany. Hs op- proximate UK counterport ie the National Physical Labora: tory (NPL). The PTB hos ten comic clocks of which two fre caesium otomic fountain clocks (he photograph shows the roam where the clocks ore ken). With relative accuracies of between 5 ond 10* 1016 these dovicss are among the most accurate timepieces in the world. The PTB cantinugs 10 develop the atomic fountain design, and £0 ws can expect ‘hase figures to improve infu. So-colied optical atomic clocks are under development othe PTB. So far, the ac- ‘curacy echieved has been comparable to that achievable using atomic fountain clocks, ond several sources of errr stand in the way af oblaining the thoore cally possible occuracy of 1018. According fo Robert Wynands, who runs the fine stondords team, ‘we have tobe coreiul that the chips do not distort with tempera ture and cause changes in propagation delays’ These high-precision ctomic clocks ond modules such os frequency generators ore developed in-house al the PTB. Individual components are usvally baught in os reody-made devcas, alhough they tand to be top-of he. range product. The bil for © portale low-noise quartz exysal might run fo four or five Fgures’ eays Wiands “The PTB runs @ further three otomie clocks in Mainfingen near Frankfud. These Units, bough from commercial suppliers, termine he time that is broadcos! us- ing the BCF77 signal {10}. The signal ean be received by rasio-centroled clocks “within a cadlis of approximately 2000 km ofthe transmitar, and i of course checked in Brounschweig. Ifthe fime should depart from the tue value, he Atsin- fiingen clocks ore corrected using @ telephone line 29 TIME MEASUREMENT In 938 hd od Shon rghit ‘prtte! seams dckte pare I weighed sae ‘hg tsp oe nd Str () cetecrot generator ig nd ners ose cesim load. The oun of an dtl qa ‘YOO seth conta shows. esi ams in gaious for, move foward mga ih pola. Tse heer ines eo ypeie scr raion ices ede lig lent xt fe hee insted the fame eloed oer soos The om ae illuminated wikis atone eqeny whith lnewn mop ote guar sl xl reueny Who nen cers ‘ory ole Goto eed am sale oa 8 Ths cane decd by sepring he toms ing he vale magnets heed ofthe soa ond esis ners lhe sported beans. (Pheer ond wore FBS. curacy of a few milliseconds per day. Only the very best quartz crystal clocks can beot this figure The first quartz crystal bosed clock wos developed in the 1920s, and the frst reasonably portable device was pro- duced in 1938 by insirument mokers Rohde & Schwarz {see Figure 4). If used a sliver af quartz erystal asi fre quency reference, made to vibrate by applying an alter nating voltage fo it, using the piezoelectric effect [5]. Ata ceriain frequency the crystal resonates, and this phenom ‘enon can be defected. Dividers convert this frequency to the desired fime interval In the 1930s o quartz crystal clock was used to determine that the speed of rotation of the Earth is nt @ constant. There is a general slowing down resulting from friction due to fides as well as unexpected variations thought to bbs dus to movements of rock within tha Earth, There ore ‘also seasonel variations with relative magnitvdes of th order of 10 [1]. Over the lost ceniury remarkable progress has been made in physics. Sophisticated theorias now explain observa ions over which generations of scientists had seratched their heads in puzzlement. I light is shone through a gas, its found that ceriain wavelengths are absorbed. Iris also observed thatthe gas then re-emits igh! ofa certain wavelength in response to this stimulus. The atom [or more precisely, the electron shells of the E4+—o ¥ st +6 au LF er. reis on o Sipe ek gram of the COCEOG ad COC Beddiogam ce iar ond ep ich, Tipe appliances 35, Ute) OSCILLATORS (he diegan ee eganning der er The sheet 36 cemmaion toe poll prt, egnminsnae sadly ete chai ing divider P2. All he output bufers are connected to P2 ‘ond therefore produce identical signals. The other two PLL modules are also running, and their ou'puts are taken to dividers but not then connected to any outputs. This, configuration is suitable for an intial test oF the device, without the need for @ PC to be connected. Ifa 16 MHz crystal is used instead, the outputs will all be oscillating at 16 MHz, We thus have a simple test that the power sup- ply ond crystal oscillator citcu't are operating correc We can now go on to program the device to generate ol mow ony dested requeny.nheory t's simple mat calculating: fai /M*N/P but ofien a little experimentation can be helpful to find suitable stings. Te Pl faguency shoul le wiki one of two bands, sither fram 80 MHz to 200 MHz or from 180 MHz to 300 MHz. The software should be used to set the VCO F,., value to 200 MHz or 300 MHz ‘accordingly. In practice its found thot in 200 MHz mode the PLL oscillaior can operate at wall below 80 MHz, although at some detriment to the performance of the device. In permet, ciate aera general meer is aif pete the highest availble comparison kequen for the PLL should be chosen. This means that the M livider ratio should be set as low as possible. For exam- ple, suppose we wish to generate an output frequency of 17 MHz from an input frequency of 16 MHz. We first set M-= 16, giving o comparison frequency of 1 MHz. We then set N = 170, giving o PLL frequency of 170 MHz, which is finally dived by P= 10 downs 17 Mt Assistance When more obscure frequancies are wanted, say 10.245 MHz for example, a litle more thought is called for to find the best setings. Help is provided in the form ‘of he ‘Programming Assistant (Figure 8): you can select the desired output and frequency and the ssistant calcu lotes the bes! settings. In this case the program suggests 16 Miz / 160 * 2049=204.9 MHz and 204.9 Miz 7 20 = 10.245 MHz. This would now make a suitable escillator for a dualconversion superhelerodyne receiver with o frst IF of 10.7 MHz and a second IF at 455 kHz. PLL2 and PLL 3 con be switched off in the interests of producing an output signal with low noise and weak sidebonds. Spread-spectrum clocking ln these days of strict EMC regulation it con often thal a piece of equipment produces radio interference o! 1s clock frequency [or aio harmonic of it) and hence fails emissions testing. The best defence agains! this is good screening and decoupling ofall signals that leave Ihe ‘enclosure. A backup technique is o use spreadpecirum clocking. The spectrum of a signal can be ‘spread out’ us- ing @ kind of frequency modulation; o receiver will then not see a sharp spectral peak but rather a noisy signal ‘with lower peak power occupying @ wider region of the spectrum. PLL 2 con be configured for kequency modula- Vion around the specified cenire frequency with « devia- tion of up to 0.4 %, or down from the specified frequency with a deviation of up to 3 %: see Figure 9. Cenive modulation is « good choice for generating a microcon- troller clock since the average frequency will be exaclly the specified value. RF characteristics Although the frequencies of the VCOs oe determined By simple RC cieuls, the internal PUs is nevertheless lsc - 12007 possible fo use them to construct @ clock generator with € lovencise ouput on a par with that achievable using crysial oscilltcr. It is therefore possible fo consider using this integrated clock generator in advanced RF opplica- tions, for example in 6 tripleconversion superheteradyne receiver with an adjustable first oscillator and two fixed frequency IF stages. In this ease any failure to decouple the PLL modules adequately from one onother can reduce performance. If Wo Plls are set to operate at closely. spaced frequencies, even o small amount of coupling can have o significant effect: os you can imagine, the two PUL contra loops will interfere with one another, resulting in ‘an output signal that is not clean. In cifcal applications {for example in a DRM receiver] it can be @ good idea to use just one of the Plls. How- ‘ver, it wil ill be necessary to ensure that the device's supply is clean by providing good decoupling a! the Vex pins with very short connections to the bypass capacitors. ‘A ground plane should olso be used. Texas Insruments recommends using a fourlayer printed circuit board with bbath Vc and ground planes, [1] Burkhere Kein, ‘Serielly rogremmable Crystal Oxcilator’, Elektr Electranies, March 2005, p. 64. i 1 1 [2] hitp://oeus.i:com/docs/prod/folders/print/ ' 1 i i We took simpler approach for testing, simply connect ing @ Sibatit ceramic capacitor direclly across each pair 1 por pts Suing fo lst a rey: ed hequecis we were chief bin Wo clan auipul | somin OS ann = Teh somin Th fp lamp fhe Ben dak hos 1 Hy onde rig lamp show thin. hitler - 12807 ee re@o*@e@ @o@ @-®@ Th ipa for vein wes LEDs ited lamps. ny, was inspired by the Berlin clock. Finding the base-five system em- ployed ¢ little unnatural, however, However, it is not so difficult to inter he opted for « binary display. pret the display of the Berlin clock, as display with 24 LEDs @ OOO me}! J@OO® 98988050050 Q@8®8 lek igre eek The mint stm dine he ply sng en SP bu. 100 - elles Figure 1 shows. The time is shown using a series of rows of lights where each lamp is assigned a ‘weight’. From the top row to the bottom row each lamp represents one second, 5 hours, ‘hour, 6 minutes and 1 minute. In the version described in this article we use 24 LEDs rather than lamps, but still ar- ranged according to the original layout (Figure 2), At the top centre is a green LED which flashes at 1 Hz, The second row consists of red LEDs and the third row yellow LEDs. So that itis easier to read the quarter hours from the LEDs in the third row, every third one is red rather than yellow. ‘There are two main parts to the design: ‘the example clock software, written in (C for an 8051 microcontroller, and the clock display. Figure 3 shows the blocic diagram of the system. Almost any microcontroller system could be used, as long as it has three or four spare digital 1/O port pins and either a real-time clock circuit or a ra- Gio timecode receiver. Alternatively, real-time clock could be implemented puraly in software. ‘The authors used a hoard that they de- veloped themselves, featuring an At- mel ATB9C51CC03 microcontroller from ‘the popular 8051 family. The board also sports 2 72421 real-time clock IC, al- though it would also be possible to te ceive and process DCF-77 signals. ‘The software reads the time from the real-time clock and generates the necessary control signals on the SPI bus, which connects to the clack dis- play board. ‘The display board carries an SPI-com- patible LED driver IC type MAX7219, Driving this device over a standard SPI bus gives the advantage that al- most any microcontroller system can bbe used as the master, whether based on 8051, RBC, ATMega or PIC. The only ppoint to bear in mind is that it must be possible to create the LOAD, CLK and DIN control signals of the SPI bus us- ing the hardware, or that the selected microcontroller must already provide ‘an on-chip SPI bus interface. In the lat- ter ease the communications software required is extromely straightforward. ‘This device is capable of driving up to 64 individual 20 mA LEDs using a mul- tiplexing scheme, The most important 49 Fire Wing ogo of mane wththe MADZIP veh Sas features of the MAX7219 are listed in Table 1, and a more thorough descrip- tion of the device can be found in its datasheet [6]. We will give a brief over- view here. ‘The basic functions of the driver IC are controlled using six registers. The LEDs are arranged in eight groups of ‘eight LEDs each; these ean either be considered as eight seven-segment displays (plus decimal points) or as 64 individual LEDs to be driven in any de- sired pattern. This allows for flexibil- ity in the arrangement of the display, and the use of different-sized LEDs (al though they must all be 20 mA types). SPI bus As we can see in Figure 3 communi- cation between microcontroller and. MAX7219 using the SPI bus requires just two power supply connections and three digital 1/O port pins, namely: © LOAD: enable/transfer signal for communicated data; © DIN: serial daca transfer; © CLE: clock signal for data transfer, tis very easy to control the MAX7219 ‘from the microcontoller in software us- ing these three signals. The basic SPI signal timing diagram is shown in Fig- wre 4, Transferring data to the device proceeds in four phases: 1. Quiescent. ‘The LOAD and CLK control signals start in their quiescent states, LOAD being high and CLK low. peer eee eee, 1* Dives common-cathode LED displays for the entire dxploy selectable for each digit portion. Digital end enalogue brightness contre ‘+ Seriol SP bus interface (up to 10 MH. ‘© Suitable for use in opplicatione with: - bargroph diapleys; {26 ctins eee oe dot matrix LED displays. Table 1. Features of the MAX7219 ‘+ Individuol digits can be changed without the need to rewrite the date ‘+ LEDs individually controlled, oF vio BCD-to-seven-segment decoder, ‘+ Programmable display size (numberof acve digits adjustable from one to eight). 1 Disploy test mod, lighting all segments simultaneously ‘© Low power shutdown mode (current consumption only 150 uA) multiple groups of soven- or eight-segment diaploys using cascade featur; loys of ny shape ond size made up el Svidol LEDs; A ee 2. Initiation of data transfer. Before the data (in the form of two- byte, or 16-bit, packets) are sent to the MAX7219 the LOAD signal is taken low. 3. Data transfer. ‘The microcontroller presents the frst bit on the DIN data signal. The bit is written to the MAX7219 by setting the CLK signal high: on the rising edge of CLK the data bit is clocked into a shift register. The CLE signal is then taken low again. This procedure is repeated a further 16 times so that all the rele- vant data bits are clocked serially into the shift register. The maximum clock frequency is 10 MHz, 4, Termination of data transfer. Immediately after the 16 data bits have Doon transferred the LOAD signal must be set high again. The rising edge of the LOAD signal tells the MAX7219 that the data transfer is complete and that the data bits in the recaive chift register can be processed. This last step is very important: if LOAD is not returned high the data bits will re- main in the shift register and not be processed, In our application the SPI bus is driven using three spare ordinary port bits of the microcontroller using the so-called ‘bit-banging’ technique: LOAD is connocted to port pin P3.5, DIN to P33 and CLK to P34, ‘These port pins are available on practi- cally every 8051-family device and so the SPI driver software can be used on most of these microcontrollers with- ‘out modification. Ifthe pins happen to ‘bo used for some other function, it is f simple matter to change the code to use other pins. For correct operation of the MAX7219 ‘each message must consist of two bytes (16 bits) sent consecutively on the SPI bbus. The first byte contains the address of an internal control or data register in the dovice and the second hyte contains ‘the data to be written to it. Pull source listings and object code for the C program written for the AT89C51C003 are available for free download from the Elektor Electronics website. slr dete 07 It Ir Fiat gre othe ply, ing MAT LED ve ond 24D Gireuit diagram ond printed circuit board ‘Thanks to the use of the SPI bus and the MAX7219 the eizcuit diagram (Fig- ure 5) and the display printed circuit ‘board could hardly be moro simple. Bo- sides the MAX7219 and the 24 LEDs there is also a DC piezo buzzer on the hpoard, which allows an alarm function to be added to the clock. A simple way to connect the display to ‘the microcontroller mastor system and Power supply is to use a 6-pin mini-DIN ‘connector: this conveniently allows the use of ready-made PS/2 mouse exten- sion cables, ‘The printed circuit board layouts are too large to reproduce in this article hence are available for free download. from the Elektor Electronics website, wwwelektor-electronics.co.uk. Note ‘that the display board is populated on both sides, the LEDs being soldered to one cide and the other components {07 «lcs ‘to the reverse, This has the advantage that the display can be fitted behind an attractive front panel, making the device an eye-catching and function- al addition to any living room, office or desk. All you need to do now is prepare yourselfto explain to every visitor how to work out what time itis! sae eee ee eee cms oy es gs ces ee a [1] Information on the original Berlin clock: [2] Berlin clocks for sal hip /wwewberin-uhecom (in Garman) [1A Berlin clock for your Pt itp one tucours com/proview/167639 hnips//widgsts.cpara.com/widgst/4256 [4] Martin Raschie: [5] MAX7219 datash: etait htps//wew surveyorin-bedln.da/berlin/uhe/indoxe ht hnps/www europe. center barin.de/index phpPiorge!=tighteBpage78lan: hnp//wwidgetgelory.com/view php? wid Beatin Clack, Flekor Elecronies, July/August 1998, p. 87 htip://wwemaxim-c-com/quick view2.cim/qy pk/1339° Finally, the author can supply unpop- ulated circuit boards and aluminium front panels (www.palmtec.de), 15808 (alzo ovelable for Mac) 1 1 ' ' 1 1 1 1 1 1 ' I! 31 GPS/GPRS/SMS Module Why buy TraceME products? 1. monitor your fleet with GPS/GPRS/SMS. Poieay een ae UN iN eME.eu 3, send messages to/from your people Peay ent Nielsen Cutse ZS 5. Update machines worldwide with your PC Citar aol la aries Weve Ouse Oy rte COTTE Wel ce Tune ON CMe LED 9 unlimited applications possible GUTS iy 11. Dutch production and support 12. Satisfied customers: + - IMTECH . eeu a) POLICE FORCE i AFRICAN OIL COMPANIES - GERMAN ROADSERVICE Biull N chute crale walled Picea Mette eel SIS Areas your belongings CUT Ty NewicoaVce ae _ Watch them via your web browser. AA he MAARARSE: AAAS Sd el lB eae ts at Communicate in your car with the office.or with) another vehicle via a.o. SMS with the TraceME LCD module. Secure your vehicle with the help of an iButton start. = (OG) Sie NESeIT Wonca eee (Ane os er GSO, Measurement & Control engineering: Wireless distance contral/of, generaiors, alllequioment with EM Solo ansy7aiencles Climate contro} Cold-storage engineering: Dejelentanag cunseeleieste nie} Gojd-storage transport andlalarm SHE eel Melony lee e DME esi CLS Niceliers sitters Milenyo ep Saute SENS) applicatio,, Medical: Monitoring transport of organs, stem cells, blood etc Ambulances and other transports, Services & Logisiies: Tracingytransports Busses, cars, Jorries) taxis; Uieruteliesy venoriie trailers (alsojon) solar energy)’ M2M (machine to machine) Ploegh jone netenines adil etc: Via the internet without the alo meters ae is Security/ Safety: Padma iia Uree-increrseeltel op SEU EEN Meets Heel Susu molto Variolls police services have already been equippediwith TraceME modules + NEEM els een tess JS DSSU"T) LED TEXT DISPLAY A secondary s LEDs to 0! project was the starting point for this ingenious creation, which uses j building a giant display device would be hard to imagine... Steffen Sorge ‘The idea for constructing this display arose at a brainstorming session on our project for the school-leaving exami. nation, what we call an ‘Abi-Denkmal’ (literally ‘exam memorial’ in Germany. ‘This advanced lovel final oxam involves an assignment to create something en- ‘rely original, a task in fact that at the author's school was traditionally un- dertaken by the electronics students. ‘The original stimulus arose ftom bed- sido alarm clocks that function slong similar lines. However, these inexpen- sive products from the Far East indi- cate only the time, not any text. ‘The first prototype was created in just one day using the following parts: ‘ight LEDs from the junk box, a switch {or synchronising the start of the mes- 34 sage display, an AT90S2313, a PPS (GF22/R222) 9-volt battery and a few other scrap components were mounted on a small wooden batten. The whole affair was then attached to the drive shaft of a small DC motor and set in motion. After a little programming ef- fort wore we rewarded with a display reading out the word ‘Hallo’. However, this initial prototype (just like in ‘Modding & Tweaking’ projects — Ed.) had a number of shortcomings: ‘The LEDs were not bright enough ‘The life expectancy of the switch was alarmingly short (little wonder: it op- erated with each revolution of the motor) Having a rotating battery was not the cleverest idea... st eight blue produce a scrolling text display with 360-degree all-round visibility. A more economical way of Problems exist to be solved. The first task was to source some ulra- bright blue LEDS with an intensity of 3500 Cd. Next problem solved was the switch; we obtained a Hall effect switch from an old printer. The bat tery was replaced by a proper mains power supply and a slip ring. And f- nally the AT90S2313 made way for an ATmega’. As the circuit diagram (Figure 1) indi- cates, the functional circuitry compris- as just a microcontroller (IC), which. Grives the eight LEDs and is linked to ‘the Hall sensor (IC3). As regards ex- ternal components, the controller re- quires only a 16 MHz crystal (X1) with ras = 0007 f Light peatnes) rotating message display with LEDs and an AVR micro Fw The scoops fundamental jst an AVE cot ido al sexs 3 thal vies th lg LEDS ‘two resonating capacitors (C4 and C5). ‘Voltage regulator is the trustworthy old 7805 (1C2). As the microcontroller cannot source enough current for pulsing the hefty LEDs, a follower stage comprising transistors Ti to T8 is provided. The ‘eight rotating LEDs ‘write’ an image built up from eight lines of light (not from left to right of course but in con- tinuotis 360-degree rotation) and for this reason the microcontroller needs to be synchronised with what in TV or computer displays we would call a frame pulse, a signal indicating the start of a new image. This task is han- ded by the Hall switch (IC3), which altars its output level when it detects @ magnetic field (in the vicinity of a 1/07 « lesen ‘magnet in other words). Its nor ‘mal state produces a ‘high’ output! that goos ‘low’ on approaching a ‘magnet. This change of level sets jin motion the process of building up the image, which the software in the microcontroller looks after. Software ‘The ATmoga® is an AVR controller by Atmel, belonging to the family of RISC controllers (with reduced control set). The program for tho rolling text is not written in Assembler, however, but in the well-known BAS- COM AVR-BASIC language. This software, along with extreme- ly very detailed annotations, can be downloaded freely from the Ele- What does AVR stand for? \We wondered los. Apparently Aimel says AVR is ius! @ nome and stands for nothing in pariular ‘Another opinion states it's play on the designers’ ‘names, on acronym for Alf (Egil Bogen) and Ve- gord (Wollons RISC processor. The llagotion thot it stands for Advonced Vito RISC sounds unlikely but you can take your choice! ktor Electronics website (data file 060014-11.2ip). ‘The program produces small image elements representing text fragments relating to character strings stored in the controller. These text fragments are 35 1 ' ' ' 1 1 1 1 1 1 1 1 [NiSf)) LED TEXT DISPLAY Fis. ie oth ting cm wiht cent bed. ‘ip. Cngraton leg EDs tte ead oe then re-written as columns and {fed out Each Write command creates one col- _is selected (variable ‘Strz’). At the end to the LEDs in a defined time frame. ‘The rotation of the motor creates the impression of text written around the periphery of a cylinder. ‘The controller can accept @ maxi- ‘mum of 258 characters for the scroll ing text. These characters are stored in the INSTRING array, which con- tains three elements (three segments of text) that are read out and displayed sequentially. ‘umn of the relevant character, which is composed of several of these columns each having eight pixels vertically. This, makes it easy to dasign a character on ‘squared paper and transpose the col- umns from left to right into Bytes. If ‘you visualise the Wait loop (subroutine ‘Wa') in the source code, itis easy to ‘work out how a character will actually. For example: of the third text segment the display reverts to the first segment of text andl begins again, If you significantly vary parameters such as rotational speed and diameter ofthe rotating LEDs, tien a few altera- tions need to be made to the program: Using a different radius (rotor arm length) the number of characters vis- {ble in the ‘display’ (diverging from 30) Readout ofthese characters is synchro- © Sub A ‘must be adjusted (at two locations in nised by the Hall switch already men- Portd = 4811000000 the program). tioned, which also provides the infor. Portd = 4800110000 Alteration to the number of revolutions mation whether the motor is in opera- tion (when the motor is static the LEDs all remain unlit). The length of the roll- ing text in the ‘display’ depends on the Tacitus of the circle created by the rotat- Portd = 6811000000 ing LEDs, hence on the length ofthe Portd = «200000000 rotor arm. The set-up illustrated inthe Wa photos operates with a text length of | Wa 30 characters. The program operates as End Sub an endless loop that is synchronised by the Hall switch and delivers 30 charac- ters continuously, ‘The software produces the following characters: capital letters from A to Z (including the accented letters A, O ‘and U), a null or space symbol, ques- tion mark, exclamation mark, full stop, comma and hyphen. A subroutine is programmed for each character, making it straightforward to substitute or alter these symbols. A subroutine consists simply of multiple waite commands to Port D, which con- ols the LEDs, Each write command is followed by a brief pause created by ‘a Wait loop. Portd = 4800101110 Portd = 4200100001 Portd = 300101110 Portd = 4800110000 per minute requires adjustment of the pixel length (subrouting "Wa'). The text readout speed (the rate at which the text scrolls) can be varied. ‘The number of text segments can be in- creased (this requires a controller with, greater memory storage, however). Circuit construction ‘The circuitry is relatively easy to con- struct hy following the circuit diagram, As the DIL version of the ATmega® is used (ATmega8-16PU), there are no surface-mounted devices or other prob- Tomatic issues to contend with. Resis- tore RQ to R16 must be selected accard- ing to the nominal current of the LEDs used. They can he calculated simply as series resistors for 5 V. The sample set- up used a value of 56 Q. ‘The last write command always has a zero value in order to extinguish the LEDs. The wait duration of the subrou- tine Wa’ must be configured accord- ing to the rotational speed of the motor (just test out various values to deter mine the best one for you). Playout begins with the first 30 char- acters of the first text segment held in INSTRING. After four revolutions of the motor (monitored by the variable ‘Laufert’) the text is incremented and displaced by one character (the start position of the text is monitored in Laufer’). Once the ond of the first text segment is reached, the next segment ‘To assist construction you can down- load the author's circuit board layout ‘and component plan together with the component list from the Elektor Elec: 56, heer - VE Fire 4. Alp dg peeves ome spp he tronics website (January 2007 items). You do, however, need to note that the dasignations used on the component plan may either vary from those shown in the circuit diagram (Figure 1) or else may not be shown at all. However, the citcuit board does correspond with the diagram electrically and can always be cross-checked in case of doubt. A.rectangular format was selected for the circuit boarc, matching the dimen- sions of the rotor arm, with a separate ‘smaller board provided at the end of the arm for the LEDs mounted one above the other (see photos), To make the 5- mm LEDS align with the hole spacing of normal 2.64 mm-spaced perf-hoard, the LED bodies need to be flattened a little with a file on two opposite sides (don't overdo this), The LED board is connected to the other board using a length of 9-conductor flat ribbon ca- ble. The anodes of the LEDs are con- nected with one another and to +5 V, whilst the cathodes are wired to the series resistors provided (R9 to R16) D2 (linked to Ri) is the uppermost LED on the board and D9 (linked to Ra) is the bottom LED. Ifthe LED array is wired the wrong way round (D9 on top, D2 below), the text will appear upside down! Programming The fies download 060014-11.zip con- tains bas, hex and bin Mles. The .bas file holds the source cade in ‘Bascom’ format. The -hex or bin data ean be lashed direct into the ATMegad and is then ready to run, The data supplied nto - see deta iol ig. will produce scrolling text of the dem- onstration message programmed by the author. Ifyou would like to program your own text you will need Bascom. For this open the file Schrift.bas and change the contents of the array INSTRING, All that remains to do is press F710 compile the new source code. Alter connecting the operating volt- age (9 to 12 V) the controller can be programmed. To do this you link the programming connections (K1 on the circuit diagram) via a suitable pro- grammer (PonyProg for example) with the PC and flash the file Schrift.bin or Schrift-hex into the chip (set fusebits externally to 16 MHz), If you would like to try compiling with the trae BASCOM-AVR DEMO 1.11.83, software you will need to restrict the Jength of your text and avoid filling the INSTRING array with three texts, since the demonstration version will not compile more than 4 KB of code, Mechanical matters For the ‘rotor’ an arm made of sheet aluminium about 60 cm long was used At the centre of the arm you need to fx a small bush that neads to be connect- ed with good electrical conductivity to the drive shaft of the motor. The return ‘wire is screwed or otherwise clampad tothe casing of the motor. A slip ring of clean printed circuit board materi- al (not the sort that is pre-coated with photosensitive lacquer) is flxed to the upper surface of the motor and wired up to the positive (plus) side of the voltage source. Above the slip ting a ‘small carbon brush is fixed on the rotor arm in an insulated mounting to avoid contact with the aluminium sheet. Fi- nally a magnet is fixed to the motor casing in such a position that the Hall ‘sensor mounted on the rotor arm pass- 95 through ite magnetic field at each revolution and is thus activated, ‘The circuit board is now fixed to the r0- tor arm (ideally without putting it out of balance). Power supply arrangements involve witing the return (ground) ‘connection on the circuit board to the ‘bush on the drive shaft and the posi tive connection to the carbon brush. If the arm remains unbalanced this can be corrected by using compensating weights. ‘The power source (a 9 to 12 V plug-in power supply) can now be connected up to the slip ring (positive connection) and the motor casing (ground return). ‘The current drawn by the circuit is set mainly by the total draw of the LEDs, to which you must add that of the mo- tor if the same power supply is used for both. ‘As soon as the power is connected and the arm rotates scrolling text should be visible on the ‘display'—just like in the photo at the beginning of the article... ps Tier was cel eo wit pc east te nit ft exes co sew stdig Ete nd lfrationTchnlgy he West os eka lege inti Geran. 37 FIRE YOUR IMAGINATION =FTDI VNC1L-1A (ys) N vINcULUM FTDI Chip The Vinculum family of USB Host Controller not only handles the USB Host interface and data transfer functions, but owing to the inbuilt processor core and embeddad Flash memory, Vinculum encapsulates the USB device classes as well. When interfacing to mass slorage devices such as USB Flash drive, digital camera, or PDA, Vinculum also transparently handles the FAT File structure communicating via UART, SPI or parallel FIFO interfaces via a simple to implement command set Vinculum provides a new cost effective solution for providing USB Host capability into products that previously did not have the hardware resources available. CONNECTS WITH use pont ime UaRT _a0eus07 | men ee sso RT 2 é se, FIFO _AcBUSo7 Ma sive <> ey sera Pot crystal anes peus 07 mB eo —_—> C= Prales Colcol 10 vssoiie RESET# Z PORTS a xa P —- ¢ cLock Test PLL — PLL FILTER Future Technology Devices International Limited 373 Scotland Street, Glasgow, G5 8QB, United Kingdom Tel: +#44 (0) 141.429.2777 Fax: +44 (0) 1414292758 Email: vinculum.sales@)fdichip.com @ Vinculum Evaluation Modules & Application Areas The VIP module is an MCU to USB Host Controller development module for the VNC1L device and is ideal for rapid prototyping and development ‘of VNC{L designs. ‘© Jumper selectable UART, SPI or FIFO MCU Interfaces ‘+ USB "A" type socket to interface with USB peripherals + 2nd USB interface available via module pins if required * Single 5V supply input + Auxiliary 3.3V/200mA power output to power external logic «Trafic Indicator LEDs is possibly the easiest solution for adding a USB Flash Drive interface to existing products. Only four signal lines plus SVIGND are required to be connected, * One USB “A’ socket to connect to USB Flash Drive * Link Selectable UART or SPI interface * Only 4 signals fo connect excluding PWRIGND « Single 5V supply required * Easy to implement command set S1C1 is a product that not only ets you add USB Flach Drive interfacing to your product but allows you to play back MP3 and other popular digital music formals direct from a USB Flash Drive * One USB "A" socket to connect to USB Flash Drive + Stereo 3.5mm headphone jack socket and audio line-out connector for audio playback * Link Selectable UART or SPI interface * Only 4 signals to connect excluding PWRIGND * Single 5V supply required + Easy to implement command set http/Avww.vinculum.com ECHNOLOGY Bg Scoot me u Christian Tomanik p, Sco ei as Engine tuning for scooters (and mopeds) has always been popular. In the past this could only be done mechanically and required a certain level of know-how. In the present electronics age there are other ways of boosting the engine power of scooters. ‘The number of ways in which scooters ean be tuned is, sill eloively small compared to those for ears. There tre some very innovative concepts, however. But what is recicl and wha do yeu needle do? To answer hal wo first take o look a the bosics of tuning, Tuning There ore two types of tuning: increasing the engine pow oF limiting i, Let's start with a look a the later. There are many diferent ways of mechanically I the engine power, such as limiting the amount of fuel ture fed to the engine or reducing tho siza of he exhaust Port. But there are also electronic solutions. Many modern scooters come with electronic rev limiters. With contempo- rary scooters you often find they have @ combination of mechonicol and elecironic limiters ‘One way in which to limit the revs is to interrupt the igni- tion, Once a certain speed (and hence a certain number of reve) has been reached, ihe ignition is interrupted for cycles of the engine. This stops the scooter ing up ony more. Thiele of enilig Coa be mipleied Ware spacaly designed CD! unit {see insei). Bul there ore also olher con trol circuits that take care ofthe limiting. These are fited between the normal CDI unit and the ignition coi Ifyou want to remove the limiting you'l ether need to remove the control circuit or change the CDI unt. It may of course also be possible to adapt the CD! unit or control circuit via dedicated hordware and/or sofware. Where o control circuit is used, it is of course very easy fo bypass it. A simple switch can be used to make the scooter wotk with or without the limiter. However, bypass ing the limiter like ths is of course illegal ‘Apart from the electronic limiter there is offen a mechani cal miter os well, in the form of a dise thot stops the Vari- ‘omatic [ee insel) from going into its top ‘gear’. This disc should also be removed when the rev limier is bypassed, otherwise the engine may be damaged at high evs These days there ore better limiters available, which con- finvously adjust the ignition rather than interupt it for a longer period. These reduce the produetion of harmful asses ond cil residues in the exhaust. How to get started First of il, we have to make clear that all tuning activities thot change linerecse) the power and moximum speed have fo be approved and noted by the relevant author- fies. Otherwise the scooter willbe uninsured and can't be used on public roads. In practice there is hardly ony difference between the electronic tuning of scooters and chip tuning of cars. In both cases we make use ofthe inherent tolerances de- signed into the engine by the manufacturer, in order to improve the engine performance and increase its power. ‘Asn example, the ignition table is mocilied, with the ‘ssumpfion thal you'll only use the proper fuel and top- grade cil dle sewesi 2007 Scooter tuning without ity getting your hands dirty There cren' really that many parameters that can be ad- jusied for scooters, and certainly not os many as for ears. The most important, ond offen the only ones, are the pre- viously mentioned ignition table, a few contol parameters cond the maximum number of revs, Eleclronic tuning with the aim to increase the power is therefore mainly used scooters when mechanical changes are made a! the same time, The CDI can then be adapted for these changes, to ‘bain the best performance from the engine. Figae Trop the poner utp deity some whe sl the uningbs. Grenis elo en ue ‘seer wang. GameBoy ‘As you will hve gathered from several pas! Eloktor Ele tronies projects, the Nintendo GameBoy console isnot limited for use as @ games computer. It's also perfeclly suitable for mony olher applications. Taking this one slep further, he German frm Alphalechnik [2} has designed @ dedicated hardware/software add-on for this games com Web links: puter The reul is the SpeedControllr, @ complete tuning fond diagnostic insrument for scooter workshops. It can bs dig at bth he menu spd walls the El wrenhhuite.e power [either increasing or decreasing them) [3] en.wikipedio.org/wiki/Voriomotic Fimiting the maximum speed doesnt automatically meon "1 ™™WPacio0ra that there has to be o reduction in power. Fryou toke o look a he groph forthe power oulput of a Peugeot ludix See alee: «ily scooter [Figure 1} you'l see that a legal] speed limit vopmiuning.co.uk of 25 km/h doasn't stop you increasing the number of HPs. The increase in power is possible because the manu- fecturers have designed large folerances into the engine. big advontoge of this type of tuning is that everyday ‘ding in oie becomes 6 lot ecsier ond the fuel com- sumplion becomes beter. After ol, he throtle no long fer has to be turned all he way jus! to get the scooter moving [1] en.wikipedia.org /wiki/Two-stroke_ engine CDI stonds for Capacitor Discharge Ignition. The CDI unit calculates the optimal ignition timing forthe erent revs, To ‘btoin the maximum power the ignition should take ploce when the piston i just bofore the ip of is stroke. Because the pistan moves faster with inreasing revs ond the gos ‘mintre abways requires the same omount of ime to fully burn, the ignition hos to fire earlier with increasing revs. With the use of the SpeedContoller itis also possible to remove the speed restriction completely This is dane us ing @ PIN number, but this can only be used one fime. This means thai once the restriction has been removed itis no longer possible to enable it again ata later date. This stops people from temporarily pulting back the speed iter for the MOT or police patrol or and removing i cfterwards. This isthe result of o sri EU directive, which came into being to reduce the tampering with the limiting systems, oF even make it impossible to make changes. Variomatic The Voriomotic is @ stepless fully automatic transmission developed in the eorly 1960s by the Dutch car manufac: turer DAR works es fellows: the drive belt sis between two eorieal drums. With increasing rove the distance be tween the two drums chonges due to cantrfugel weights, which cesuls ino stepless chonge in the ransmision rao (refer to [3] for more detail (One side effect ofthis typ of transmission is that vehicles with this ‘geor box’ can travel ust as fost backwards as they can forward, which is funy to sea and much used in ‘moteur car races. Nowadays ths ype of hansmissionis used mainly in scoot fr, quads, snawmoblles and pillr dil. A futher develop rant ofthis isthe so-clled CVT sytem, whichis ured by ‘Audi under the name ‘Mulone” in several of is cor ‘Summary These days there ore several tuning methods for scoot es that are relatively ensy to install and which can elther increase or limit he power. You should keep in mind thot bypassing, oF tampering with, the limiters is illegal In some couniries itis permissible jo increase the power within reason [up to about 4.5 kW or 6 HP). One edvan- tage of his is thatthe fuel consumption improves, which leo clever harmful exhaus! eos omissions. Yul also find thot the riding experience is more fun, which i hones) is what it's all about 1 1 1 1 1 1 1 1 1 1 1 1 ' 1 1 1 1 ' 1 1 1 ‘07 «eh ese a al tUTO ae) ENGINE TUNING Ihis wellknown that a modern car is filled to the brim with electronics. In 1990 there were only @ couple of ECUs per vehicle. That number has now increased to 10 or 50 or evan more ECUs per car. In eddilion to the engine con troller ond ABS controller we now also see dashboard, network, air conditioningontellers etc. emerge. Further more, the computing power is ever inereasing os well (8 Figure 1) The necessity of more computing power is driven mostly Fut 1. veage numberof MPS of nicole eed a Us, 62 Modern car enginec Henk Dijkstra In the world of engine tuning, spanners and screwdrivers have been replaced by palmtops or PCs and flash programming routines. These days even the bonnet can remain down and the ECU need not be opened. Via OBD a quiet runabout can be transformed into a roaring sports car. by the increased emission requirements and diognostic bili. Direc injection engines in particular, require o lot of computing power because oftheir multiphase fuel injection. An exemple ofthe tasks ond processes thot @ modem ECU deals wih are oulined in Figure 2. Some of the ICs that we are likely to find in an ECU ave: © a voltage regulator and processor watchdog: © o driver IC with SPI diagnostic interface / SPI or PWM. input; © a CAN‘bus interface IC; © 2 MHz 81 microcontroller with 8 kilobyte flash memory on board; © ond a AOMH2, 32-bit miccecontoller with 2 MB flash memory on boord. ECU reprogramming To improve the performance of the engine you can inter fore eleciconically with the engine contolle. Profession als with a lot of experize con change the parameters and isles - 12007 eed on Demand optimisation in the electronic garage | J2534 standard ‘The 1254 standard came about io enable gorages that are not part ofa brand franchise to carry aut programming operations 100 ECUs without having to invest in expensive, proprictary equipment. Nis eosily possible thet o softwore update is required to ensure thal e car conforms again tothe emission requiremens. This standard mokes that easier. Unfortunately, not all manufacturers participate in this (et ‘The 12534 stondord is sometimes also called the pass-thru standard. To be able to program an ECU, sofware from the manu: factureris required, os well es hardware ha complies withthe 12534 stondard. The number of menufacures that suppod the 32534 standard graws avery year. To buy the programming software visit to the manufacturer websie often suffices, Honda for example: hp: //technfo.hondo.com/anisis/RIAAIOOtools2.aspthomes¥ Analog Signals ‘Sater Voltage —— Engine Temperature nike Air Temp. —— ‘Ar Ousntly Tonle Peston Lp, Oxygen Sensor — ~ Digital signats Fuel Pump Relay Ignition On/oit 7 | Secondary Ai Pu ‘Camshat Position —— —se Vehicle Speed I ciate contol Retay _Ser sition — == tina Legislation ‘Tho cor manufacturer is legally required 1 toke various precautionary measures 20 tht unauthorised programming ofthe vor: ‘ous controllars is not possible. This is mostly to prevent on increase in exhoust emissions, However, i here is @ chonge in the cspiration of he engine, perhaps because of« change in exhous!sytom, itis ofen desirable fo change the ECU calibration so that the emission requirements are again complied with Irmay not be formally permited to chonge the program, Bui is actually daicable to return the air/fuel ratio back te the correct value, vis, fr example, well-known that ¢ Subaru Impreza is edusted uit rich (here is where the manufacturer sighty concept of ‘safe engine adjusiment’ or perhaps the shareholders of he oil ehelke) ond « lite it of electronic med sult rot only more engine power, bu! also ~ portal load — lower fuel consumption end thersfare a lower emission af CO.! \Whotever changes ore made to car engine, in the UK, MOT eperovel will delarmine whether or not a vehicle is cllowed to 1 g0 on the road. i 107 - or ars 63 ee ENGINE TUNING 64 Fis. tamale of fuel ble, edn his tle th EC lok op wht hr tren al nd a eso be ee «ein rie lord, empttreod exgniee, tables that ore stored in the ECU. These changes make it necessary fo recalibrote the controller. A change in the ‘exhaust and/or intake system chonges the aspiration of the engine to such an extent that it will no longer comply wilh the emission standords that are legally defined. The factory setings [calibration) are, afer all, based on a standard intake ond exhaust systom Now that more air is sucked into the engine — ci least that is the intention if more performance is required — more fuel needs to be injected os well The amount of fuel supplied is ypically looked up from a table by the ECU bosed on the follwing main parameters [see Figure 3): @ engine temperature, Along the Y-oxis we find the engine speed and along the Xaxis the engine load. The engine temperature is looked- vp rom another table. As an example we take 6000 ‘pm (revolutions per miavie) and 3.96 grams of air per ‘eylinder. We can then see that the AFRWvalue is 10.01. In this case therefore, 1 part fuel to every 10 parts of ai. I, for example, we enter the value 9.0 inthe table, then the cffectve injection ime will increase fo ge! more fue info the eylinder. ‘Obviously the correct values have fo be entered to pre: vent expensive engine damage and maintain conform tance lo emission requirements Programming via OBD Alot is involved in order to program new table volues ino the ECU. In the pos it wos @ cose of desoldering the (EIPROM and replacing it wih a version with the new code. These doys oll ECUs ore provided with flash memory, which may or may not be a separate chip. Ac. cess fo the ECU memory is always possible via OBD. This requires that the ECU is firs placed into @ special security mode. To put the ECU in security mode you need to osk foro “seed. This noads to be anewered by the program mer withthe correct ‘key’. There are often mubiple levels of security. For some cars a ready-made solution is avail able in the form of a handheld programmer Hard and software The hardware provides for proper communication be- tween the software end the ECU while programming. Consequenily, the hardware has to have the righ kind of interface, such as ISO, CAN, ete. and support non-stand. ard baud rates such as 10,400 or 15,625 boud (bits/s). In some coses a programming voltage is oso required. But in most cases standard OBD-hardware will sufice. IFthe car manufacturer syppors the J2534 standard, then itis enough to buy o J2534 hardware interface. See (1), for example. Software is often available from the manv- facturer of the cor. See also the inset 2534-standard. Programming softwore offen makes use ofthe service modes as described in the SAE 2190 sondord Em hanced E/E Diagnostic Test Modes, see [2] The most common J2190 service modes for reprogram: sing ore: $10 start diognostc service $20 stop dicgnosic service $27 ask for security access (seed, key) cor dete - 007 $34 osk for upload to controller $35 ask for download from controller $36 dota transmission to/from controller $37 ask transmission exit $3D write to memory ‘Although the service modes are described in the SEA 12190 standard Enhanced E/E Diagnostic Test Modes, the porameier idenifers (PIDs) ore manufacturer specific. The monufacturer determines the programming order and security access according to their requiremen's. In this way the security key could be 32 bits long, but it iust os well be 128 bits long, Reverse engineering When the manufacturer is not prepared to supply the nec- ‘essary information and also does not make available any programming sofware, tan the only opin hat remains is reverse engineering of the controller software. Fertunaely tere ae ever more manukcirers who ae repared fo supply programmins re to allow their Ecbstobe updcled To discover the correct programming order ond to obtain security access the processor code will have to be unrav- elled. This requires a processor dependent disossembler cond interface. Because itis necessary to work al the level ‘of assembly language, this fends io be quite a time-con- suming process. Depending on the way the programming ‘operation is implemented by the manufacturer, it may also be necessary to write a kernel and/or flash programming routines just fo be able lo program the flash at all. This is therefore not a job for the novice Car versus computer? The presentday tuning of cars looks more lke hacking thon it looks like working in © garage. Becouse ofthe facreaching integration of elecironies in the cor of today, an increasing number of adjusiments can only be corried ut elecronicaly, To make things safe and to comply wih vatious legal requirements, the manufacureslck yp the sonore os much otis possible, Subsequently, sve tuning companies such as Fastchip are busy ‘decoding’ the savare inorder tobe abe to make ‘odjutmonts™ themselves. This sounds a litle like what happens in the pc software arena: hackers who circumvent the protection ‘mechanisms fo enable them to make a backup of thoir be- loved Xbox game... 1 Glossary ! Am Ketatfoinrabancentaterdess ' ' t CAN-bus Controller Area Network exynchronous, serial bus systom dovoloped for the use in cars. ECU Electronic Control Unit the ‘boord computer ‘which controle all the elactronies. ‘MIPS Million insructions Per Second; Number af in ‘sevelions thot @ contraller can process per unit of ime (for example, adding two numbers is ‘one inaction) Pulse Width Modulotion: standard for signal ‘tansmistion in which the duty cjele ofa ree: angular weve contains the information ofthe signal ‘On-Boord Diognestc; electronic diagnostic ‘system for vehicles. Sericl Peripheral Imrace: stondard for 9 s0- Fal interfooe for @ digial signol network. ‘The holy cow will not disappear from our driveway any time soon while ihe electronics becomes over more so- phisticaied. In all ikelihood, IT wil place on increasing tole in the gorage ofthe future. That's quite 0 promisel Web links: [1] werw-passinns.com [2] wervesae.org [3] srfstehip. ‘The dep tht mech ody nd when nog engl ue. 6 FPGA FPGA Course (8) Part 8: Playing with the USB port re . In this eee) USB controller embedded into an FPGA are certainly ee at a Eee RCM ts ‘with single clock cyelo per byte felch © fullspeed USB controller with five endpoints Teor Senor) Se ene a eeu ee eS eS kets ese available from OpenCores (wwnv.opencores.com). This is nol the place to dele into the deoils of hoy the USB core works or its internal structure. What matters here is how it is linked fo tho 8052 core and how to use iin practice SUS eee eis es ec Ker aecte (en iaeney ese ae ye ne ete Sener eet ene Cleanse © registerconfigurable low-speed / highspeed mode (1.5 Mbps or 12 Mbps) © 4 freely available endpoints, each with a 64.byte FIFO Cer ue met nents Ge eee or © hos! mode © Bbil Wishbone bus interface: Saver een et ee Cera troller via the Wishbone bus, As a result, the registers of Cisse ea ee eae el words, they ore addressed as external SRAM), where the CUS eu ALUN) can certainly hol Paul Goossens and Andreas Voggeneder stalment of the course We're going to pu together esa ‘own against commercial USB Sea RS cre ay eee ee eae a ey the block diagrom ofthe overall sysiem, while Figure 2 Ce eee Registers The USB core hos a set of four registers for each er ey mest) yey Os Comer ots ora en ae Uren keno eet een drive endpoinis for purposes such os sending data, sel Cee er eines oem ear ea aM ete ene registers provide information about the current sfalus of eee eed ies ee ee eet The Endpoint_Transtype_Status register contains infor. be a ole ae tel ee Pisce ee erty ed ote eee a ane aay an Cn nod cee tay eee Com Meee eee point has an Rx FIFO ule and a Tx FIFO bulfer, each with a depth of 64 byies, These two FIFOs can be con. teeter ree eer nec er Ce le © FF{O-4] Rx Filo Date @ EP[O-4|"Rx Fifo Dato. Count MSB Bio Bree boa Com s8 © EPl0-<4) Rx Filo. Coniral © EF[0-4) Tx Fifo Dara EP|0—4| Tx Fifo Control ‘Among othar things, these registers are used to read dota ‘received via the endpoint from the associated Rx FIFO ‘ond check the fil level ofthe FIFO, to write data to a Tx FIFO, and to empty flush) the FIFOs. There are also sevaral general Slave Control (SC) regis: ter, including: SC_Control SC_line Status @ SC_Address © SC_Interrupi_Status / Mask The SC_Conirol register con be used fo enable or disable the USB slave portion and configure it in either Fullspeed mode (12 Mbps) or low-speed mode (1.5 Mbps). The SC Line Status register can be used to check the line sto- 1us lik fo tho PC) to determine whether o link actually ex- ists (plug connected) or th link is interrupted somewhere. The SC_Address register is used to set the slave address assigned by the PC during the enumeration process. The SC_Interrupi_Mask register specifies which interrupts are allowed (which meons they can generate an 8051 inter rupl and which ones are not allowed. The microcontroller can use the SC_inferupt_Siatus register fo determine the source of an interrupt Besides these slave-specifc regisers, there is also 0 large set of registers for the USB hos! portion, but they are not described here. As described laler on in this erlicle, the FPGA board cannot act as © host. Hardware The pulhup resistonce that defines he connect condition can be controlled by the microcontroller via pon 3,7. P3.7 is high alter @ reset. MOSFET Té (which con nects the pulkup resisor io D+) is cutoff under this condi- lion, so the PC does not see any connected device. When the software hos initialised the USB care and is ready to communicate withthe PC, it pus P3.7 low. This causes thie D+ to be connected to +3.3 V vio the 1 5:40 resistor. Asa resull, the PC sees that o fullspeed device (12 Mbps) is connected and inliotes commuricotion with the FPGA board. The USBHostSlove core needs © 48-MHz clock. This is stipulated by the USB specification. A clock signal o this, frequency is derived from the SOMHz clock signal by a PlLin the FPGA. The USB core and the T8052 core are both driven by the 48:MHz clock signal. As the TBO52 core can execute all instructions in | to 4 clock cycles [ex- cept the divide instruction, which takes 12 clock eyeles), this provides a considerable amount of computing power {ot least for an 8051). The USB core in he FPGA handles all the tasks necessary for USB communication with the PC. All that remains fo be provided isthe USB physical interface (USB Phy). lis ob is to provide the electrical interface (level adjustmen!) This task is also handled by the FPGA. VOT «btn Mixed Language Besides VOL, hr re seer ce oy detgn 2 Sone drat Ona dl hon a fouae a geoph ated pectoge We Grebe fis opdon a Srey rae of mae Carey maths ndda Var, AMDL, Sen nd soon Fornclgy, he Guar cnplercon soo hon Gono as Rees Ving war owt moa abe ied expen The US core eed in isle “eso. oe ota ober canyons vere VHOL Our den cons bevegaried sna tein: gg dan be Vnleg.and per The moin edvontage ofthis i that you ore not limited to ‘using only VHDL cores or only Verilog cores. You con use them in combination in your designs without ony prob- Jems. Howaver,you do need to know the Verilog aquiva- lenis of some VHDL terms, such as STD_LOGIC signal, The link between the VHDL part and the Verilog par is Jocatad in the USB.vha fil. The file is whot is called @ “wrapper, end is purpose is fo export Verilog signals ax VHDL sigeole, OnE FFF, onFre| cxo00e! ‘x0000 Fare. he HS? pte, Faun Test mamoey genio, 7 dala FPGA 6 twa us U uss Pry Figwe. lock pam he UB xe The USB core also supports host mode, which means it can act 9s 6 PC for functions such as enumerating and driving a USB mouse or other type of USB device. How- ever, host mode cannot be used with the FPGA protolyp- ing board becouse it lacks the necessary hardware (ex femal to the FPGA), Here the USB core can only be used in slave mode with low-speed (1.5 Mbps) or fullspeed (12 Mbps) date transfer. Sample application ur demo application here (222 involves connecting an HID keyboard. It denifes itself to the PC os a keyboard, ‘which causes the PC fo use the Human Interface Device (HID) protocol defined in the USB standard. The main pur pote of the HID protocol is controlling inpui devices such 105 keyboards, mice and joysticks. The principal advan- tage ofthis protocol is hat ell major operating syslems (Window, Linux and MacOS) incorporate drivers for it, so they do not have fo be writen for individual devices. Endpoints O and 1 ore used for communication with the PC. Endpoint 0 is @ contol endpoint, which must be present in every USB device. It is used for basic communi- cation with the PC (enumeration). Enumeration is a proc- 5 that fokes place immediately after a USB device is connecled fo @ host (PC). Each new device is vecognised by the 1.59 resislor connected to the D+ or D-line in every USB device. Ifthe resisior is connected to the D+ line, the device isa fullspsed device (12 Mbps); other wise itis low-speed device (1.5 Mbps). The FPGA pro- totyping board has a switchable resistor for each of these lines, so you con configure it os desired os a fullspeed or low-speed device. The PC detecis the lype of device ‘during enumeration and assigns a slave address to the device. The appropriate driver is then loaded based on the Device Descriptor data sent by the device. After this has been completed, an application can communicate wth he device. his co, tho clive is the HD diver rovided by the operating system. Other endpoinis are fol enabled unl er he ver hos been lot, Inthe case of the HID keyboard, this is endpoint 1, which acts 3 on interupt endpoint (IN = device to PC] ond is used for transmiting keystrokes. Join the FPGA Course with the Elektor FPGA Package! ‘The basis ofthis course i an FPGA Modula powered by an Altera Cyclone FPGA chip, installed on an FPGA Protty sing Boord equipped with a wealth of /O ond to displays (ee the March 2006 sue), Both bourds are available ready-populated ond tested, Together they form 2 solid bess for you fo ty out the ‘examples presented os part ef the couese and so build per- sonal expertise and know-how in the Feld of FPGAS. Further information may be found on the shop/its & mo dles pages of ww: elebtor-alectronics.c0.uk On the Elektor Electronics FPGA prototyping board, push- buttons $2-S4 and the eight DIP switches in S5 are used 08 ‘keys’, with $4 serving as a Shift key. S1 acts os the re- set buton for resetting the 8052 ond the USB core. LED 7 acts os the indicaor for the Number Lock funtion, whi LED 6 acis os the Caps Lock indicator and LED 5 as Scroll Lock indicator. Bonus application (Our second somple application (ex23) is © PS/2 to USB cedapter. You can use this adapter to connect o keyboard with o P5/2 conneclor to a USB port of a PC. The PC wil see the keyboard as o USB keyboard. The FPGA causes the keystrokes ofthe PS/2 keyboard to be transferred via the USB interlace just as though they originated from @ real USB keyboard. Noturally, this exomple uses the PS/2 interlace os well as the USB inerlace. Ths meons the cxictted frmware more extensive, but if you read the PS/2 instalment you should be able to understand how this application works ‘As usual, the software forthe examples described in this instalment is available on the Elektor Electronics website under item number 060025.8.11 (go to Magazine Jenuary 2007 — FPGA Course Fart 8). Andreas Voggeneder Andiees Voggeneder studied Hordware/Soltwore Stems Engineering (HSSE) al the Univaraty of Applied Sciences in Hogenbers, Aste (http://hsse.th-hagenberg. LAI), were he presen sil gives occasional lev. ‘As on enthusascslecronies specaishe devotes port of his ime to designing eta revit wth he help of VHDL and Vriog. He clo 9 moderator a! OpenCaree ://eruem.opencores.com), 0 frum dedieated tothe Healy available T51 8081 processor core uted in several intolmarts of his course neers - 1207 DESIGN TIPS |(7/\"5Si) Blinking Christmas decoration Have your alreedy set up & Chrisimas tree in your house fond decorated it with tradi- fionel lights? Build a couple of these blicking Chrisimas decoro- fions to enhance the Christmas mood. The coloured LEDs blink ine seemingly random sequence fond rote and create a festive oppearance. The circuit fer the blinking Christmos decoration has © very simple design. itis based on. type 4060 digital counter (ICI). This IC has 0 builtin os apen Cillotor with o frequency set by the combination of resistor RY jand capacitor C1. The oscilla output [pin 7) is © square wave nected in three groups between triangular cireuit board. Than fit tor frequency is approximately with o frequency equal io 5 kHz six of the counter oulpuls, with the elaven LEDs. Pay attention to 5 kHz with the component val divided by 23, which mean the cesul that the group of LEDs the polaiy ofthe leads: the short, ves showin here. The oscilloior (5 KHz = 8) = 625 Hz. The os flash in on apparently random laad isthe cathode lead. signal is divided by various fac- cillotor signal is divided by 24 pattern. ‘Alor © final inspection, you con tors by the internal digital cix (16) on the CTA output, by 25 connect a 2 battery to your cvitry of the IC. The division CTS output, and so To ossemble the circuit, frst sok Christmas blinker. It should pro- factors are designated by ‘CT ynals on each of the der the IC socket (mind the polor. duce a festive blinking pattern! in the IC drawing symbol. For outputs thus change at differ- i), the two resistors, the capac Instance, the signal en the CT3._ ent rales, Eleven LEDs are con: itor, and the battary clip tothe Test beeper for your stereo Ton Giesberts ‘rip’ signal becomes increasingly lorger, efter al). To prevent this The test beeper generates o si- acwusiss from happening, a resistor in so- rscidal signal with @ frequen ‘ios with two ant-poralel diodes 7 oF 1,000 Hz, 0 common test (D1 ond 2} are connected in frequency for oudio amplifiers porallel with the feedback (1 It consists of a classical Wie cond 83}. Ifthe voltage increas Bridge oscillator (also known os fo the point hat the threshold 9. Wienfobinson oscillater). voltage of the diodes is exceed: The network thot ed, then these will lowly sar fo frequency con condvct. The consequence of his is connection ofa resistor and is that the total resistance ofthe capacitor (@1/C1) ond a parol feedback is redueed and with lel connection (R2/C2), where that also the amplitude of the the volues of the resistors ond signal. $0 D1 ond D2 provide o capacitors are equal to each stabilising function. cher. This network behaves, of The distorion ofthis simple osc the oscillator frequency (1 kHz lator, after adjustment of PI ond in this case), as wo pure resis «an output vollage of 100 mv (P2 tors. The opamp (ICI) ensures to maximum) is around 0, 1% thot the attenuation of the net. You can edjust the amplitude of work (3 times) is compencat the ouiput signal with P2 as re- ed for. In principle © gain of ‘quired for the application. The 3 times should have been suf Instead of en intelligent ampli: (210%) is lage enough the cow circuit is powered fom 0 9V bat ficient to sustain the otcillation, tude coniroller we chose for @ er the toleronce range. To sustain tery. Because ofthe low current but that is in theory. Because somewhat simpler solution. With the oscillation, a gain of slightly consumplion of only 2 mA the of tolerances in the values, the PT, B3 end Rd you can adjust more thon 3 limes is requited, —ciruit will provide many hours omplification needs 1o be (auto- the goin to the point that oscilla: which would, however, cause of service. matically) adjusted. tion tkes place. The range of P| the amplifier to clip (he ‘round ‘VOT «eer ees 6 J bestth') LABTALK Improving RFID Reader ten picofarads are worth five centimetres 70 Having been in RF electronics for about 30 yeors | must have de- veloped a special awareness for say (hat is, invisible) capaci- {ance ond inductance lurking in all kinds of circuits, Recemly, when | saw my colleagues inthe Elekor lab struggling to get RFID cords decoded using he September 2006 Elekior RFID Reader unit, | could not help noticing thatthe card distance at which the number decoding started to work, wos vary small indeed at ust 1 em or $0. That's disappointing compored to the Mifare light specifica. tions which claim a for more pracical distance of 5 10 7 em. Comparative measurements ‘A few facts wore quickly established. 1. samples ofthe Elektor RFID Reader worked fine os for as the umber decoding is concerned: 2. typical card distance for decoding was 1 cm but exceptions of 0.5 em and 2 em wers observed; 3. @ reader board from a Philips MiFare development system easily achieved 5 cm using the samo RFID cards From these we can list some starting poins forthe investigation! 1. no problems in the digitelcizeitry on the Elekior RFID Read: er boord; 2. the RFID cards are not suspect; 3.4 problem moy exist in the ontenna and 13.56MHz RF sec: tions ofthe Elekior RFID reader. Trial and error Surmising 0 problem with the resonance frequency ofthe onboard ‘ire oop antenna, | intially got out a grid dip meler. Alhough @ Jon Buiting The devil's in the details, in this case, the dielectric constant of our printed circuit hoard material. Don’t be put off! In this month's LabTalk we show how half an hour of measuring, thinking aloud and tweaking one capacitor value was rewarded by a five-fold increase in detection tance for the Elektor RFID Reader. good dip was produced by the or-board antenna, the measure ‘Ment was inaccurate in that he resonance frequency appeared to be dependent on the degree of coupling. So hooked up on codjustable RF signal generator and on osciloscope os ilusrated in Figure 1. The 13.56MHz test signal of 1 Veg or so was fed inductvaly into the RFID Reader via © coupling antenna made from 20 turns of wire shoped to give a diameter of about Sem. A distance of about 5 cm was set up, the RFID Recder wos switched on, and the osciloscope conneciad tothe ‘hat’ end of R6 (simply because the RFIN pin of the MFRC522 chip is hord to get in touch with... Once synchronised, the ‘scope screen told me hed made o sily mistake in forgeting tha! Ihe MFRC522 isnot just receiving © signal at 13.56 MHz, but olso generating one! As a result, he signol from the RF generotoe wos swamped by the cartier supplied by the TX section of the MERC chip. Now, disabling the ransmiter pat ofthe MFRC is tricky so | decided to remove the supply vol tge alogeher, making ie measurement pase in exsence Super results this ime — the indvetively coupled signal from the RF ‘generctor showed up ot R6 and I was able fo make the coupling ‘ery light by increasing the vertical distance between the board ‘and the coupling loop fo about 5 ems. Then, the moment oF tut cheerfuly tuning the Frequency conicl on the vintage HPB640B RF signal generoio, the signal on the ‘scope pecked at a seting of ‘obout 12-4 MHz. That's more than 1 MHz off he mark, conf ing my suspicion. The resonance itself was nicely pronounced sug- gesting o reasonable G factor of the balanced, parallel LC circu formed by the loop antenna, the ‘uning’ copacitors and the com- ponents for impedance matching fo the MFRC chip, Up with the resonance frequency Delving into the intresting part ofthe RFID Reader schematics (reproduced here in Figure 2), the solution was looked obvi- stele - 1207 i t ivi t ‘ous — | thought! From your textbooks you'll no doubt remember thot making 6 parallel LC circuit resonaie at a higher fe requires lowering the inductance (l) and/or the c [QI did not want to mess withthe etched loop a board s0 capacitor positions C25.C28 were given a ‘serious, review’, whilst noficing that osterisked parts C26 and C28 are not filed. Unfortunotely, in this case of too low resonance: frequency, less capacitance was needed, not mare, 3 the ‘pad: ding’ positions C26 and C28 were useless. Apparently, the on: tenn circuit had been designed, protalyped ond tested using PC boord material diferent from that actually used for volume production ofthe RFID Recder by the assembly company. In scholarly ferms: the real e, value, or ‘dielecric constant’ was insuficienlly observed. A quick test wih two 33.pF SMD Cs for C25 and C27 gave Fesonance at about 14.8 MHz, but the next atlempl with 47 pF aps was almost spoton. Inthe end, it twined out that 56 pF was the value that gave resonance os close as possible to the forget frequency of 13.56 MHz The SMD C drawer Mr. Murphy states thot 10 IF 56 pP = required 20 THEN 27/33/47/68 pF = available in large quantities in the drawer So, 27-pF caps were fitted in positions C25/C27 and two more piggy backed on top of these to give a theoretical 54 pF. Good resonance was obtained once again, and hey prosto the distance ot which our RFID cards were reliably read was sud: denly @ good 5.cm, well wihin the MiFare Light specifications. Mission completed. Do it yourself Figure 3 shows a closoup of the PCB area in which you need to work if your RFID Reader is rather insonstve (card recogni: tion range <2 cm) and you with to replicate the modification, Be sure to refer to the PCB component layout printed in the orig: inal article [1] to pestively identify the two 68:aF SMD capac tors C25 and C27 you need to replace. RFID Readers supplied through the Elektor SHOP now come with 56-pF SMD capaci tors fied instead of 68 pF. Finely, t oppears thatthe antenna on the RFID Reader boord is subject to slight detuning if batteries are fited behind it. In prac: tice, the metal surface formed by the batiery pack will cause «@ slighily reduced sensitivity — simply compare with the card distance obtained withthe batteries removed and powering the RFID Reader from USB. If necessary, do the capacitor Nweck- ing trick os oulined in his article to get the best possible card detection range. Reference [1] RFID Reader, Elekor Electonics September 2006. Var kale Oscilloscope F signal generator ge et sup eer bord ed thet renee eee fh anes dino the RAD c168 ee COMIN Gr ‘gee. Costa lt PC eave he otens mating and ng cepa ie sed yesgh od soo hod quel n Det) MODDING & TWEAKING Display Recyclin An el-cheapo LCD controller n Jeroen Domburg & Thijs Beckers LCDs are in. Just about everything these days has a display somewhere. That's nice, since the displays can always be used for something else. Of course, it’s a bit difficult if the LCD doesn’t have a built-in controller. The controller chips are either much too small for DIY work (SMDs with way too many leads) or simply unavailable. But with a bit of ingenuity, it’s always possible to devise a solution. If you work with LCDs ond microcontrollers @ lot, you cor tainly know the feeling: you see o nity LCD in something like @ photocopier or game computer that you'd like to use in your own project. You go looking for the pin layout 50 you can link it fo your own PC or microcontroller, but itturns out that the interface consists of an Hsyne line, @ Veync line, ond four or eight dat lines. That means the LCD is naked {no controller) ‘To get-something cn the disploy in this situation, you have to send the entire image at least 50 times a second. That's riot such a disaster for indusirial applications, since LCD sonirolers are inexpensive and reasonably available from distributors, but it can be a teal problem for electronics hobbyiss. the controller ICs ore usually only available in tiny SMD packages - if they're available a all. Fortu- nalely, you can use modem technology to build your own rudimentary LCD controller using pars thot are easier 10 come by. How it works Here the idea is to operate the display in serial modo You need several things for this: 0 video memory fo store the image, a means 19 send the image tothe LCD several dozen fimes per second (including driving Hsync, Vsync, ‘ond the other signal lines), and some way to update the dota in the video memory. Discreie logic is normally used for the liter hwo functions, but as regular readers ofthis topic know, © lot of problems can be solved using on AYR. In his project, we managed fo ‘compact’ o whole lo} of electronics that would normally be implemented in discrete logic into software running in an ATTiny2313. The T2513 is nice device, but te downside shot it has only 15 1/0 pins. This is nowhere near enough if you ‘wont fo use SRAM for the video memory. It takes a 16K RAM chip just to feed a display with 320 x 240 pixels, which means 14 lines for the address data alone, and then you sil need date lines, memory contral lines, and contol ines for ihe LCD. This would make a larger AVR necessary, but that's not what you want Fortunaiely, there's another way to tackle this problem by using cnother iype of RAM that is used much less offen by the average hobbyist: DRAM. The drawback of this sort ‘of RAM is that if must be refreshed continually. In od tion, it can't be connected lo @ standard address bus. In this application, neither of these drawbacks presents a problem, Ifthe ORAM is used as a video memory, it wil be read out (ond thus refreshed) every 200 ms, and you aren't using 6 siandard address bus here anyhow. (See the inset How DRAM works’ for a general explanation of RAM operation.) Intelligent use With @ DRAM, you hove to drive @ total of sight address lines plus o set data lines (four lines inthis arrangement) The two addtess byies are latched on the foling edges of RAS ond CAS. This should mean thatthe adakets lines ‘can have ony desired value when WE or OE goes low. I's thus possible to use the address lines for data, which means you can omit ihe data lines. This reduces the total number of multiplexed lines to eight (plus four control lines). Thar's not bed if you consider that you're driving (64 KB with just 12 finest Noturally, the idea isto link cll this to an LCD. A type thot can be used with this sort of circuit has of most eight data lines, plus « line that marks the stan of a frame (FLM), @ ine thot marks the star of line (LP, « lina forthe sar pling clock (XSCU), and possibly some other stuff, such os « display-enable line or @ line thot has to be toggled aker each frame. With « bit of luck, there will only be three control lines, ond even then i's possible to combine one cof the signals with one of the RAM lines. This means you need only 14 lines in total. Fyou use the last available line asa serial port to write data to the RAM, you use all the available ports of the ATTiny. Bad luck ‘We needed only 14 lines and hwo quite common ICs for the first prototype of the display controller and the first di ploy, That's not bad for something that normally requires dodicoted hardware. Unfortunately, things aren't always so easy. No matter ka aes ~ V7 how careful you ore, @ single wrong connection can be the kiss of death for your hardware, ond displays are no exception to the rule. To make a long slory short: our first display landed in the rubbish bin clong with a set of vvaporised line drivers. The replacement display turned gut to need on ext Iine. Nour, hs could be shed by using a large microcontroller, but this would probably ‘eon that the firmware would have to be revised from the ground up. We thus had to come up with o different solu jion. We augmented the already highly mullifunctional od- dress/data lines for the RAM with a laich fo provide eight more outpuls. This brought the fotal number of ICs in final yerson of th cic to Three, which is ail ovespectobly low number. Hardware We've already more or less revealed the overall archi- tecture, s0 the schematic diagram in Figure 1 shouldn't contoin any surprises. Input buffer R1/R2/T1 converts the 85232 signal fo © TTL level, and it can be omitted ifthe circuit is connected directly fo another microcontroller. ips and transfers the data on About the author Jeroen Domburg iso student ot the Soxion Technical Univertity in Enschede, the Net- herlands. Jeroen is on enthusiastic hobbyist, with interest in mierocontrolles, elec tronies ond computers, In this column he deploys his personal henley modifications ond other intros fing Crevits, which do not necessarily have f be usaf. In most cores they are not Ikely to win @ beauty contest and softy is generally taken with o grain of sah. But thot doesn't concazn the author t all As long as the circuit doas what i was inten ded for then alls wall You have been wemned! ER B82 °sRseaR Fig The she age ens ia ad data es. Yo cn count ther pat nth ge of or band, 100 - le leenie 73 LS.) MODDING & TWEAKING the serial interface port to the video memory. IC2 is a loich. In principle, a 74HC373 could be used just as well here if the different pin layout makes things easier. Finally, IC3 is the DRAM - in this case @ HY514400, which was sclvaged from an EDO RAM module from an eld PC. In ple, any RAM with o copacity of a least 64 k words cond a 4 bit dato bus could be used here. The interface lines ofthe LCD used hate aro labelled LP, FIM, FR ond XSCL, but other labels such as HSYNC, VSYNC, and M or CPI, CP2 and S are often used. Find the dota sheet ofthe LCD you want fo use and see which signals it uses. Also check to see how they have to be connected. Software The software in the microcontroller uses o couple of tricks to make everything go a bit smoother. The program spend most ofits ime feeding data to the LCD. The ki number fo be soni out is set in the RAM by the folling edge of RAS. The octal line content i addass using ‘nly CAS edges. This saves a lot of extra decision loops, which makes it possible to maintain a high frome rate. This means is not possible to interrupt the tansfer of o line tothe LCD to write @ byte from the serial port to the DRAM, so doia received on the serial por is firs stored in « buffer in the AVR. When the AVR is Finished sending bits to the display, the bits in the buffer are then writen to the RAM in single go. This minimises the visible effact on display refreshing, ‘he bottom of| =the whole as deeribed ie thet eh espe ‘ed by th irs boxed ‘HD p The schematic diagram also includes an extension: two ad dress lines ofthe RAM (A8 and A9) are connected to the lotch. This makes it possible to select a ‘page’ in memory. Ifthe address bits on these lines are changed, the display receives daia from a completely diferent memory area. You may be wondering whol iis is good fer, Wel the firmware is configured so that it always displays two fromes from page O and then a frame from page |, you can generate grey tones. IF« pixel is set in both pages, it will have on average ‘on’ time of 100% inthe dizplay. iFit is only set in page O, its average ‘on’ time will be only 66%, and the ‘on’ time drops to 33% if it is only set in page T. Thonks tothe high frame rate, your eye will hardly notice thot the pixels are being switched on or off constantly, with the cesult hat it sees @ nice grey tone. The only disadvantage is that twice as much data has to be transferred to the controller. For the 160 x 160 display used here, the ransfr takes elmos! a fll second, AAs ates, we also incorporated modes with thes ond four pages, which give pixel depths of 3 and 4 bits per pixel (bppI. This produces surprisingly good results. At 4 bpp with dithering enabled, the steps between the grey levels are hardly visible ond each image is displayed like 0 black ond white photo There are also disadvantages fo this technique — in par Ficulor, he frome rote is reduced by 50% for each exira page. As a result, the lightest and darkest fones appear to Ficker a lot more. For this reason, the number of bits | is configurable inthe final version of he software, 50 you can decide for each application or even for each th 2 bp. Us hich explsns th varia white line L159 Lt. ely, ane of the la llc lenis - 007 transferred image what balance you want fo have be- tween the number of grey tones and the frame rale and hransfr time. The serial inierface to the PC is quite simple, Use o termi- ral emulator program such Gs HyperTerminal for Win- dows or vTerm for Linux. Set the communication param: ets 0 115,200 baud, & bits, no parity, and 1 stop bit The data is transferred in binary form one line ato ime. The fist byte is ¢ synchronisation byte with the value 0x5, which is followed by a byte that specifies the page ‘where the line is to be stored. This is followed in tun by a byte with the ¥ coordinate of the line of pixels fo be trans- ferred, and then by the pixel dota, You can configure the number of bits per pixel by inser ing an exta se if bys after the synchronisation byte. The first byte has a value of OxFE, and the nex! one siales the number of bits per pixel in binary notation. If you're « bit uncertain about all this, have © look atthe sample code at [1] ond [2]. The firmware con also be download- ed from these sources Although the circuit and the firmware are based on a 4 bit LCD and 4-bit RAM, there are no hardware obstacles to extending the design to 8 bits. I you use a RAM with ‘on B-bit data bus, the concept will sill work with @ few modifications to the software. An 8-bit RAM can also be formed using two bit chips. In this case, fe together all ihe signals except the data lines and use the two 4.bit VHT - kilt dota busses oso single B-it bus fo create an bil mem- ory. Incidentally, you can use he same principle to moke 2. 4bit DRAM from I-bit chips, but inthis cose you will natvaly ned four ICs Th fimwore wil also have lo be modified in this case. Web links 11] sprite.studertstwentel/~jeroen/projects/ede-ovr 12) woelektorcom How DRAM works DRAM hos several control lines (RES, CAS, OE and WE) in addtfon fo the address lines. And af course, i also hos lines of DRAM chins are muttplexed, 206 chip with 64 k words has only sigh! o: 2 tot of dota lines. The ade dress lines. The addres first placing the frst eight Bits of the address on the lines and pulling RAS low, ond thon placing the second sigh bis onthe lines and pling TRS low. The data can then be re0d by pulling OE low. Te writ dota, you place the data-on the data lines ond then 5 RETRONICS Luc Lemmens ‘never change a winning team’, this technolegy was held onto for mony yeers. But in the end the power and flexibility of dig ital electronics was recognised, ‘ond the new possibilities that it offered, in poricuar the increase in processing speed. That is be- couse the combination of relays fond score-motor is very slow: every counter required 6 eariain ‘omount of fime to change ene step, every relay in the circuit caused a delay and the speed of ‘he seore-mator could nat be in creased with impunity. ‘What do you do with o large pile of electromechanical counters from the scrap paris bin? Ex. pally the seme os with other dis- play devices from the past: you turn them into a clock, just like the Nikie-tube clack elsewhere in this issue. Such components from the old paris box are emi= rently suitable for all kinds of designer timepieces, the combi- nation of ald and new technol- ogy hos © certain eppeol. The picture of the clock that we are describing here immediately re- veal the origin of the counters, thot is, an old electromechani- al pinball machine. The clock is bull into the so-called backglass. ‘The five large relays undernacth A glance ot the second picture shows how this wos @ very com- plex ossembly of relays, switching contacts, so-called stepper units, motors and of course the wiring the counters ore the control logic The ‘programming’ of a ginball for the number wheels, the PCB machine was fixed entirely in ot bottom lett provides the clock hardware and it must have been ficks ond is with its CMOS-iech- by the bell, which then starts @ ern calculators and computers an immense liberation for the nology an anachronism. But with score-motor which in turn gen- have long included fubes, ran- designers when the reprogram Emtechnology a pulse generator erates the required pulses ond sistors ond even ICs, it would ming of @ design became o mat- is ingispensable, In the cose of depending on the sia of vari- take unil about the mid seven- ter of just plugging in o couple © clock you need « pulse every ous relays ~ ensures the correct fies before the gaming machine of new EPROMs. For the players minute [star of @ new even!) fol- processing of the points scored industry finolly embraced the the disoppearance of al the ral- lowed by @ few quick ones offer ond than finally siops egain. microcontroller. After all, ralay ting and ticking wes something thet to ge all the number wheels technology was reasonebly ro- fo get used to, but time moves in the correct position (process- (Electro-|mechanicol calevlators bust and over many years had fast: the first elecironie pinball ing the even!) In an EM-pinball existed long before the creation proved itself a8.@ control system machines are now already port machine the ‘start” is caused of semiconductor electronies. Sut for pinball machines and ather of nostalgic! by © target that has been hit while the development of mod- gaming machines. In the spirit of " % leo acer - 2007 Hexadoku Puzzle with an electronic touch Hexadoku has proved very successful so we cheerfully continue producing and publishing the puzzle instalments in the new year. Some of you may need a day to solve Hexadolu, others less than half an hour (they say). No matter as long as you're having fun. ‘The instructions for this puzzle determine the stort situation. All correct entries received for each month's puzzle go into a draw for a main prize that all hexadecimal numbers ond three lesser prizes. All you need to do is send us the ‘numbers in the grey boxes. cre straightforward. In the di- ‘ogram composed of 16 x 16 boxes, enter numbers such O through F (that's 0-9 and AGF) occur once only in each row, once in each column ‘ond in each of the 4x4 boxes (marked by the thicker black lines). A number of clues are siven in the puzzle and these our website (Magazine The puzzle is olso oveiloble os a free download from +2007 = Prize winners ‘The solution of the November 2006 Hexadoky js: 1AC70. ‘The E-blocks Starter Kit Professional goes to: Paul Keers (Heworth). FI7|E 8 2 6 D 1 3|E B Alc 2|D|3 7 8]5 B ) 5 0|D 1 4 813|7 8 A|0O Cl2 3 D 5|2 E|B7|9 4|C/3 7\9 3 2 B 6|0|8 D Cc B|2 0}2 F 7|D/B|3 C\E|5]A B 7 5 c 0 F E/3/1/A]F 6 0 9 E | ‘l B 7 B|O|A D E|9 0|3 8 1|7 E|8|5 O|F 3 Cc 7 5|6|F 8|D}0O V0 «wee eats Lea INFOTAINMENT Participate! fhe grey bos Elektor Electronics Hexadoku Regus Brentford 1000 Great West Road Brentford TWS 9HH United Kingdom. Fax (++44)(0)208 2614447 Email: editor@elektor-electronics.co.uk Subject: hexadoku 1-2007. The closing date is 1Februaty 2006. ‘An Elektor SHOP voucher worth £35.00 goes fo: Greg Eaton (Vitor, il; Frona Klein (shops Cleove, Us); Guy Savage (Wes Waton, UK, Congratulations everybody! Solve Hexadoku and win! Correct solutions received enter a prize draw for an E-blocks. Starter Kit Professional worth £248.55 fond three Eleldor Electronics SHOP Vouchers worth £35.00 each. We believe these prizes should encourage all our readers 10 porticipatel 7” SHOWCASE To book your showcase space contact Huson International Media ISLC OREE TELE Fax 0044 (0) 1932 564998 ATC SEMITEC LTD w.atosemiter co.uk Thermal and current-sensitive components {or temperature control and circuit protection, NIC Thermistors —_* Current Diodes # Thermosiais| ‘+ Re-seltable Fuses Thermal Fuses» Temperature Sensors Call today for fee samples and pricing Tek 1606 871680 Fax: 1606 872098 AVIT RESEARCH i anireserh cok USB has never been so simple. vith uF US to Mcrcoiaernertae cab ‘Appears jst ike sei pr ton PC and ircuntar, for ely 605 USB connection to YoUr projets oreplacement of existing S22 inraces Se, See cur webpage for more etal Only £2899 at BAEC hitp-baectriaad.com ‘The Bish Amatour Electronics, (lub Archive Website. Archiving extracts from 140+ Newsletters from 1968- 2002. Currently have intresting and useful selected articles fom 12 Newsletters. Also a section about uit electronics projects with ‘schematics and photos. Plus usell info, ‘dovnioads and links. NO ADVERTS!" BETA LAYOUT sava.gcb-packcom Beta layout Lid Award- winaing site in both English and Garman offers prototype POBs ata traction ofthe cost ofthe usual manufacturers prices. COMPULOGIC LTD ‘ween.compulagi.coik Ieret emote Control Starter Kt 2139.99 Create a simple web based remote contol interface for many applications * Miniature Web Server Module + Analogue/Digital Module PSU * Manuals, software, example HTML code CONFORD ELECTRONICS hiips/rmccontordelec.co.uk Lightweight portable batery/mains audio units offering the highest technical performance. ‘Microphone, Phantom Power and Headphone ‘Ampiirs.Batanced/unbalanced signal ines with extensive RFI protection, FUTURE TECHNOLOGY DEVICES Inp:ravvtichip.cam TDI designs and sas USB-UART end USB-FIFO interiace ics, 7 Complete with PC divers, these devices simpity the task of designing or ‘upgrading peripherals to USB DANBURY ELECTRONICS htp:/wwre Danburylectronics.co.k Transformer manufacturers since 1983, Vist our ‘ew stat Aso lnk cre to Mike Home's Valel- “ube DIY amplifier sit, featuring ou standard Au Transfomers (tains, Output, Chokes, PP SE, tc), EASYSYNC http-/hvwrn.easysync.co.uk EasySyne Lid sels a wide ‘ange of single and multi- ‘port USB to RS232iRS422 ‘and RB485 converters at competitive prices. FUTURLEC itm Tuctae.com Save upto 60% on * Electronic Components ‘ Microcontrollers, PC, Atmel + Development Boards, Programmers Huge range of products avalab on-line for immediate ceivery at very compatitve prices. HEROS TECHNOLOGY LTD ‘werostacinalogy.o.uk Introducing Modular Concept fr ELNEG age coum rs + doves programmer merufacrer ‘sling tough contracted istributors all over the word * universal and decicated device programmers + excellent support and afer sale support SW updates + roiale HW * once a months new SW release * thres years warranty for most programmers FIRST TECHNOLOGY TRANSFER LI hag f8.co.uiPICProfrng i ‘Microchip Professional € ‘and Assembly Programming Courses. ‘The future is embedded. ‘Microchip Consultan /Taining Parnor developed courses: * Distance leering / instructor ted ‘+ Assembly /C-Programming of PIC16, PICI8, PIC24,d3P1C microcontolers ‘+ Foundation ‘Intermediate ‘microcontrollers Suitable for Developers, Pre-production, Ecucatonal and Hobby application, * WinPIC2006 USB fll speed programmer. * (PU microcontroller modules. ‘ Peripheral modules forall mcrocontrors, pe JLB ELECTRONICS ‘ieelectonics.com ‘Supplier of electrical electronic parts and consumables. Including * Gable tes / bases Tools / hardware » Boollace ferrules * Connectors * Solvent sprays & cleaners = PuCTape Heat Sink compound KMK TECHNOLOGIES Ltd. hiv kk. com. Low Cost Ory Robotic Kits ‘and Computer| Contraler Boards. 78 deb eeons-1/2007

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy