Home
new product news
Contents
1. TemperatureDecNum Convert the converted value to an integer Temperaturelext Text With MSChartl Data Temperature Now lets TemperatureDecNum Plot amp c Output the string graph it data to current location autoi ncrement is on End With End If End Select data without additional code overhead The Visual Basic based GUI allows for a professional looking GUI in an easy to use design environment The built in component controls put the complex pieces in a simple format that you can easily integrate into your application The language should be familiar to anyone with BASIC lan guage experience Explore these topics in greater detail before you begin your project Good luck k Bruce M Pride holds an A S and B S in electronics and currently works as a senior electrical engineer He enjoys embedded system hardware and soft ware design particularly designs with 32 bit microprocessors FPGAs and various microcontrollers Bruce spends his spare time with his family playing acoustic guitar competing in Circuit Cellar design contests and consulting via his side business Pride Embedded LLC You may contact him at Bruce Pride PridEEmbedded com PROJECT FILES To download the code and schematics go to ftp circuitcellar com pub Circuit _Cellar 2005 177 CIRCUIT CELLAR Command finished RESOURCES S Furber ARM System on Chip Archit
2. 1 TS 7200 149 E 00 32 MB SDRAM 8 MB Flash veces Compact Flash socket 10 100 Ethernet 2 USB ports 20 Digital I O A D opt 2 Serial Ports Optional USB WiFi adap Support for Windows Shown with optional A D converter 9302 ARMS processor with MMU CompactFlash and 485 a Boots TS Linux from on board flash in 5 seconds TS Linux for ARM is open source GNU Linux Low power 5v 400 3 8 x 4 5 200 MHz ARM PC 104 32 MB Flash 10 100 Ethernet 2 USB ports 20 Digital 1 0 2 Serial Ports Shown with optional A D 5 ch 12 bit A D Optional USB WiFi adapter and R5 485 ET The 256 ME USB drive shown holds our Debian 3 0 2 ARMS processor with MMU development environment lor ARM Boating to the development E fla File system aliews code develapment re take place directi an TS Linux from on board flash the target hardware eliminating any issues with transfering TS Linux for ARM is open source GNU Linux newly compiled files from the desktop to the target device Low power 5 V 400mA n 3 8 X 4 5 Cross compiler tools are also available for Windenws and Linki www embeddedx86 com 480 837 5200 A Te ol O g 16610 E Laser Drive 10 SYSTEMS Fountain Hills AZ 85268 USA PC 104 PCMCIA slot
3. Tope eco mamal ord The Standard Version for boards Eurand format with up 1o 4 segna puits Tuy ERE Das d LE Mis sheets The CIRCUIT CELLAR EAGLE 4 1 Schematic Caplure Board Layoul Windows Linux ETEETETEN Issue 177 April 2005 15 i SOFTWARE Keil Professional Embedded Development Solutions provide the tools you need for your 8051 251 6 and ARM projects Tools from Keil help you efficiently create test amp complete your embedded projects imime lim rm iam Gerd 2 The p ision3 IDE Debugger supports virtual target simulation and includes a software logic analyzer that graphically displays variables and registers The p ision3 Development Environment provides complete device simulation and includes peripheral dialogs that aid development of software drivers aE T Supported Architectures development tools for ARM support a wide variety of devices from the most popular chip vendors Keil development tools for the XC x Cl x and STIO support over 50 devices from Infineon and STIMicroelectronics Keil development tools for the Bx5 1 support over 600 different deriva
4. Electronic assembles graphic overlays SS ahon 40 pin Zik 5200 devices down te LIV No adapter universal pragrammers tp ALL 13 e Eleclronic file Iransfer capabilities fa device library free updates required Tor DIL dissess B Hrs THILO er LAB TOOL 38 CADAVANTECHO Prageams Er E hit EPR NS operation on x rger Prawiding virtually matching perfi 2 i E i 4 PRONS 0 raar RAM FLASH ircluredo Buns WIN 98 HT ME mame al only 11 1 the price Picofab i me deer 1 PALCE 2000 XP with Hex Fuse Editar Info orters softer 619 702 4420 476068 Blvd Hend Bogrnossa Chariesbourg Quebec Canada GIH 3 7 j A MA Tel 418 822 5298 e Fox 418 222 9996 t i In a wiww conibec net Ermali sales amp picofab nat DATAS TS TERS 151 47H AVE ELITE 31 Da TEL BS ee A DN RS 932 NOW YOU CAN Lieben ALL Technologies h g Stackable 1710 B Brighton Cove Ft Walton Beach FL 32547 650 863 5723 Digital iO Analog Input Analog Output Solid State i Relays Stepper Motor Controllers Pulse Counters DOS m is Pulse Timers Frequency Measurement RPM Easy Software Development Lise your or Basi com Measurement Duty Cycle Measurement Period prier In prodan DOS EXE Downinad EXE tn fersnides wa serial Measurement Projectie Velocity Measurement EXE rans on poser up rd Partv heral interfac
5. frame s Clock Cycle Count sample the red value PI NB Sample the green value PINC the high nibble lookup red membership sample the blue value PINB green membershi p 2 blue membership mask memberships together 1 to produce the final routine came in and set our and blow away this color T flag in SREG then we data common cleanup not set 1 the run continues 1 it does 2 16 clock cycles 16 clock cycles 1 pixelBlock ti me meon the debug line to sbi SFR IO ADDR PORTD PD6 nop cbi SFR IO ADDR PORTD PD6 mov tmp2 pixel RunStart Get the current TCNT1 value and calculate pixel run in pi xel Count mov pixelRunStart Count sub pixel Count t mp2 st X lastCol or pt X pi xel Count mov dlastColor color Set indicate a color SFR 0 ADDR TCNTI1L Record the color run Line buffer astCol or change Get the count value of the current pixel run reload the pi xel RunStart for the next in the current length so you can figure out with its when it changes Nop Waste one more cycle for rjmp _acquirePixel Block CIRCUIT CELLAR a total of 16 www circuitcellar com HOLTEK k 1 W 1 48 Universal Multi Programmabie MC Us for Intelligent Control Superior Price Function Ratio Industrial Specifications 40 C 85 C High noise im
6. 01 0 it easy to invoke func Fn Pointer fn_ptri MyStatus SendKBStatus SendKey Keypad func ClrLCDCmd DspChr GotoXYCmd DspStr LCD related functions bit EvCmd Reading and processing command void SerComl nPtr void interrupt 4 Recei ve command in serial ISR if Tl nterrupt is due to TI flag ITXEmpty 1 Store TI status Tl 0 Clear TI to avoid further interrupt return 11 Transmission section done Command byte is received Go Process the command f TxXEmpt y Restore TI flag to use SendChrw function Disable the serial ISR for the moment Read command byte Notify that command is received RecvChrw Ev Cmd 21 void 01 SR void interrupt 1 Scan a matrix keypad THO TLO TROSI Kbd COUNTHI GH Reload the timerO 16 bit register COUNTLOW For 10 ms keypad scanning Run the ti mero Execute the keypad state machine code char Sign OnMsg Keypad amp LCD server mai n InitSer51 Ini ttbi H Str2LCD Sign 0nMsg 11 Got oXY 0 3 it serial port 9600 8 N 1 it the 4 x 20 LCD tify this controller ready sition cursor at 0 3 TMOD THO TLO TRO ET0 ES EA 121 Ti mer model timerl seria OUNTHI GH OUNTLOW lnit timer for 10 ms Run ti mer Enable timerO Interrupt Enable serial Interrupt Enable global interrupt 0 1 1 1 1 1 i f 1115 valid command ready
7. fn_ptri Cmd Receive amp process command EvCmdServed 1 Notify command executed ES 1 Enable serial interrupt EvCmd 0 Clear previous command www circuitcellar com CIRCUIT CELLAR Kolhapur India He currently designs laser based instruments Viraj is inter ested in laser based instrumentation for industrial and meteorological applica tions and embedded systems You may contact him at viraj acat ernet in Prajakta Deshpande holds a B S from Sagar U niversity India and an M C A from Barkatullah Vishwa Vidyalaya Bhopal India She is a lecturer in computer science Prajakta may reach her at ppd nettaxi com Praveen Deshpande holds a bachelor s degree in electronics engineering from the Regional Engineering College REC Nagpur India Heis currently working as a senior scientific officer in the field of distributed data acquisition and control His interests include real time operating systems and distributed control You may contact him at ppd cat ernet in PROJECT FILES To download the code go to ftp ciruit cellar com pub Circuit Cellar 2005 177 RESOURCES Intel Corp 8XC51 FA FB FC PCA Cookbook AP 440 February 1990 MCS 51 Microcontroller Family User s Manual http devel oper intel com design mcs51 manu als 272383 htm T Kenjo Stepping Motors and Their Microprocessor Control Oxford Clarendon Press 1985 Philips Semiconductors Comprehensive Product
8. MI OTITEOTS Gere Our Other asd 4 dany adaig aiius 1 GADES SOTWATE ROWE T Supply m besar CIE Mo jarana ig E Time buin EE c A A k k k E i k _ k k ioois EconoROM Ill amp FlexROM lll EPROM amp FLASH Emulation at its best from 179 00 Pb E EN E BM LE deeds dE AB co ee Ee a Cr Paper Fuga m ae limy nmann r amalnmar lemmas LI fe pra geen rmm This minimi s P d Vi lama i 1 m HI TONERS HE ee E x P 6 umm E um HN Fem aaa tech easel an ga 972 272 9392 sales tech tools com Copyright 2005 TechTools DigiView FlexROM EconoROM and QuickWriter are V7 trademarks of TechTools PiCmicro is a registered trademark of Microchip Technology Inc We stock an endless variety of robots accessories components and sensors Pictured above from left to right are the HexCrawler robot the Crawler accessory kit the SumoBot the Toddler walking robot the Tank Tread accessory kit With free technical support and an active Robotics Discussion Forum Parallax robots simply cannot be beat For more information visit the ROBOTICS section of www parallax com Ready to jump into robotics Begin your ad
9. module 1 RS zX2 1 R5 232HB 16 GETO IDE FOO Parallol Viabcheog 2 56 X 1 77 Optional 4M 65 00 ea 50 75 Tragis unit 100 pricing COP 02k VE 3 5 385 Embodied CRTLCD 1RS5 232 1 5 23244085 Parla DiakOnchnip IDE FOO Wako AME 4 01 X 5 67 222 00 154 00 Srey util 100 pricing aen Embedded pyem modula 155232 1445232488 16 Ethan IDE ATC Watches KB JMB RAM 314 1590 5100 00 78 00 City 100 pricing PONH 366 Embedded SBC 13B5 232 1 245 232 485 1 parallel KA DiskOnChip IDE FDD RTC Watchdog AME RAM 3777 354 142 00 aa 99 00 ea Cty 100 pricing Supported OS Davalopment Environment nos Embedded Linux Using Cic DOS mpplicaton can be develop in ean on ad of our pr cecsor moduli Doce sire for DOS provided m appiicatien with iam come Eample implementation for B ORCITPIOHCP FTE SMTP TELNET amp TAL ene nadahin for Gowniinad from our Web sip Wane corm Buldsack Lit n RON ra a E d 1 XLinux komal approx 3B m mauis Una Kernel 2 4 1H EM MEL E FTPAALL udhep WN amp Web based m protocol for message trans mission unique addresses for each module in a sys tem the acknowledgement of a command and the dis asters that can occur when they aren t pr
10. p Fu IM Law macrocontrollar tarmih om the meusi avadabie fram aver 40 manufacturers ina lk E Bs FURT range of chaps HIETECH 8051 C is feld proven ANS C compiler supporting over GU diFerent microcontrollers HI TECH C is also available for severz other popular embedded microcontrallers You chose the right chip Now choose the right tools HI TECH Software Industrial strength tools for embedded software development Compact efficient code for ARM and 8051 processors You thought long and hard about which chip to use for your next project It s a crucial decision choose the noht architecture and you just might create a product that changes the world Choose the wrong one and your project may be off to a slow start The next critical decision is what tools to use You know you want compact efficient code You know you need reliable and dependable tools from a company with beat For over two decades HI TECH Software has delivered the industry s most reliable tools for developing efficient and compact code to run on the most popular embedded processors Used by tens af thousands of customers including General m em amm Motors VVhirlpool Qualcomm John Deere and many others HI TECH development tools and weorkitlass support staff have helped serious programmers to create hundreds of successful embedded products Find out more or download a demo at http
11. the moet populal programmable the world the Farallax Hae Bot we show you how easy it i amp lo beam abaut robotics WATCH THE TRAILER AND Buy YOUR cory AT AR BRAZEN TEK Va u C AN Where Technology amp Creativity Steet The High Value 4 F eSB to CAN Tool For e Simple soltware Controller analyzer included Area amp DLL with examples Network for custom applications PC isolated fram CAN Committed to bring your electronic needs with superior innovation and advancement to meet the design and development of the Market Embedded Systems e 100 bandwidth at 500Kb e Touchscreen Operated GUI Hardw i e softw are Only 128x240 CCFL Backlit Graphic Display Design R amp D 2 95 Programmable in or Forth Test amp Validation Consulting www brazentek com exc Net 818 708 2278 Mosaic Industries Ine m www intrepidcs com tel 510 790 1255 fax 510 790 0925 8700 Sherman Way Suite 103 um r WW mosaic industries com Reseda CA 91335 USA www circuitcellar com CIRCUIT CELLAR Issue 177 April2005 91 Control Boards NEW Web Control Board includes Atmel ATSSCSIRD2 Microcontroller With RTL801BAS Full Duplex Ethernei Controller IC can Connects Most Networks deal for Web Remote Control in Circuit senal Programming RTC EEPROM R5232 Communacation Also Available Mew Board
12. 176 pixels x line 144 lines 30 frames frame second That s a lot of data It s actually too much data so a couple of simplifica tions are made For starters there are twice as many green pixels as there are red and blue and only one green is needed So every other green pixel is ignored In addition when the system is tracking colors every other two pixel block is skipped reducing the horizontal resolution to 88 pixels per line This leaves the actual amount of data to be processed a little over 1 million bits per second How can this much data be processed Figures 3 and 4 demonstrate the main reasons Another hardware trick is to use the 17 7 MHz crystal source from the OV6620 to drive the clock input of the ATmega8 The microcontroller is only rated to run up to 16 MEZ so this is clearly exceeding its limitations but only slightly The benefit here is huge there s inherent synchronization between the pixel data flowing from the image sensor and the sampling of pixel data on the ATmega8 Thus after syn chronization at the beginning of each image line it isn t necessary to sam ple PCLK to determine when valid data exists on the data buses Ensuring the sampling of the pixel buses at the appropriate time or in this case after the appropriate number of executed instructions is the only requirement TWO S A CROWD There is only one problem with the aforementioned scenario The 17 7 MHz 14 Iss
13. 7 infal Philips MEC Kodak Makig LS Military Micros Dell Limin ri Harris Sany 444 Thomson Sandisk D namica H Pr Campag erc PCB123 Provides the w Complete Circuit Board Design Through Order Order up to 100 pcs with Quick Turn Around New libraries contain over a 1000 common devices PIC MCU AVR Flash OTP EPROM S and much more DigiKey Jameco amp Mouser part numbers Templates for PC104 PC 104 Rabbit PCI amp more PCB 136265 Freeman Rd Mulino OR 97042 USA DOWNLOAD THE NEW VERSION pie MU Phone 800 228 8198 x236 Fax 503 829 6657 wWww pct 23 comic YOUR P Gb CUCU te CIRCUIT lt eo ili Lig Have design files SN Tor ee CIRCUIT pO successfully selling online since 1997 Experience can trust Try us out today TAN www PC express com cc E ci GH 232 serial interface on a nine pin D type male connector CN3 is implemented by way of a MAX232 IC2 transceiver The stepper motor sequencer IC L297 is the heart of the driver In the past we ve used three similar devices IC3 IC4 and 5 for the x y and z axis motors respectively An external resistor R22 an external capacitor C9 and an on chip oscillator circuit IC3 generate a common clock signal for all the L297 devices Each L297 device generates four logic output signals a
14. FEATURE ARTICLE by Eric Gagnon Digital RC Servo Controller Part 1 32 Channel Design D ESIG H The days of linking serial servo controllers to support a high number of channels are over the first part of this series Eric explores RC serial servo controller theory Plan on using a 32 channel controller in your next robotics project S overal months ago I saw an adver tisement for a 25 channel radio con trolled RC serial servo controller A serial servo controller s function is to control multiple RC servos while pro viding a simple serial command inter face Armed with a renewed interest in the subject I decided to research the market further It turns out that a number of commercial products allow for serial based control of RC servos most of which only support up to eight channels at 8 bit resolution RC servos have enjoyed a long peri od of popularity among RC enthusi asts The recent explosion in home brew robotics projects has created a new home for the versatile servos Robotic insects in particular require a large number of servos to generate walking motion As well some anima tronics creations demand numerous ser vos to bring them to life In the past you were limited to purchasing several seri al servo controllers and chaining them together to support the high number of channels Things are different now In this article I ll describe a true hardware based 32 channel digital
15. by 30mm 27 Ey 12 Thea ines an CAN Tram Goerniing system independent Both 11 8 28 ml ID support ASCH or Binary proton Finmawrne wogradable Custom design CE arene Stain ened eed deer of zril en Hw Abra and A UP anri ed kiirem ki a Spear Cen didis 88 Issue 177 April 2005 USB to Serial 1 2 4 and B part models R5 232 R5 427 and RS 485 interfaces Data rates to 921 6K bps USB to Digital 48 95 TTL SSR rack compatible Reed and Form C relay outputs Optically isolated inputs v Daisy chain multiple units In Circuit Emulator ICEPIC 3 Next Generation Emulation AB new universa Ip eipzueg fer the PIC Microcontroller Exceptional pedormance and value FEATURES From only 2 Operates within MPLAB 900 Hardware supparit for single steps in e Fast USB connection Ficrochip and level debug in assembler ae C Full speed 40MH emulston ii 1 P 28 5 Emulation p Plug in daughterbnaris Ordered separately to gt i Configure system to the Oe PIZ SEE OUR WEBSITE FOR PIC COMPATABILTY More info www eee PROBLEM SOLVED Custom Hardware amp software Design lt a Rapid Prototypes Cost effective Design Free Consultation and Quotes MJS CONSULTING INC Mark J Samarin M S EE img cem 253 858 6844
16. Figure 2 The Mini SSC II serial servo controller protocol has become the de facto standard supported by many vendors Note that 3 binary bytes of data are sent to command a servo position The OxFF value is reserved as the sync marker Servo addresses and position commands are limited to the 0 to 254 range as a result Issue 177 April 2005 45 PWM would be to generate an inter rupt at the finest granularity resolu tion of the output PWM signal say 8 us for a standard servo Therefore at each clock tick a system counter is incremented A table of the pulse widths for each channel is then scanned and the corresponding I O port pins are toggled low when the main count er has exceeded the respective counts After the 20 ms window is reached all the PWM lines are set high again and the cycle repeats This doesn t always work too well because the resulting interrupt rate is higher than 125 kHz Because of the high overhead most 8 bit MCUS don t have enough horsepower to do the processing required between the interrupt clock ticks A slightly better interrupt based approach is to use the MCU s built in timer At the beginning of a PWM pulse the timer is reloaded with the length of the pulse It s automatically decre mented by the internal hardware clock When it reaches zero an interrupt is generated At that point the MCU lowers the port pin reloads the balance of the 20 ms delay to raise the pin high again and sta
17. copy talking to the real COM port modems in mind a little clunky when it comes to direct RS 232 communications Instead I usually use an emulator called MTTTY which is a sample program that comes with a Microsoft serial port appli cation note itself useful reading To start I set up a simple loop back configuration connecting the PC s real COM port to the CP2102 board s virtual COM port I had to admit some concern that between Windows MTTTY and the Silicon Labs VCP driver the PC might get all choked up trying to talk to itself But as shown in Photo 2 I was able to connect each copy of MTTTY to its COM port real and virtual respectively and establish communication Next I moved up to true computer to computer communication The configu ration consisted of a new and fast XP PC and an old slow Windows 98 laptop I experimented in both directions with each computer taking a turn connecting by real RS 232 and virtual USB COM ports This confirmed that both versions BBC BASIC for Windows 3 12c demo tc serio bbc File Edit Search Utilities Options Run Help ele 8 port OPENUP COM1 baud 115200 parity N data 8 stop 1 IF port 0 PRINT Could not open COM port END PRINT Toggling RTS REPEAT J NOT j SYS EscapeCommFunction Mhfile 9 port 4 j UNTIL FALSE lt fel oResdne Local Echo 287 Display Enors Mo wing NoEvent Font
18. for Engineers and Designers B Easily create and manage multilevel parts lists for products in development and after I O PORT PROPERTIES All unused I O pins should be dis abled or set to a fixed state For exam ple the Motorola MC68328 DragonBall processor enables by default the clock output CLKO pin at reset CLKO which is used for testing the internal PLL outputs a 16 67 MHz sine wave on the pin If it isn t disabled during normal device operation the extrane ous signal may cause unwanted noise Unused I O pins can be configured to detect probing or tampering by setting them to inputs and waiting for a level change If one is detected the device can assume it s being probed and initiate a response This type of detection mecha nism would work only while the device is active which is the most likely time for probing by an attacker to occur In order to prevent against ESD attacks implement ESD protection devices on any connectors or I O pins e g keypads buttons switches or displays exposted to the outside world ESD protection can simply be in the form of clamping diodes or transient voltage suppressor TVS E Track sources for Items with multiple price breaks m Calculate product costs at any quantity m Launch CAD viewer or browser from any Item m Automatically generate RFOs or POs devices Manufacturers include Vishay www transzorb com diodes protec tion tvs esd and Semtech www semt
19. a 10 100 Ethernet SPI bus 2 Serial Ports Compact Flash 24 Digital 1 0 12 bit 8 chan AID a POCHO0A Low EMI AMD Elan 133 MHz 586 with 32 MB 164 MB optional PC compatible BIOS DOS ATC FO amp memory map TS Linux 3 0 is open source GNU Linux Glibe 2 2 5 Power 5y amp 830mA 43 x55 s 1 MB flash drini PC 104 Ethernet Adapter PC 104 daughter board 1lObaseT Ethernet DOS Linux and NetBSD drivers Link and activity LED Header for external LED hookup 3 5 X 1 6 Jumper selection allows up to 4 boards per system TS SER4 89 Four PC compatible COM ports using the 16650 UART with T6 byte FIROS fuil handshaking on two ports RS 485 option on two parts jumper configurable TS DIO24 39 e4 0 5Vv DIO lines opto 22 compatible 50 pin connector 4 outputs can Gnve up ta 3DV 1 Amp 4 inputs are IRO capable VO address jumper selectable 129 TS Modem 33 6K baud jumper configurable as COM1 6 supports 1805 3 15 V32 compliant standard AT commands caller ID 56K baud optional EMIT DiskOnChip Power 5y 500 mA LE 11 a ii Fe n i 37 Digital I O 2 Serial Pons 35 MHz Intel 3BGEX with 8 MB RAM 76 ME DO5 ROM or TS Linux pre installed a PC compatible BIOS DOS memo
20. cc htsoft com HI TECH Software LLC 6600 Silacci Way Gilroy CA 95020 USA Ph 300 735 5715 Web http cc htsoft cam ABOVE THE GROUND PLANE Foolish LED Tricks by Ed Nisley Ed recently bought a cheap LED flashlight that barely worked Rather than ask for a refund he rebuilt the flashlight and learned a lot about LED technology in the process A while ago I ordered a cheap white LED flashlight along with a batch of other electronic parts When I dropped in three AA cells and poked the switch one of the four LEDs began flickering like a strobe light For what it had cost it wasn t worth returning Yes I felt like a fool even though the calendar didn t read April 1 The circuit if you can call it that inside the flashlight consisted of the battery a switch and four white LEDs in parallel No current limiting resis tor no voltage regulator no nothing Well maybe that s the reason why my good LED flashlight cost me five times more than this thing Early in your first electronics class you learn the exponential relation between a diode s current I and its terminal voltage V qv ecu I I l is the diode s reverse leakage current ranging from a few nanoamps to a few milliamps The value of k T q is approx imately 25 mV at room temperature For example with I 1 nA the current is 54 nA at 100 mV 3 uA at 200 mV 485 mA at 500 mV and 2835 MA at 1 V Yes 235 mega
21. ming language using the open source AVR GCC C compiler that s part of the WinAVR distribution The ANSI compli ant C compiler does an excellent job at generating code And best of all it s free which is one of the reasons why it s so popular In keeping with the spirit of open source code all of the source code developed for the AVRcam project was released as open source under the GNU General Public License GPL in the hope that other developers would improve and enhance the system The AVRcam definitely has space left on the ATmega8 for new features Approximately 4 KB of the 8 KB on chip flash program memory 700 bytes of the 1 KB on chip RAM and 48 bytes of the 512 bytes of EEPROM are used by the firmware You may download the code from the Circuit Cellar ftp site Although most of the code was written in C language the two functions at the heart of the system were coded in assembly language to ensure that they met some extremely strict timing requirements One of these functions is used for color blob tracking The other is for image dumping The color blob tracking function is required to do a lot in a short amount of time see Figure 4 Essentially it needs to sample the red green and blue pixels map that RGB combina tion into an actual color of interest in the color map or no color if it doesn t match one and run length encode the line to reduce the amount of data required to process the image All o
22. www senix com Issue 177 April2005 89 IDA Pro Disassembler N i WV Reverse JeeuiDu3 From Aime to Zog nundeecds of uProcessors and ucantrolilers suppomed Older unlimited Fraewarns version available for SOx amp 6 and 720 Free Evoluatien Version The PC de facse standard PC Magazine 2001 Technical Excellence Awards Finalist FE ma ET TEF Serial Ethernet Web Email Simple DTE DCE No SW Changes 99 95 Qty 1 Grid Connect Inc 1 800 975 GRID www serial to ethernet com I AL i M SAA N D VEVIVE FR DRAMIMER VSD ChipMax gt Mage i ani processor and Mai Soe 2 yer warm TopMax USA 4 ma Ea im Ta J Embedded Microcontroller Design mK d Re and ow arce ove 000 de Y Hardware Firmware Design T EPROM FLASH Merrory Mezcanima Sarai EPDM GAL PALCE F Soda i DRUKT dai 110 nr 240 Adapter C 5995 5345 MAG E n rapeorama Au Mire JW emulator EFT Ste fe iea um NP Made in LSA wear waranty Librit Cbina Connection PCB Production Assembly Hus Monitors Protocol Analyzers Turnkey Hos ae Adapters Prototype Production e Mulfiplexers D S 12 per in Bahay s Er 1 Applications 4 L PCB 20c per in So
23. 0 5 plastic spacers The command center consists of a BASIC Stamp 2 board a Ming RX 99 receiver and TX 99 transmitter and opti cal sensors S1 and S2 Bit 0 connects to the TX 99 s data input from the BASIC Stamp 2 board Bit 15 receives data from the RE 99 while bits 8 and 9 receive input status from the optical sen WWw circuitcellar com Photo 1 The simulation starts with the truck approaching the plastic gate attached to the stepper motor s hub A wire antenna sticks out the top of the truck A safety switch on off is on top of the truck sors S and S2 respectively regard ing the truck s position The circuits are powered by 5 VDC see Figure 2b The gate controller consists of a BASIC Stamp 2 board a Ming RX 99 receiver and TX 99 transmitter opti cal sensors S3 and S3 a stepper motor driver board and a motor Bit O con nects to the TX 99 s data input from the BASIC Stamp 2 board Bit 15 receives data from the RE 99 Bits 8 and 9 receive input status from the optical sensors S3 and S4 respective ly regarding the gate s position Bits 1 2 and 3 control the direction step and reset signals to the stepper motor IC SAA1027 The motor and IC are pow ered by 12 VDC The remaining boards are powered by 5 VDC see Figure 2c The truck controller consists of a BASIC Stamp 2 board a Ming RX 99 receiver and TX 99 transmitter an N channel FET that controls the small ana log truck motor and
24. Ethernet Microprocessor Serial 1 0 CIRCUIT CELLAR Photo 1a The charge pump circuit replaces one of the three AA cells in the flashlight machined the aluminum cylinder from a slightly larger toothed belt drive pulley b The four matched LEDs align on their flanges in closely fitted holes The black epoxy blob simply holds them in place LEDs aligned in snug fitting holes which work much better than the original rather flimsy plastic The four LEDs contain the same chip as those profiled in Figure 2a but in a dif Custom Units amp Smart Units Digital Relay amp Extension Cords Vending Security status over TCP IP 5 Axis Camera PTZ Focus Iris Control Large Multidrop amp Home Run R5485 Card Reader Electronics amp Control VF LCD Display Remote Control Industrial units amp 40C to 85C 3 0KV Isolation amp wide Power range Es NN Ww WW RS4BHS COM 4311 AE 5rmith Drive Harmibtan Ohio 4501 1 913 874 4796 www circuitcellar com Four Parallel LEDs 1595 Characteristics i mj al 9 d Ge 1 m p lin m Pin my Voul V right rai hit Figure 4a The voltage versus current characteristic of four matched white LEDs will work nicely with a 3 3 V source Isn t that a pretty curve b The MAX1595EUA33 output remains between 3 2 and 3 25 V through most of the battery s usable life The LED current will vary between
25. FINEST Message Photo 2 Take a look at the real time tracking results from the AVRcam It s tracking a white line on a black back ground which has been segmented into eight different tracked objects tion you can tweak the map to allow for more variation in a particular color channel After it s downloaded to the AVRcam it will use the new color map the next time color tracking is enabled When tracking is enabled a series of tracking packets containing the number of currently tracked objects the colors of each tracked object and the bounding box coordinates of each tracked object are sent via the user interface Up to eight objects can be tracked simultane ously The AVRcamVIEW application allows you to see the tracking results in real time as objects are being tracked The application also provides a time stamped log of all the packets from the AVRcam You can save the log as a text file or XML file specific to the AVRcam protocol This will enable you to analyze the tracking packets at a later time Photo 2 is a screen shot of the AVRcamVIEW application track ing multiple objects simultaneously ChiBots TEST After I had the AVRcam working in various test environments it was time to give it a real world test The Chicago Area Robotics Group www chibots org holds a robot contest twice a year Each ChiBots contest con sists of several different events includ ing basic and advanced line following mini sumo w
26. Micromint 73 Saelig Company Inc 66 Bitscope Designs 85 Garage Technologies 92 microEngineering Labs Inc 3 Scott Edwards Electronics Inc 91 Brazen Tek 90 Grid Connect 88 MJS Consulting 88 Sealevel Systems 86 Brightan Systems 91 Hagstrom Electronics 91 Mosaic Industries Inc 89 Senix Corporation 15 CadSoft Computer Inc 39 HI TECH Software LLC 23 Mouser Electronics 47 Sensatronics 87 Electronics 17 Holmate Holtek Semiconductor Inc 90 Mylydia Inc 5 Sierra Proto Express 87 CCS Inc 29 87 Technology Inc C2 NetBurner 88 SMTH Circuits 93 Conitec 89 IMAGEcraft 67 Nurve Networks LLC 91 Solarbotics 65 CWAV 86 Intec Automation Inc 88 OKW Electronics Inc 93 TAL Technologies 1 Cypress MicroSystems 31 Integrated Knowledge Systems 92 Ontrak Control Systems C3 Tech Tools 90 DataRescue 91 Intrepid Control Systems 74 PCB123 56 57 Technologic Systems 85 Decade Engineering 92 Intronics Inc 74 87 Technological Arts 11 Digilent Inc 81 Jameco 89 PCB Fab Express 90 Tern Inc 85 DLP Design 64 86 JK microsystems Inc 4 11 Parallax Inc 86 Trace Systems Inc 8 Dynon Inst 67 JR Kerr Automation amp Engineering 9 Philips 86 Triangle Research Int l Inc 31 Earth Computer Technologies 16 Keil Software 85 Phytec America LLC 37 Trilogy Design 95 Echelon Corporation 67 LabJack Corp 87 Phyton Inc 90 VNISource Design 90 Tools Electronic Engineering Tools 86 Lakeview Research 93 Picofab Inc 93 Weeder T
27. P89C51RD2 s hardware resources are occupied in motor control circuit You re left with only an RS 232 serial port and a few I O port lines We wanted to be able to control the motors remotely using an RS 232 or RS 485 serial interface so we implemented a complete command set for PC configuration and control Listing 1 page 76 shows the rudimen tary code we used for driving each step per motor by toggling the motor s corre sponding clock signal You may use this code to test the driver You can also test the half full step operation by setting the corresponding pin to 0 or 1 You can change the motor s speed by adjusting the delay between adjacent clock pulses If the motor is driving a linear transition al stage you can detect the limiting posi tion by monitoring two switches often installed at the endpoints You might be unwilling to devote a PC for the alignment job So we decid ed to use the free I O lines to interface CIRCUIT CELLAR a tiny 20 pin AT89C2051 slave micro controller that acts as a 4 x 20 LCD and keypad controller interface To simplify the system we assigned three keys move up move down and go home in a column to each motor You can invoke the system configuration menu and adjust the various motor parameters using the plus and minus keys Figure 3 page 76 is a schematic of the keyboard and display interface The LCD has a 4 to 8 bit data bus and three control lines The keyboard is arr
28. The debug peripheral windows in the Keil debugger were use ful when was experimenting with the ADC and GPIO port bits They enabled me to scan the ADC for the analog temperature value prior to connecting up the GUI and to alter the state of the GPIO bits at will This eliminated the need for writing special test code COM port drivers with its development board for Windows MAC and Linux The interesting thing about the drivers is that existing PC applications like ter minal emulators will work with them You can have a terminal session over USB or use existing applications that use COM ports to talk over USB The Visual Basic PC application does this DAQ GUI The user interface is the final piece of the USB ARM DAQ system It s the fin ishing touch that gives the system a pro fessional looking way to view the tem perature data The serial data feeding the GUI comes from the USB port and origi nates from the CP2101 bridge board The PC application thinks the data is coming over a standard COM port In reality however it gets data from the USB port via the Silicon Labs virtual COM port driver This gives you the benefit of using the USB port for communication without all the complexity because it looks like just another serial COM port The GUI was developed in Visual Basic If you re familiar with BASIC programming languages like Obasic you ll probably find the migration to Visual Basic to be fairly straightforward Wri
29. enclosure is more difficult to create than the circuitry it envelopes Making mistakes especially when it comes to the enclosure during the design and prototype process will cost you both time and money It s always a good idea to know how your final product will be used But it isn t always possible I ve designed stuff for a particular purpose at least it was in my mind that my customers found handy for a different applica tion For example suppose your embedded design must be able to be networked with similar devices or with devices capable of speaking your design s network language To add a little insult to injury what if your design needs to speak multiple proto cols and you don t know which one you ll encounter in the field What do you design in What do you leave out Oh yeah cost is a significant factor too What do you do A number of reputable manufactur ers offer numerous types of microcon trollers You also can procure modu larized microcontroller platforms that house some of the common off the shelf microcontrollers from third party companies The Atmel ATmega64 is the microcontroller of choice this 52 Issue 177 April 2005 month I won t be telling you anything you don t know when I say that the AVR is an extremely popular micro controller But have you had the chance to sit down and read through an AVR datasheet lately Depending on the microcontroller there are lots of knobs to twis
30. serial servo controller that s well suit ed for these applications Unlike all the other commercial offerings this design uses true dedicated parallel hardware resources for PWM pulse train generation at 16 bit accuracy and 12 bit resolution with all 32 channels fully synchronized SERVO BASICS Photo 1 shows a typical RC servo Different horn attachments for the 44 Issue 177 April 2005 servo shaft allow it to generate rotary and push pull motions Whereas a DC motor rotates continuously with the application of a voltage an RC servo uses an internal electronic angular position control loop which moves the servo to a commanded position and holds it in that position until the power is removed or the command changes RC servos also contain internal gearing which can provide large out put torques Different servo sizes and shapes are available as well as plastic and metal gearing options Three wires are used to interface to an RC servo The first two are the servo power and the ground wires The third is the angular position control signal input Powering RC servos is often done with rechargeable battery packs Servos can usually accept an input voltage between 4 8 and 6 VDC Depending on the mechanical load applied to the output shaft and the size of the servo its current draw can climb into the 1 A range The no load operating current for a standard servo Photo 1 A typical RC hobby servo has removable horn att
31. troller boards on the market now mimic this protocol nevertheless oth ers use their own proprietary versions Current board vendors include Pontech New Micros Pololu Lynxmotion Picobytes and Parallax It seems as though a new one appears every month On the software side a few vendors have developed generic servo control software that supports the Mini SSC II protocol as well as others These include Brookshire Software with its Visual Servo Automation Reynolds Electronics s Robo Ware Mister Computer s Mini SSC Panel and Roscoe Robotics with various offerings PRODUCT LIMITATIONS With few notable exceptions most of the current low cost RC servo controller boards on the market exhibit some type of functional trade off or limitation Of course depending on the end application these trade offs may or may not result in appreciable performance differences Serial RC servo controllers have sev eral desirable properties like a low jitter PWM waveform gener ated preferably in hard ware and greater than 10 bit resolution for the new high accuracy digital servos They also have a large number of parallel channels to Byte 1 CIRCUIT CELLAR OxFF Sync value accommodate demanding applications The con trollers have fully syn chronized servo channels to ensure accurate servo trajectory tracking and they include independent programmable soft limits to limit the range of trav el of servos The speed c
32. 177 April 2005 ROBOTICS View Your Robot s Environment 5495 U S NetBurner Mod 2270 Do the Math Networking in 1 day PSoC Mixed Signal Array It ll change the way you think about embedded design Now with instrumentation quality programmable analog Powerful new programmable analog and digital blocks with memory and MCU for less than 2 Winner of the EDN Innovation of the Year award our PSoC Programmable System on Chip device is changing the face of embedded design Reploce 1 0005 of tixed function devices with a couple of keystrokes Dynamically reconfigure a PSoC device changing functionality on the fly in any application Select from hundreds of predefined i blocks in our mixed signal library T R IL o FP MIPS 7 Already designed into 1000s of applications check out our online app note library E mes pilus 9 Audio Ps Reduce board size and BOM up to 80 CYPRESS ENHANCED ANALOG Front End with Adjustable Goin Difference Amp Insinomeniohon Amo writ Deroen Shasta Inairumeniation Amp 2 One of 1 0005 of examples of programmable analog blocks 256 25 lew as 1 99 low as 99 low as 49 ou Toning ur 4 Hour Ippll oOrTIOns SU i n i anime ons support ress com ad psoc ceal Logic Analyzers 40 to 160 channels 24 Channel L
33. 38 Issue 177 April 2005 Other vendors that provide cryptographic devices include Hifn www hifn com and SafeNet www safenet inc com THINK LIKE THE ENEMY It has been said that the only way to stop an attacker is to think like one Stay aware of the latest attack methodologies and trends which will enable you to choose the proper means of protection for your particular product and help you keep tabs on what attack ers might attempt against your product Try to break the security of your product Fix it and try to break it again Allow time for this iterative process during the design cycle Don t release a version of your product and plan to implement security into a later revision Properly retrofitting security mechanisms into an existing product is extremely difficult and political and financial pressures usually prevent it from actually happening Although I ve only scratched the surface of the topic of embedded secu rity you can use this series of articles as an embedded security cookbook You have a lot of security options to choose from for your particular design Hopefully I ve left you with the confidence and a twinge of fear to design secure products Good luck with your future projects amp Joe Grand is the president of Grand Idea Studio a product development and intellectual property licensing firm He specializes in embedded system design computer security research and inventing new concept
34. 419 00 AD 1 E Beli Vor B Chanel 225 00 ADLITDU 3 16 ISOLATED Anaka inpubs PGA a digital li 858232 and Rel Cipuk 8799 00 ONTRAK CONTROL SYSTEMS INC 705 671 2652 Fax 705 671 6127 Development Tools for PIC Microcontrollers LABX Espen Boards Pre Assembled Board J Available for B 14 18 28 HN and 40 pnin PIC MCLs 2 line 20 char LCD Module 8 nin Port Sample Programs Full Schematic Diagramm Pricing from 69 95 to 349 95 j Double Sided with Piate Tiwu Holes Circuitry for Power Supply and Clock Large Profofype Ares Boards Avallab e for most PIC MCLs 8 Documentation Schematic Pricing from 8 95 to 19 95 CIRCUIT CELLAR SPECIAL OFFER 10 PCS 3days 1 or 2 layers 5249 10 PCS Sdays 4 layers 695 in Jeg ie includes tooling LFI mask amp legend 33 0012 The Pocket ProgrammerS1 49 95 The portable programmer 1 that uses the printer port instead of a Internal card he Pocket gnaw to use software that programs E E prom Flash amp Dallas Ham 22728 amp 29 senes from 16K to B Megabit Adapters available for 74 B75X MCU s Pic Serial Eprom s 40 Pin X 16 Proms and Mora Same Mame Address amp Phone for 19 Years Isn t it Amazing Intronics Inc Box 13723 612 Newton St Edwardsville 66113 A43 57 00 COD Tel 913 422 2094 Add 6 00 Shipping WWW IN K
35. 8 pin 2 To DE 8 pin 3 To DE 8 pin 4 To DE 8 pin 5 To DE 8 pin 2 To DE 8 pin 3 To 9 pin 4 To 9 pin 5 VCC GND 2 DATA IN TX 99 To DE 9 pin 2 To DE 9 pin 3 To DE 9 pin 4 To DE 9 pin 5 1 2 3 4 SLATE possc TI Stepper motor U4 1 ANT VCC 10k GNDI S DATA IN L enp VU 45V 3 ANT DATA QUT RE 99 5V U 2 Sensor 1 Sensor 2 Nu 5V ANT VCG enp DATA OUT RE 99 17 R1 TX 99 Sensor 3 Sensor 4 Figure 3 the modules have RS 232C connections to a PC for programming The truck controller uses a power MOSFET to control a small motor a The command center interfaces to two reflective optical sensors b The gate controller uses a stepper motor IC to simplify the process of driving the motor c the small siren circuit that comes with the truck The virtues of the BASIC Stamp 2 are well known The stepper motor operating the gate as well as the optical sensors for position direction is from an old floppy drive Although an SAA1027 stepper motor driver IC generates the control pulses to operate the motor you can experiment with other methods The SAA1027 requires 3 bits to operate its functions step direction and reset Photo 1 shows the layout and main components CIRCUIT CELLAR CIRCUITRY The setup is mounted on a 6 x 1 5 x 0 75 sheet of wood The circuit boards are screwed into the base with
36. 831 4242 Think those days are gone Well they re not You just need Call for a FREE 256 page catalog today We have the electronic components and knowledgeable Technical Support people who can help bring back the fun in your electronics hobbies inventions and DIY projects Be sure to visit our new website at Jameco E lectronics www Jameco com ccj where electronics is still fun Embedded Wireless Solutions For Control and Communications Wi Fi supports data transmission rates ranging from 11 Mbps to 1 Mbps and is ideal for networking and web enabling your embedded applications E Wi Fi Add On Kit Wi Fi Add On Kits uu 7 99 To add flexibility to Rabbit based networks Rabbit Semiconductor offers Wi Fi Add On Kits for use with many RabbitCores These kits contain the tools needed including a LinkSys Wi Fi card to add Wi Fi communications to existing embedded systems Connection to existing applications is via interposer boards Wi Fi Application Kit This kit provides all af the tools needed to create a Wi Fi enabled embedded application including a RabbitCore Module prototyping WIFi Application Kit board LinkSys Wi Fi card Integrated Development Environment MT and royalty free TCP IP stack with sample programs and libraries ta simplify Wi Fi development GPRS is a standard that allows data to be sent and received across the GSM mobile telephone network GP
37. AVR MCS Electronics www mcselec com Micro64 128 Embedded controllers module Micromint www micromint com Issue 177 April 2005 59 FEATURE ARTICLE by Mike Smith et al Practical Application for TDD Part 2 Automated Test Driven Environment Last month you learned about the numerous advantages to test driven develooment TDD which is a primary component of an agile development technique Now you ll find out how to build a prototyoe TDD environment for an embedded system the first part of this series we intro duced you to the idea of test driven development TDD Briefly described TDD involves replacing volumes of documents for customer requirements and developer ideas with a series of spec ified and agreed upon tests before coding starts The TDD environment offers advantages to those of you who want to fully embrace the TDD concepts It s also advantageous to those of you who real ize that an automated test environment quickens the familiar test last approach Last month we also showed you a simple high school recruitment proj ect that featured the Analog Devices ADSP BF533 Blackfin microcontroller see Photo 1 We explained that devel oping up front customer tests is a new hard to acquire skill However using TDD for developer tests involves a change in point of view rather than a total change of mind set Lastly we showed you how to develop tests for the software to cal culate the temperatu
38. CELLAR KIT PRICE Software support for up to 6 serial ports Serial to Ethernet conversion Ethemet to serlal conversion Royalty free TCP IP stack RCM3700 RabbitCore Full prototyping board Temperature sensor demo board Dynamic C development environment 2932 Spafford Street Davis CA 95616 Tel 830 757 8400 Issue 177 April 2005 19 FEATURE ARTICLE by Bruce M Pride Simple USB Data Acquisition Simple data acquisition is only a project away Bruce shows you how to build a simple data acquisition device around an LPC2138 The system features a simple GUI that allows you to view graphed data instead of the streaming serial data in a terminal emulator session ust ask any of my friends and they ll tell you I m definitely an embedded system nut I love trying out the latest microcontrollers and chips that can breathe new life into my designs A couple of my current favorites are Philips ARM based microcontrollers and USB to UART bridges I incorpo rated both of these types of devices into my last few designs and I ve been extremely impressed with the results Another recent addition to my bag of tricks has been on the front end of my designs Adding simple PC graphi cal user interfaces GUI that can com municate with my embedded designs has put the finishing touches on them By adding a nice PC GUI that can communicate with the embedded sys tem over a serial port you can per for
39. Contratles Com 1 fw microm Status Idle BootLoader Version 1 31 Application Code PROJECTS _AVR codevision_projects microb4 micra Browse EEPROM Code Browse Download Info Exit Photo 5 t doesn t get much easier than this Just compile your code into a hex file point to it click the Download button and reset the Micro64 CIRCUIT CELLAR I ve heard that making and transporting the mortar is the hardest work associated with bricklaying If I were to equate programming the Micro64 with laying bricks I would say that the mortar CodeVisionAVR and BAS COM AVR has been perfectly pre mixed and the bricks Micro64 and Microl128 are the highest quality The Micro64 is perfectly suited for net worked industrial control and data logging applications Embedding a Micro64 in your next project won t be complicated al Fred Eady has more than 20 years of experience as a systems engineer He has worked with computers and com munication systems large and small simple and complex His forte is embedded systems design and com munications Fred may be reached at fred edtp com RESOURCE Micromint Micro64 Microcomputer Controller Featuring the ATmega64 or the ATmegal28 rev 1 1 2005 www micromint com datasheets Micro64 pdf SOURCES ATmega64 128 Microcontrollers Atmel www atmel com CodeVisionAVR HP InfoTech www hpinfotech com BASCOM
40. Dur er Lal hemma Power Eupoly ani Sala Cable een 1 amp KTEND Sxx 33 or 8240 80 EHD C3 TEHO H x 234 08 FDI www enm VISA MCI Amex Future Designs Inc 2702 Triana Bivd Huntsville AL 35805 255 H83 174D Fax 256 883 1241 comete obal kits starting under 200 www garage technologies com www circuitcellar com Turn serial data into video text BOB 3 XBOB COG 4 ww w decadenet com Lel DeEcADE ENGINEERING J 609 743 3194 Tumer OR USA Everything you need C to build your owm ans SONAR UNITS VISION SYSTEMS gt MOTOR DRIVERS OPTICS gt MICROPROCESSORS gt ARITIFICIAL INTELLIGENCE gt WEB CONTROLS Zagros Robotics PO 460342 St Louis 63146 344 768 1328 infofizagrosrobotics com www zagrosrobotics com CIRCUIT CELLAR PAVEL phyCORE nir Sengir Boer Erpur SSS SSS B murium peers 45 ag 47a35 mr Bi es H rradii Ipar dazipnziusg lie ig chip icine qi B 12k tz FEL eee SEXE arii Flach c msc B CAN Fecerat 25 200 405 roe ADAC DAL ererirEBIH dep r j Aree CI LI B avadabia in a daren and cor ee E imr COT see acrea yee Fro mum hrou eq Lii ini peur ey ed 00 ee eet meris ee Re FTE es Add USB your nex
41. Guaran eed Alan Lown Freasdant CE EL LISB 1 Standalore USB temperature Gata logger 25 i 8090 Stores 16K Li backed readings Log data for 1 year EL USB 1 Iram 101 48 Micro Controller Mini Web Server vi ba PicoSarwTM Miniatura Vint Sarvar allows remote HO and aervicsng Collect analog digital dal over weh connection Remo sens ing rantral SCADA building control ate from 5189 ADC 212 00 jure your FC int greal high speed sopa Samoling to 100MS s at 12 0 msn FREE siw tums PE inb powerful z ch scopo specum analyzer 595 911 Maijchbos suzed 58 powered analyzer Sample E channels at up to 500 milin samgpyes persec View Traces pn PC Print gawo for later review 15 ch ver bool 2221 1 5 to 30V d c outpul ta eulpul current 100 to 240 V a c input Over vollicurrant amp shor circuit prodecten PSU 130 73 05 LIGB ncwerec radio iransceivnr boards add wireless 0 your device Get rpmole control for your prad uct from PE USA port only 128 Saelig p 585 385 1750 WMD Wireless Micro Board uses fastast Atmel Mega IEMEFS for wurghess conirollers Great for mobile robots and data lagging aaplicabans fram 235 easyRADIOTM ERRIOTRS Madulas wireless data transmission simple for USA and Europe Add wireless capability to your project today from 45 100pr BASIC madules Transeelver make Tigers tiny mul
42. Open the serial port Open coml For Random As 1 Dim Sram data As Xram Byte At Dim Sram pointer As Xram Byte At Sram pointer amp H00 Print 1 Sram pointer Print 1 Close 1 End amp HAA it to pass data between the Micro64 and the respective IDE terminal emu lators in both compiler environments Programming the Micro64 with the bootloader arrangement was fast and easy After the C or BASIC code was compiled into a hex file I simply selected the resultant hex file in the Application Code window and clicked the Download button I then pressed the Micro64 Reset button and the bootloader components on the PC and within the Micro64 communicated and performed the download program operation If I had any EEPROM data to load into the Micro64 the pro gram download operation was identical to the application data download pro gram sequence see Photo 5 Micro64 UTILITIES The Micro64 s utilities which are a group of functions preloaded with the bootloader into the upper 4 KB of pro gram space are one of the neatest things about it Data relating to the functions is passed via a block of Compiler Communication Environment Simulator Programme Monitor Printer Chip Output Communication 12c SPI 1WIRE LcD Baudrate 0 9600 Frequency 11059200 He Error 0 00 Default X Cancel amp H0100 amp H0100 SRAM LOCATI ON 0x0100 BEFORE Ox SRAM LOCATION 0
43. PIC SERVO SC Single Chip Servo Controller Controller Chips Controller Boards Integrated Amplifiers Visit our web site for a complete selection of controllers and accessories www jrkerr cor JEFFREY KERR LLC LabJack U12 amp Available mow for only 1 19 qty 1 b 599 qty 10 USB Data Acquisition amp Contral 2 Eul anal 2c ii Bd eulpuls 20 digital Made in Colorado USA by LabJack Corp infodilabjack com 303 842 0228 www labjack com AMOR S XGAMESTATION Do it yYoOuRSELF Vioro Gair Sweaters mied tw the Bai 26D Apps Comedor 55 LI Ansem X655 biian Lini Complete Deyricpmeri Kit Took Demos A bes eBogok on Designing the X35 Corann Cables ant Fower Suppe incited jm gt WWW lt GAMESTATION COM 925 736 2098 ELIPPDRTIEUNLIEVE NET Issue 177 April 2005 67 FEATURE ARTICLE by Viraj Bhanage Prajakta Deshpande amp Praveen Deshpande Three Axis Stepper Motor Driver Part 1 Design Basics Technicians in high tech laser laboratories use optical components such as lenses mirrors and filters to direct laser output A multiple axis stepper motor controller gives technicians greater control over the components Special firmware enables remote control from a PC W recently visited a high power laser laboratory We learned that laser output is generated through a sequential chain of
44. Set CoreTi mer test Listing 2 page 62 shows the Blackfin assembly code required to satisfy the test During the test a Wat chDat a class object called cor et i mer eg is established to watch the action occurring among the four memory mapped core timer registers The expected register values after the Issue 177 April 2005 61 Set CoreTi mer ASM function are set up and used for validation The WATCH MEMORY RANGE macro is called to use hardware breakpoints to record the internal events when activating the Set CoreTi mer ASM function Finally two checks are made Using the get ReadsWrites method of the Wat chData class the first determines whether the expected number of writes occurs to four core timer registers The second using the getFinal Val ue method compares the actual final and expected values of the core timer registers The Blackfin assembly code in Listing 2 is easy to follow because of the processor s C language like assem bly code syntax in the processor First a pointer register is initialized with the address of the required memory mapped core timer register Following this the function s incoming parame ters COUNT in RO PERI OD in and SCALE in R2 are stored in the timer registers The old timer control value is stored and then returned when the function exits in RO before the timer is enabled in the required mode As it turns out this code sequence as written requir
45. WDT 16 88 respond to this ad For more information visit I www micromint com promo or call 800 635 3355 J ATM EL AVR M Optional 2 channel 12 bit ADC Two 8 bit Timer Counters with Separate 8 10 bit ADC Prescalers and Compare Modes tr m 8 Single ended Channels Two Expanded 16 bit Timer Counter Based Controller W 7 Differential Channels with Separate Prescaler Compare Mode m u 2 Differential Channels with and Capture Mode EF Programmable Gain 1x 10x 200x E Two PWM Channels M cr 64 W Byte oriented Two wire Serial Interface 6 PWM Channels with Programmable WR Based Controll Resolution from 1 to 16 Bits Dual Programmable Serial USARTs Programmable Watchdog Timer with B On chip Oscillator 1 5 232 R5 422 or R5485 29 Digital O that can sink or source 20 Coe Master Slave SPI Serial Interface Smallsize 1 5 x 2 1 x 0 52 EEEE Serial 0 Dual powered operates on 5V or hannels for Software Security 6 5 20V at 55 typical Program and Data Memories 64k of 128k Bytes of In System Reprogrammable Flash with 10 000 dk Bytes _ m ee Write Erase Cycles SRAM Pee B 2or4KBytes EEPROM with 100 000 B 36K Bytes SRAM i Programming lock for Software Security Peripheral Features Starting at 119 R35 2324 5422 R5485 Digital 1 0 T2 Bit ADC
46. a set of factory loaded flash memory resident utilities that provide you easy access to the Micro64 s unique hardware features The Micro64A incorporates an optional two channel 12 bit A D con verter Both the Micro64A and stan dard Micro64 include the AVR stan dard on chip eight channel 10 bit A D converter The ante is upped on the communications side because both models sport upgraded multi functional USART subsystems A Micromint C library module provides code to enable both USARTO and USARTI in TTL RS 232C RS 485 or RS 422 modes Forget about selecting and populat ing a clock source and building up a regulated power supply The Micro64 internalizes both functions You can run the Micro64 with a 12 V wall wart The 11 0592 MHz clock circuit is shall I say potted in If you choose the Micro64 or the Micro64A you ll be able to use the bootloader utilities to exercise the Micro64 s real time clock calendar And yes there s a bat tery input pin VBAT to keep the time real while the other Micro64 subsys tems are snoozing Phil did a great job with the Micro64 s enhancements He also managed to squeeze in and reserve 29 general purpose I O lines four timer counters www circuitcellar com with Compare and PWM modes a two wire PC interface and an SPI port The AVR s standard power man agement modes and watchdog timer are also available The Micro64 com munications subsystem makes it easy to netw
47. able data reception The transceivers are extremely inexpensive When you apply power the transmitter section will transmit the carrier You ll now have three transmitters of identical frequency flooding the airwaves and ARMIS 2 Combining lheiv Ivery best of low Power Comprehensive range of a industrial PC 104 and EBX format embedded x86 and single computer products Design amp Build kd EF Industrial Networki 32 Issue 177 April 2005 CIRCUIT CELLAR www circuitcellar com without T R switches The receivers will get blasted close up but the basic system will work to a certain degree You could use a few of the micro controller port bits in each module to control the power to the transmitter and receiver For instance when the command center is transmitting its receiver section is powered down as are the transmitter sections of the truck and gate These modifications will imme diately improve data communication Using an MCU with interrupt capabili ties will eliminate wasteful software polling loops Improving the communica tions protocol and adding error correcting techniques and checksums will create a more reliable system Replacing optical detection with ultrasonic sensors will eliminate the process of planting sensors in the truck s path Using FM trans ceivers rather than AM ones will surely improve reliability And the list goes on I ve asked my students to
48. amplifiers Numerous optical components e g lenses filters and mir rors are placed in the laser s path The critical components that require fre quent adjustment are mounted on a motorized precision x y platform Our assignment was to find a new way to control the 2 D position of the optical components typical resolution is 10 um In a few cases however a third motor z axis was also used to control the height and angle of rota tion of optics and targets Because there were so many optical compo nents to manage we wanted to create a remote control industrial workstation in the facility s laser control room In addition we wanted the lab technicians to be able to store each component s x y z absolute position in a database After studying all of the lab s needs we developed a general purpose three axis stepper motor driver see Photo 1 We also wrote firmware that allows you to configure and remotely control one or more drives from a PC The firmware gained in power as the drive was used for more applications In the first part of this series we ll focus on the hardware MOTOR DRIVING Stepper motors are widely used as dig ital actuators for position control appli cations Their shafts rotate in an angular fashion whenever a current pulse is sequentially applied to their windings Available in a variety of shapes and 68 Issue 177 April 2005 sizes they re classified according to their number of
49. amps Work it out Although the simple formula obvi ously doesn t reflect reality it s true that small changes in the voltage applied to a diode cause huge changes in its current Let s take a detailed look at some LEDs shed some light on the innards of that flashlight and see how to drive LEDs correctly CURRENT DRIVE Diodes must be driven from a current 40 Issue 177 April 2005 source not a voltage source to maintain control over their current You ve certain ly used a simple series resistor to limit the current available from a voltage source which although it isn t a great current source is often good enough for LEDs When you re characterizing diodes though you need a current source that permits simple stable adjustments while preventing overcurrent accidents a k a releasing the magic smoke Figure 1 shows a quick and easy adjustable current source The op amp regulates the transistor s base current so the voltage across R1 equals the voltage set by the trimpot With R1 10 W the voltage across it is numerically equal to 10 times its current 100 mV for 10 mA The 39 kQ resistor in series with the 1 kQ trimpot limits the maximum set point to 300 mV and the maximum current to 30 mA 50 over the usual 20 mA oper ating current for small LEDs Because you ll directly measure the current while adjusting the trimpot there s no need for A few volts more than total LED forward drop As many LEDs as
50. companies EAGLE ie being used in many of the top companies The crucial reason for selechng EAGLE is not usually the very favorable price but rather the ease of use On top of that comes the outstanding level of support which at CadSoft is always free of charge and is available without restriction to every customer These are the real cost killers Version 4 1 Highlights gt Powerful library management move devices between libraries base hbrary for packages generate package variants from other libraries ae 2 gt Dynamic ratsmest during routing E TEs rou process IE gt Copy function in schematic p 5 gt Roiate components in 0 1 degree steps Blind amp buried vies and pads with alf center drill User defined background color Miter Funclson for rounded tracks gt Smash for groups Measure dislances arbitrary paints Choose allernaltive raster an the fly with Aft key Tou usa EAGLE Light for estiti and how DO CDITETRPTTE is m amp m iod boards up io halt Eurocard format An iini Of tD SIGMA Ande ane Si ahenst All other features correspond to those of ihe from aur Intarnot Sits al applications charge The Freeware Prainzs i torsion Doewninarn ii ar order our Ire CD i yu decide in favor of the alzo The Comrnercial Light Version you y license for commercial Ayers max FO mo such
51. easy LCDs pain in the neck to interface Their have a well deserved reputation for being a non standard parallel busses and weird BPI 216N 2x16 serial LCD timing are enough to turn your hair serial LCD EEE E aaa gray if you don t pull it out first Our LCDs have an easy to program serial interface up to 9600 bps that makes them a snap to use particularly with friendly micros like BASIC Stamps 2x16 serial LCD wi switch inputs Easy hookup and mounting We don t iud a stop at simplifying display interfacing and programming For easy quick connections we offer a variety of ready made wiring harnesses Need mounting hardware We ve got that too SGX 120L n stock right now Hate to wait Our Si epi ina products are in stock and ready to ship 99 00 the day you place your order Online satisfaction Our customers love our web site it s fast uncluttered and jammed with tech data on our TRM 425L products The online store runs weekly SUE sales with savings up to 4096 Checkout is a breeze with a simple one page form www seetron com Many more models available at seetron com Scott Edwards Electronics Inc 1838 5 Frontage Ad F Sierra Vista AZ 85635 phone 520 459 4802 fax 520 459 0623 web www seetron com email sales amp seetron com TASK MANAGER CIRCUIT CELLAR My Favorite Subject have to say Robotics is my favorite issue theme We get to feature
52. ensure that all conditions are covered and there are defaults in place for unused conditions Otherwise an attacker may be able to put the FPGA into an indeterminate state through fault generation attacks Also consider adding digital water marks to your design in the form of unique features or attributes that can be used later if necessary to prove that a design claimed to be original by a competitor is actually a copy Legal means are usually the last resort when protecting your intellectual property but having some hidden identifier might make your case much stronger POWER SUPPLY Precautions should be taken to pre vent the intentional variation of the power and clock Minimum and maxi mum operating limits should be defined and protected using comparators or supervisory circuitry available from manufacturers like Maxim and Linear Technology Don t rely on the end user to supply a voltage within the recom mended operating conditions Using a low dropout linear regulator or DC DC converter instead of a direct volt age input into your system will help ensure that your circuit receives power within its expected range regardless of an improper voltage supplied at the input Such circuitry can be bypassed if the attacker has access to the board An attacker can use power supply variation to gain access to your sys tem For instance he can clear the security bit in a PICI6C84 microcon troller without erasing t
53. for the two parts is similar at about 5 in low quantity dropping to 2 50 in high volume Obviously given its inte grated clock and EEPROM this gives a system cost advantage to the CP2102 GETTING VIRTUAL I decided to give the CP2102 evalua tion board a look see The 49 board implements the usual USB to RS 232 adapter function in two chips the CP2 102 and a Sipex RS 232 transceiver the requisite connectors and little else see Photo 1 The CD that comes with the kit includes Virtual COM port drivers for Windows 98 through XP Mac OS 9 and OS X and Linux 2 40 The driver installation seemed a bit quirky After plugging in the board to the PC USB port I went through two sessions with the Windows New Hardware Wizard First it installed the CP210X USB com posite device and then the CP210x USB to UART bridge controller All went well and I used the Windows device manager to verify that the CP2102 board was assigned to an open COM port slot Thanks to the COM port imperson ation initial checkout is easy using a simple terminal emulator such as HyperTerminal which comes with Windows However I ve always found that program admittedly designed with www circuitcellar com Remember when electronics stores were stocked to the rafters with every component imaginable and there was ALWAYS a knowledgeable person there to help you aL Seen Bi ee a el ELECTRONICS Great Products Awesome Prices 1 800
54. function is called as the first line of a mai n function run on a powered board It automatically saves the C initial www circuitcellar com environmental setup to a file We wrote this function to be easily upgradeable when new features of the embedded system are added i e when new peripherals are developed SaveUserRegAndReset and RecoverUserReg area pair of functions used at the start and end of a test The former saves the current user processor state and resets the sys tem to a known state The latter restores the initial user processor state The jury is out regarding the utility of the functions Having the system in a known state before testing prevents many errors however we found that testing with a system that s uninten tionally in an unknown state also uncovers unexpected system configu ration issues A second useful hardware test group the Wat chData class and WATCH MEMORY RANGE macro pro vides the ability to watch planned or unintentional action in a memory range on the processor These work through hardware breakpoints on a running system rather than via static profiling on an architectural simulator or statistical profiling snapping a quick look on a running system This test class was initially developed as an instructor test An instructor with close knowledge of the system archi tecture would write such a test to examine whether or not students learn ing about a proc
55. jdition a jae A E eli i 1 c d eg a i Turn your PC or NoteBook into a powerful Scope and Logic Analyzer AEN cese inside your circuit in the analog and digital domains at the same time to TH z Lei make tracking down thase elusive real time bugs much easier v Pocket Analyzer combines high speed sample synchronized storage scope and logic analyzer with a programmable waveform and logic pattern generator Also included is an integrated real time spectrum analyzer and powered Smart POD expansion interface so you ve got all bases covered About the same size and weight as a Pocket PC this USB powered BitScope needs no bulky accessories It s the perfect low cost qo anywhere test and debug solution Ll Pocket AMO LOIC standard 1M 20pF BNC Input BitScope Smart POD Connector BUS Powered USB 2 0 Device External Passthru Power Supply 200uV 20V deys with x10 prabe B legic echannetms 2 analog channels Single USB cable ta your PC Auto senses an external supply GA aeect AC DC coupling Dual channel capture from POD A B Compressed data transmission removes power load from USB SW select termination Async aerial VO far external contral Simple ASCH control protecal for use with unpowered hubs Arbitrary Wavetorm Generator Legic Pattern generator 32K 40M amp S s Scripting Language Supplies up ta 500m A via POD Bitscope and your PC provide an array of Virtual
56. material in mul tiple directions Peratech can adjust the behavior of QTC during the man ufacturing process by varying the composite mix and physical dimen sions It developed four basic parts that cover a wide number of uses QTC SWITCH SUBSTRATE For touch pads and keypads the QTC Switch Substrate is a thin application of QTC on the aluminum side of a poly ester sheet When placed over inter digit electrodes PCB traces the material provides a conductive path between digits when compressed on the traces The QTC Switch Substrate material comes in three sensitivities Unlike membrane switches an insulation spacer isn t necessary This simpli fies the manufacturing process You also have the benefit of each set of contacts becoming variable pressure sensitive inputs QTC PILL You can use the QTC Pill for low power applications that require the direct control of devices like motors or lights The QTC Pill is a 1 mm thick piece of QTC material 3 6 mm square It can be used as a switch across PCB traces like the Switch Substrate sheet or it can go right in series with any low power device thus replacing the power switch con tacts and adding a variable speed fea ture to the device For high powered devices the QTC Pill can operate as the gate control to the power circuitry QTC CABLE If your robotics project requires machinery safety guards bumper detection or impact counting the QTC Cable is the sol
57. on to the BASCOM AVR application via the word at SRAM location OxOFFE Again just like you did with CodeVisionAVR you must simply read the result loca tion that you defined using a word variable that s been defined and declared in the BASCOM AVR appli cation For instance if you declare Day Of Week as a word Di m Day Of Week As Word then getting the day of the week data would be as simple asDay Of Week Result If the day of the week isn t correct you must be able to correct it by writ ing to the RTC As far as calling the functions goes the song remains the same with the exception of stuffing the reserved SRAM location OxOFFD with the day of the week data and calling the write day of week function at Ox7D29 After you ve got the hang of making the calls stuff in your parameters and www circuitcellar com Ob4 si ap re nckuded Fies E T save ables FO m Other Fies CodeVisionAVR micro64_sram prj Terminal Edit Project Tools Settings Windows Help 81 1 dedi sain BI H 910 58 ame ences between the Micro64 and the Microl28 bricks are M Data at 0 1180 BEFORE 6x08 SRAM Data at 8x1180 AFTER BASCOM AYR Terminal emulator SRAM LOCATION 8x8188 BEFORE 6x80 ens LOCATION 8x8188 AFTER xAA COM2 9600 8N1 Nohandsh ASCII VT100 Echoon described in the Micro64 128 datasheet Whether you re an advanced microcontroller system designer or a w
58. shell To avoid the safety issues of coexisting with humans the robots of the future will need an extensive array of sensors www circuitcellar com could reach out it couldn t touch things because its gripper lacked feedback Peratech s PTC material can solve this problem and today s flexible circuitry is ideal for adding this type of sensor to the Hero s gripper I built a prototype sensor First I scouted out some flex circuitry I could hack There are some nice flex items used in disk drives I experimented with a short section of multi conductor 0 5 mm flex cable by plac ing a QTC Pill on the unin sulated contacts of one end I then measured the opposite end s contact with an ohmmeter This worked well because the QTC Pill bridged many contacts and added redundancy against trace failure It also comes with a means of terminating the con nections using a standard flex cable connector This proved the theory to be a sound one however it didn t fit the Hero s gripper in its stock state I quickly realized that this had to be a custom job My Hero s gripper has a cross sec tion similar to that shown in Figure 3 The inside of the gripper has a raised center section which is the first area to touch an object The sensor s design made use of this surface I picked up some thin sheet metal stock from a local hobby shop and cut a few 0 1 conductors I wrapped the inside of the gripper with two paral
59. single chip application without adding external memory devices other than the non volatile storage The microcontroller also has on chip boot ROM which enables you to download the firmware code via an RS 232 serial interface to the 64 KB flash memory This elimi nates the need for a resident monitor www circuitcellar com and it simplifies the overall develop ment process No extra debugging hardware The microcontroller has all the necessary blocks available for gener ating the clock and direction signals that can drive multiple stepper motors with out much CPU intervention This frees up the CPU to perform other functions such as data acquisition and control For driving the motors you need to consider two parameters motor speed and direction The former is proportional to the rate at which clock pulses are fed to the 1279 i e the frequency at which the square wave must be controlled to maintain a constant motor speed The motor speed is typically specified in terms of revolutions per minute RPM If you know the motor s steps per revolu tion specification you can compute the number of steps to fire per minute which in turn gives you the required pulse repetition rate or frequency You can generate a square wave by toggling a port line in the software But this requires the CPU s full atten tion The requirement of driving two or more motors simultaneously and independently com plicates the sit
60. stator phases Two phase motors are the most common although three and five phase motors provide higher stepping resolution In terms of drive electronics the number of electronic switches required to achieve motion may classi fy stepper motors You can have a unipolar drive requiring two switches per phase or a bipolar drive with four switches per phase The latter is more popular because it yields more torque than the unipolar scheme Most motors provide all the winding leads externally This gives you the flexibili ty to connect them in either a unipo lar or bipolar configuration A stepper motor s dynamics are con trolled by its time constant L R where L is the motor winding induc tance and R is the total resistance in the winding current path The step ping speed obtained is mainly gov Photo 1 Take a look at the driver in the 42T SU Euro case If the motors rotate continuously you must have proper venti lation to cool the L298N IC already mounted on the heatsink CIRCUIT CELLAR erned by the slew rate of the winding current in a stepper motor At lower step rates the current easily slews to the peak value Ip xrep before a direction change As motor speed increases the current won t reach the full value because the time between the current direction change is shorter Therefore to achieve the same torque at a higher speed you should increase the rate of rise of the winding current To do so incr
61. switch contacts should be positioned within the grasping effector OK so now your robot can grab a rock but what about an egg WITHSTANDING PRESSURE ICs come in either antistatic plastic tubes or black foam The latter con tains carbon particles in the foam This allows IC pins to be shorted together so a floating pin won t pick up a potentially damaging external charge This material can be used as pressure sensitive material because it has a measurable resistance Unfortunately there are some serious drawbacks to using this material It s a high resistance material that lowers its resistance with pressure Because it doesn t return to its original uncom CIRCUIT CELLAR Photo 2 The load cell uses strain gages usually in a full bridge format to measure the load applied directly to a point on the sensor pressed state after the compression is released it s difficult to get repeated accuracy Another problem is that the foam can crumble with use The idea of using some material to directly measure pressure is a useful one Popular solid state pressure sen sors can measure air and liquid pres sures see Photo 1 Load cells measure weight and force through tension and compression see Photo 2 Resistive ink force sensors come the closest to the use of the black conductive foam see Photo 3 One of the newest entries in this market is Peratech s QTC material which has the relaxed qualities of a
62. switch off with the compressed qualities of a conductive material see Photo 4 QTC MATERIAL QTC material is made from metal particles as opposed to carbon com bined with an elastomeric binder Unstressed the material looks like an Photo 4 QTC components from Peratech come in four basic styles Pills Switch Substrates and Cable and Force Sensors Pills can be added to current switch designs to change any push to make switch into a fully proportional voltage or current controller Switch sub strates can be incorporated into membrane or keypad switches to provide far greater reliability and optionally proportional control Cable can be used in machine pro tection or security applications or it can detect the presence or removal of loads Force sensors which offer considerably more range than standard force sensing resistors are much more resilient to handling and environmental factors Issue 177 April 2005 49 Composite material Unstressed used Fully stressed Change in force for a 10x Current change in resistance carrying capacity Carbon 1050 1020 Medium Low Metal 10 Q 10 Low High Table 1 Conductive foam has been manufactured using carbon for years now Peratech s metallic approach has significant benefits This chart shows the resistivity and current carrying differences between the two methods insulator Applying a mechanical deformation initiates conduction An a
63. the siren circuit board Bit 15 receives data from the RE 99 Bit 1 controls the siren Bit O controls the motor s speed via the Stamp s PWM command A 9 VDC PP9 battery powers the BASIC Stamp 2 The BS2 regulated 5 V output pin 21 powers the RE 99 The truck s motor and siren are powered by a 3 VDC battery system two type AA mounted under the truck see Figure 2 Photo 2 shows the truck s components SOFTWARE Three separate STAMP programs are required one for each of the three modules Try developing a minimal working system before adding advanced features Sample programs are posted on the Circuit Cellar ftp site ProgC ProgG and ProgT ProgC is the master program ProgG and Photo 2 The trucks siren speaker and motor are origi nal components The modules are new The 9 V battery is hidden under the BASIC Stamp 2 The 3 V motor battery system is in a small compartment under the speaker ProgT are slave programs Following power up and port initial ization all of the programs enter polling loops ProgG and ProgT wait for commands from ProgC which checks if the gate is closed and waits for the truck to approach The simula tion is now ready to begin The event initiates when the truck crosses optical sensor S1 This causes ProgC to fall out of its polling loop and immediate ly transmit a stop command to ProgT You should experiment at each J NayDrive Single Board Autonomou 2 Motor Cont
64. trace module Internal SRAM controller Internal flash memory controller 8 16 32 KB 32 64 512 KB SRAM flash memory AHB to VPB VPB Ns bridge Divider bii VPB VLS1 peripheral bus External 8 Capture compare Cc I C Serial lt gt interfaces 0 and 1 TimerO Timer1 ADO 7 0 SPI and SSP A D Converters AD1 7 00 DARET EINT3 0 8 x CAPO 8 x MAT 0 CTS10 0 DTR10 E Serial interfaces lt M UARTO UART1 AOUT D A Converter K gt P0 31 0 General NM P1 31 16 1 0 purpose PWMO lt gt 1 LPC2138 only 2 LPC2132 2138 only PWM6 1 Figure 2 A 32 bit ARM core lies at the heart of the LPC2138 Given the chip s high performance core and numer ous peripherals it can cover a vast number of applications linearly proportional to temperature 6 25 mV C and it has a DC offset of 424 mV to accommodate negative tem peratures This makes it a fairly easy sensor to deal with in software after it s read via the LPC2138 s ADC The PC contains the Visual Basic GUI It reads the raw temperature data sampled by the ADC over the vir tual USB COM port converts it to temperature and displays and charts the results over time The GUI puts the finishing touches on the design making it a more user friendly and professional looking system Imagine how much eas ier it will be to look at graphed data instead of the streaming serial data in a terminal emulator session LPC
65. work I m old fashioned like to beat the datasheet pages ragged When I m done run the Wizards to see if did things correctly www circuitcellar com CIRCUIT CELLAR Issue 177 April 2005 53 Listing 1 f you take the time to enter all your hardware information into the CodeWizardAVR tabs you ll end up with a skeleton source code page with all the peripheral initialization code in place It sure beats tracking down the bits in the datasheet include lt mega64 h gt Standard I O functions include lt stdio h gt Declare your global variables here void main void Declare your local variables here External SRAM page configuration 1100h 1FFFh 2000h 7FFFh L Lower page wait state s None Upper page wait state s None MCUCR 0x 80 XMCRA 0x10 USARTO initialization Communication parameters 8 Data 1 Stop No Parity USARTO Receiver Off USARTO Transmitter On USARTO Mode Asynchronous USARTO Baud rate 9600 UCSROA 0x00 UCSROB 0x08 UCSROC 0x06 UBRROH 0x00 UBRROL 0x47 while 1 Place your code here Listing 2 didn t have to tap too many keys to get this little code snippet compiled and running can envision all sorts of data structures in external SRAM that can be exploited with this simple pointer technique include lt mega64 h gt include MMRS485 h gt include lt stdio h gt Declare your global variables here int COM
66. you d like Figure 1 This simple current sink drives LEDs with a constant current The power supply must be a few volts higher than the total LED forward drop CIRCUIT CELLAR high precision resistors You can use any op amp and small NPN transistor Figure 2a shows the forward voltage across 10 supposedly identical white LEDs from my collection measured at currents ranging from 1 to 30 mA I drove all 10 LEDs in series from a 40 V power supply recorded the forward volt age across each LED and massaged the results in a spreadsheet You can down load the results along with measure ments and graphs for several more color ful LEDs from the Circuit Cellar ftp site The LEDs datasheet states that the forward voltage is typically 3 6 V and less than 4 V at the 20 mA maximum current The maximum DC current allowed is 30 mA although the peak current can be 100 mA for 10 ms at most with a 10 duty cycle The over all power dissipation must be less than 120 mW All of the LEDs in my sam ple lie well within their specifications Even over this limited range of cur rents you can easily see the exponential shape of the curves Figure 2b plots each diode s forward voltage against the log arithm of the current a task that for merly required semi log graph paper to show that all but one of the curves have the expected straight line shape LED D evidently has a problem because its forward voltage tops out around 3 65 V an
67. 1 9 The OV6620 CMOS color image sensor provides a digital stream of pixel data reference signal to indicate a new line is about to start HREF and a vertical sync signal to indicate a new frame is about to start VSYNC An Atmel ATmega8 microcontroller processes the OV6620 s stream of pix els It has a Harvard architecture and a RISC instruction set providing many single clock cycle instructions The ATmega8 also provides a rich set of on chip peripherals such as 8 and 16 bit timers external interrupts hard ware UART and plenty of general pur pose I O for sampling the data buses The AVRcam s user interface is pro vided through the on chip hardware UART which offers a simple way for external devices to communicate with the AVRcam A simple protocol allows you to command and control the system All post processed object tracking information is provided through this UART as well R7 5 RES voc L8 PB3 2 LZ SDA 11 PB4 ppiL S d SCL se GND PBo 2 ATtiny12L 4 CLKOUT ciKour SIMPLE HARDWARE The AVRcam hardware s sim plicity contributes to the sys tem s low cost and low power consumption see Figure 2 The upper nibble of each pixel data bus on the OV6620 is connected directly to the lower nibble of the ATmega8 s port B and port C which are both configured as inputs Note that the lower nibble of each pixel data bus isn t connected to the ATmeg
68. 11 COM 0 then use USARTO if it 1 and then use USARTI void main void Micromint s library for using both USARTs Declare your local variables here unsigned int sram poi nter unsigned char sram data XOCKOK KE KE RE E CK E CK GE CK OE CK E CK E CK GE CK E CK OE CK OE CE OE CK OE CE OE CK OE CK GE CK E CK GE CE E KE CK E EE E EE EE E EE E EEG EG KKK G IG x KKK External SRAM page configuration 1100h 1FFFh 2000h 7FFFh Lower page wait state s None Upper page wait state s None MCUCR 0x 80 XMCRA 0x10 KKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KK KX COM 0 USARTO initialization Communication parameters 8 Data 1 Stop No Parity USARTO Receiver Off 1 USARTO Transmitter On USARTO Mode Asynchronous USARTO Baud rate 9600 UCSROA 0x00 UCSROB 0x08 UCSROC 0x06 UBRROH 0x00 UBRROL 0x47 KKKKKKK KK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KX sram pointer 0x1100 Aim at SRAM location sram data sram pointer Read targeted SRAM location printf r nSRAM Data at Ox 04X BEFORE 0 02 poi nter sram data sram data 0 sram pointer sram data Write targeted SRAM location sram data sram pointer Read targeted SRAM location printf VrVnSRAM Data at Ox 04X AFTER 0 02 pointer sram data while 1 54 Issue 177 April 2005 CIRCUIT CELLAR an
69. 15 COSE gt EPROM Emuior Aap 44 pini St 35 HLC www vnisource com EE Toots In Tel 469 675 0267 E 3 p E iu Fax 469 675 0346 90 Issue177 April 2005 CIRCUIT CELLAR www circuitcellar com cireuircenar back issues are available as Ta Interface Keypads Switches or R 232 to your PC Keyboard Input searchable archives MODEL KE24 onmi ge Up to 12x 12 matrix Programmable AS 232 Port Macro Capability 2 The KE24 is the ultimate in flexibility Inputs or serial data can emulate any of the 101 keys from standard keyboard OLY 2144195 Get the Ones you missed 665 9 mairi 25 x 3 0 Siza PC Keyboard Port POAT AT Compatible CD ROM 9 2004 Issues 162 173 CD ROM 8 2003 Issues 150 161 The KE18 combines multitude of features with small size at an pice Custom units available CD ROM 7 2002 Issues 138 149 economical price Custom units avallab Order online Eu ECTRONIC Phone 607 533 4441 Fax 607 533 4443 CTHONICS www hagsiramelecironics com www circuitcellar com poles 11 Fiddlers Green Ru c or call 860 875 2199 Me Lansing NY 14882 Z HoNS1 upos 1 11 37 T A INTRO d e EE if you want to get started in rabotics bul dan Ed know where to begin i fen then this DYD is for you anl
70. 2 In digital signal processing Problem 4 What are the five built in and applications there is sometimes an effect 10 transient commands that come in a known as the Gibbs phenomenon which standard CP M 2 2 distribution What s is a characteristic ringing associated with the difference between the two categories sharp edges and transients Is this a func tion of sampling quantization or filtering in the system Or is it a combination of all three Is this a problem Contributed David Tweed The answers are posted at www circuitcellar com eq htm You may contact the quizmasters at eq circuitcellar com NEW Robotic Controller Board Introductory Price amp i5 AVR based robotic controller board featuring the ATmega64L Processor byte HAMI byte program flash 2k byte EEPHOM Small farm factor Flexible power supply routing Eme DOE ot R Directly drives up to B servo motors and 3 H bridge modules Ships with 1 63 mp power supply The Cerebot works with Digilent s new Of Kit line of amp pin peripheral modules Digilent peripheral modules include The most complete way to get started 2 channel 1M5a A D converter Boe Bot Robot Kit Serial 28132 199 00 4 channel 1MSa D A converter gees Boe Bot Robot Kit USB 28832 199 00 BUCO WIE a LER NO available for less than 7 8 ANG many more All design tools can be downloaded for free Fo
71. 2138 MCU The LPC2138 is one of Philips s newest ARM based microcontrollers Having previously designed with the WWw circuitcellar com DCD1 RIO RTXC1 RTXC2 Vaar o Real time clock NEN Watchdog timer System control LPC2106 the LPC2138 piqued my inter est given its vast assortment of added peripherals The addition of ADCs DACs converters an external memory controller and edge sensitive interrupts made it the perfect migration part for my LPC2106 designs see Figure 2 The small LPC2138 contains every thing but the kitchen sink In addition to a ton of peripherals and general pur pose I O it s loaded with 512 KB of flash memory 128 bits wide for high speed and 32 KB of RAM definitely not the typical memory sizes I m used to seeing in plain vanilla 8 bit microcontrollers Another remarkable feature is the chip s size The 64 pin QFP part measures in at 10 mm x 10 mm making it perfect for tightly spaced applications And then of course there s the one thing that makes this microcontroller shine an ARM 32 bit ARM7TDMI S core This 32 bit ARM core yields CIRCUIT CELLAR you re into embedded design there s no doubt that having ARM experi ence under your belt would be bene ficial to your career ARM is an inter esting and detailed topic in and of itself Refer to the Resources section of this article for more information I hope I ve piqued your interest in the LPC2138 Now let s e
72. 3 3 V the MAX1595EUA5O0 produces 5 V The circuit board layout includes space for which is the ballast resistor to convert that voltage source into an LED driver CONTACT RELEASE After all that effort I m pleased to report that the rebuilt LED flashlight works much better with a better beam and constant bright light If you re illumi nating a gizmo with white LEDs check CIRCUIT CELLAR out the latest generation of LED driver ICs the MAX1595 is just one example for better ways to get the job done There s no need to be foolish anymore I just got a surplus batch of four LED clusters intended for two cell flashlights As expected one has a dim LED and they all have poor construction That sup ports my theory that rejected LEDs wind up in cheap flashlights l Ed Nisley is an E E P E and author in Poughkeepsie N Y You may con tact him at ed nisley eee org Write Circuit Cellar in the subject line to Clear the spam filters PROJECT FILES To download the code and graphs go to ftp circuitcellar com pub Circuit Cellar 2005 177 RESOURCES Eagle CAD circuit design www cad softusa com Maxim Integrated Products MAX1595 Regulated 3 3V 5 0V Step Up Step Down Charge Pump 19 2107 rev 1 2002 www maxim ic com SOURCES LEDs All Electronics www allelectronics com Electronic Goldmine www goldmine elec com default htm LED Supply www ledsupply com Issue 177 April2005 43
73. 40 and 60 mA a visually indistinguishable difference ferent case that produces a 20 beam width I selected four LEDs that differed by only 4 mA at 3 250 V The complete data is in the spreadsheet posted on the Circuit Cellar ftp site Figure 4a shows their combined current as a function of voltage They draw almost exactly 80 mA an average of 20 mA each at 3 300 V which is a perfect match for the MAX1595 s nominal output Incidentally that tidy exponential curve is real data I m not making it up I measured the supply s input current and output voltage as a function of its input voltage to get an idea of how it would perform as the battery discharged Figure 4b shows that the output voltage remains between 3 25 and 3 20 V as the battery voltage drops from 3 2 to 1 9 V The output hits 3 V just before the MAX1595 automatically shuts down Comparing the output voltage to the LED characteristics you can see that the current varies between 60 and 40 mA dropping to 10 mA just before MAX1595 shuts off at 1 6 V The LEDs will run with reasonably consistent brightness decreas ing by a third over much of the battery s life That s fine because a single LED brightness bin covers a factor of two dif ference at the factory I don t know what causes the kink in the MAX1595 s output for input voltages near 2 9 V The current is fairly close to the chip s rating so the LEDs may pose a difficult load a low voltage drop in the regul
74. 5 stage with various methods to deter mine if a specific task command was successful Did the truck stop ProgC may assume the command was success ful To be sure repeat the command twice and wait 2 s An errant truck would have passed S1 by now Next check 51 If S1 detects a truck assume that the truck has stopped Otherwise assume it hasn t stopped Go to start modify and try again An errant truck will crash into the gate at this stage unless you call out the Marines Pick up the truck and check the system for errors Try another approach Assuming the truck stops ProgC delays and then transmits an open gate command to ProgG A check is per formed to determine if the command was successful Repeat the command twice and wait 1 s The gate should have moved up by now Next check S3 to determine if gate still closed If S3 detects an open gate assume the gate is open or else assume it didn t respond Go to start modify and try again Once again you must troubleshoot the system After the gate opens ProgC waits for ProgG to send a gate open confir mation After receiving the signal ProgC transmits a go command to ProgT for the truck to proceed into the compound Again the command repeats and then ProgC proceeds to poll optical sensor S2 This indicates that the truck has moved past the gate and is inside the compound After ProgC detects that the truck is inside a stop command to ProgT stops the tru
75. 62 522 6500 235 www ccanta com Fax 242 522 6504 NanoCore12 for best price amp performance 9512C microcontroller modules from 45 NanoCora12 Features on board RE232C irarfaca up t 23 MO lines with multi property pregrammahility a g direction pall upipuli deawn reduced drive invert polarity etc to B key waka up interrupt inputs with digatal filtering 2 7 SPI CAN B channal 10 bit ADCs multiple PNM channels amp channal timers supporting input put CoM ans avant counting gated time accumulation and simple PWM XZK enulti eechor 2 operates up to AAAH via PLL 23VorS V operation etvanced CISC architecture on chip Senal Monitor supports BOM debugging 1 877 963 8996 www technologicalarts com Toll free USA and Canada of Arts www circuitcellar com CIRCUIT CELLAR CO Samulatars Program MSP 430 0 senson m 718 259 3191 yton com IS com Usb Serial Port PIC Programmer Educational Electronke kit 34 95 Connect to computer via USB or Serial Port Free Software and Updates Windows S NEDIOO XP Compatible TCSP In Cireur Serial Programming Quality PCE and Silkscreen Sex complete details at www Electronick its com USB and USB Flash Pie Programmers Available Carl s Electronics line Offering hundreds of Educational Hobby Kits Ju
76. 650 Hanover NH 03755 5650 or call 800 269 6301 Postmaster Send address changes to Circuit Cellar Circulation Dept Box 5650 Hanover NH 03755 5650 Circuit Cellar makes no warranties and assumes no responsibility or liability of any kind for errors in these programs or schematics or for the consequences of any such errors Furthermore because of possible variation in the quality and condition of materials and workmanship of read er assembled projects Circuit Cellar disclaims any responsibility for the safe and proper function of reader assembled projects based upon or from plans descriptions or information published by Circuit Cellar The information provided by Circuit Cellar is for educational purposes Circuit Cellar amp makes no claims or warrants that readers have a right to build things based upon these ideas under patent or other relevant intellectual property law in their jurisdiction or that readers have a right to construct or operate any of the devices described herein under the relevant patent or other intellectual property law of the reader s jurisdiction The reader assumes any risk of infringement liability for constructing or operating such devices j j j j a Entire contents copyright 2004 by Circuit Cellar Incorporated All rights reserved Circuit Cellar and Circuit Cellar INK are registered trademarks Jen n ife r h u ber circu itcellar com of Circuit Cellar Inc Reproduction of this publicat
77. 7 April 2005 CIRCUIT CELLAR the function it will perform The ECCEn bit enables an interrupt to occur when a module s event flag is set HSO mode toggles a port pin when a match occurs between the PCA timer and the preloaded value in the compare registers see Figure 1 page 69 This pro vides more accuracy than the process of toggling pins in software because the toggle occurs before it branches to an interrupt i e interrupt latency will not affect the accuracy of the output In fact the interrupt is optional Only if you want to change the time for the next tog gle is it necessary to update the compare registers Otherwise the next toggle will occur when the PCA timer rolls over and matches the last compare value You can use HSO mode for pro grammable square wave generation You need to load an appropriate 16 bit value into the 16 bit PCA module regis ter and configure it for HSO mode It sets the CCFO flag that generates a PCA interrupt In the interrupt service rou tine you can reload the module regis ter CCAPMn next value to compare to make additional comparisons This way you ll generate a programmable square wave signal that you can use to drive a stepper motor along with a sequencer Because the chosen PCA module han dles most of the driving you can drive the motor in the background This also enables you to assign a PCA module to each stepper motor sequencer You can drive all of them in the backgroun
78. 70 Grass Valley 95945 Drive Outputs 32 GP 1 05 amp 8 High OFr Du E Multipurpose 1 05 GP PW Counters 16 Channels of 10 bit amp 8 Channels of 12 bit A D 2 Channels of 8 01 amp 4 Channels 1 R8232 1 5232 422 485 amp 1 1 12 bit D A Port e Real Time Clock amp LCD Keypad Interface Bootloader amp Free GNU Compiler Included MODBUS Software amp Terminal Board Available For Windows 3 Editions starting at 99 s h Since 1985 VEAR OI BENE BOARD CIRCUIT CELLAR The iPac has enough 1 0 for demanding applications amp with a size of 3 5 x 3 8 it can fit almost anywhere Prices start at 160 EMAU inc EQUIPMENT MONITOR AND CONTROL Phone 618 529 4525 e Fax 618 457 0110 Web www amacinc com Issue 177 April 2005 37 encryption is detailed in DS1991 MultiKey iButton Dictionary Attack Vulnerability which I wrote in 2001 The DS1991 iButton is a hardware authentication token that has three internal 48 byte data areas each of which is protected by a distinct pass word Only the correct password will grant access to the data stored within the area Although the marketing lit erature claimed that incorrect pass words written to the DS1991 would automatically invoke a random num ber generator that replies with false responses which eliminates attempts to break security by pattern associa tion it was determined that the data returned on an inco
79. ASCOM AVR compiler for the external SRAM appli cation I selected wait states in this spin just for grins The only other tabs I had to access were both of the Communication tabs which allowed me to set the microcontroller clock speed and designate a default data rate and PC COM port I entered the Micro64 clock frequen cy and microcontroller USARTO data rate in the window shown in Photo 3b The entries in Photo 3c are for the terminal emulator built into the BAS COM AVR IDE www circuitcellar com The rubber hit the road in Listing 3 BASCOM AVR allows you to carve out a chunk of external SRAM using the xramstart and xramsize opera tors The xramstart operator allows you to begin at a desired point within the external SRAM address range while the xramsi ze operator overrides the size of the external SRAM I designat ed in the set up window in Photo 3a After configuring and initializing the Micro64 s USARTO I defined XRAM byte Sram data and XRAM pointer Sram poi nter The actual external SRAM data location I was exercising was at 0 0100 Sram data I created a pointer to the external SRAM memo ry location Sram poi nter using the BASCOM AVR s Overlay parameter This allowed me to access the Micro64 s external SRAM via pointers just as I had done with CodeVisionAVR Both BASCOM AVR and CodeVision AVR include terminal emulators in their IDEs Photo 4 page 59 is the combined result of running the CodeVisionA
80. CIRCUIT CELLAR SEAL EV EL SPEEL vol Sy eters a 845 4443 EX LE Bm T Iu Add Industrial Automation Protocols to your Device Fast Ensure connectivity using interchangeable law cost OEM Modules with a common PCB fogt print and software Interface Development kit with C source code available 800 317 831 9 PROTOTYPE CIRCUIT BOARDS 8 5 for two 5 x 6 wS 2 layer boards Shipped NEXT BUSINESS DAY if data is received by 1 00 EASTERN www apcircuits com AP Circuits 403 250 3406 staffia apcircuits com www circuitcellar com www circuitcellar com Enter Now Submission deadline April 27 2005 Sponsored 4 reesc ale Semic Well Ini PSOC High Integration Challenge Thank you to everyone who participated in the Cypress PSol contest Visit our web site for complete project postings from recent Circuit Cellar design contests www circuitcellar com magazine contests htm Custom Printed Circuit Boards Nobody beats our PROTOTYPE PCBs We are the 5 PCBs 5days specialist AMAZING VALUE 2 layer Get 5 PCBs for 13 each in 5 days layer Get 9 PCBs for 89 each in 9 days Upto 20 sq inch FR 4 0 062 thick 7 mils trace space 15 mils finished hole min unlimited drill sizes FREE Tooling green LPI soldermask white silkscreen More sizes and offers available See website for details Order Online www PCBFabExpress com PCB Phone 408 857 0039 h email s
81. CTRL M2HOME M2LIM1 M2LIM2 KBCLK KBDAT PSEN TXD RXD VCC CN7 M1DIR CW CCW 0 1u MOTPWR ADS AD A 4 n2 T co CONTROL SYNC M1H F HALF FULL IE a ear 7 7 FEL MILI M RST M1L2 EN r rs 1 al MILIM2 wee MICTRL E iios m I 8 ps Di D2 D3 04 R16 12980 R15 R20 Te 0 5 GND M ii MOTPWR 01 024 D14 D15 D16 Motorola A A AN ZN 8 YCC VCC M2DIR CW CCW 1 4 M pcr us T_T M2L1 Mee r Eo zm ue L 2 VREF INHi D m M2LIM2 ot a E 914 1 M2HOME HOME OSC L297 i en VCC VCC n3 M3DIR M3H F M3CLK CW CCW HALF FULL Al E E E E M2CTRL Bi E M3REF M3CTRL CONTROL SYNC HOME i L297 R19 VCC YDD 5V VSS GND M3LIM1 M3LIM2 MOTPWR D10 D11 012 N ZN LN LN us GND M MorPwR D22 D23 024 A A LN LN 4 M3LIM2 017 D18 D19 D20 LN UN IN IN GND M Note R1 are used as current limiting resistors for driving optocoupler LEDs or they can be used as pull ups for limit switches des coo T M Figure 2 The three axis stepper motor driver is implemented as a compact single board driver with on board ter minations emerging from the back of a 42T 3U Euro instrument case 70 Issue 17
82. Catalog 9397 750 11146 vol 5 April 2003 STMicroelectronics The L297 Stepper Motor Controller AN470 November 2003 SOURCES AT89C2051 Microcontroller Atmel Corp www atmel com P89C51RD2 Microcontroller Philips Semiconductors www semiconductors philips com L297 Stepper motor controller STMicroelectronics www st com Issue 177 April2005 77 SILICON UPDATE USB Easy Riders by Tom Cantrell Tom takes a closer look at USB technology and the process of upgrading applications with USB connectivity Chips like the CP2102 make the procedure a whole lot easier was way back in September 1996 when I first wrote about the then nas cent Universal Serial Bus Oh Say Can USB Circuit Cellar 74 Now after 10 years and more than 1 billion USB devices according to www usb org it s clear that USB is a boon for PC connectivity and is here to stay Reports of the demise of the classic serial and parallel ports are slightly but only slightly exaggerated Printers keyboards mice and all manner of PC oriented gadgets are on board with USB Now it s time for the embedded crowd to follow suit Porting embedded applications to USB isn t anew concept There have been more than a few articles on the sub ject right here in Circuit Cellar Refer to the resources section of this article for a list of them Nevertheless time and silicon march on so let s take a look this month at the latest a
83. Comm Events Flow Control Timeouts Disconect Autowrap MSN fol 150 of the VCP driver i e XP and Windows 98 were func tional and could talk with each other Next I exercised the vari ous handshaking features both hardware RTS CTS and DTR DSR and software XON XOFF As expected with handshaking disabled I was able to induce overrun errors when transferring a big file from the fast com puter to the slow laptop see Photo 3 With handshaking enabled the overrun prob lem went away and the file transferred successfully This serves as a reminder that even though the CP2102 does an admirable job it can t work miracles such as making a slow computer fast Data rates are another possible gotcha The CP2102 datasheet touts the chip s ability to deliver data at up to 1 Mbps Besides the fact such a high rate would no doubt push the envelope of what a par ticular PC can handle most existing applica tions don t know about anything above and beyond the standard data rates e g 300 bps to 115 2 kbps To add a twist the workaround is different depending on your specific PC operating system For Windows 98 it s possible to access the UART control registers directly to program the desired data rate However XP doesn t allow appli cation software to have direct access to chips Stop me before I crash again The recommended hack is to change the clock divis
84. DVal ue TOIR VI CVectAddr CIRCUIT CELLAR Start Read A D data Cl ear Acknowl edge ARM interrupt debug an A D conversion register 0 Wait for end of conversion A D Stop A D conversion amp 0x03FF Out put 1 serial Extract AIN1 10 bit A D value A D conversion result to port interrupt flag www circuitcellar com Products W Suppliers technologies wh EL LY EM 1 iat j fel i 2 7 oe trace f ai zi Met egy r an M Cu 7 E d d 2 47 EI lt es i x ig nm d ew 27 gt F e amp S h We 4 um 7 Delivering the latest with the greatest Engineers turn to Mouser to find the latest technologies from industry leading manufacturers Mouser is the catalog distributor focused on the needs of engineers We deliver the latest technologies with the great service and support you need SEMICONDUCTORS PASSIVES INTERCONNECTS POWER ELECTROMECHANICAL TEST TOOLS amp SUPPLIES HOUSER New Products a i Company New Suppliers New Technologies New Catalog Every 90 Days 800 346 6873 www mouser com Photo 2 This is a good way to get to know some of the periph erals and their associated regis ters on the LPC2138 Given all these features I quickly down loaded code to the board ran it and debugged i
85. EmbedDisk Extreme Temp IDE Fash ei Issue 177 April 2005 87 NEXT BUSINESS DAY 2 EASTERN ro cn sane 35 restriction 5 eo eee 2 layer 2 pc PROTOTYPE Printed Circuit Board Also ereailabie Small Rum Productian 5 days turn RF Remote Control Systems AM 315 MHz Mix n match Encoders amp Decoders 110 SERIES KEYFOBZA Trareameter encoders for systems a Serum pretmoal 4 j s J15 frequency L 2 ar 3 push button TTA LED teremesion ndicat r Range up to 2551 Auto shut nit s ARS Sra Custom overiays a FO compliant AM HIKK DECODERS Ministre RF meiles Sene protocal a amp H 305 frequency Laer Ttrirmimesd hybrid Range up to 230 FOC compliant More info Ib www com a4 Elactranics Inc www can 32 com The original Controller Area Neteork to R5232 serial carmartar Powered with an Aimer AVR RISC microconiraller and Praips SJIATODOU CAN ennitraller masas unique compinabon of high speed tranpters pas aible aven at higher CAN bus spends CANZA has also buill in receive FIFO of 32 messages whech makes il posable ks receive amall buras of masa wilFicul Fames pas sound intargsting Read more at vewwocam2 2 com Free sampe programs in Delphi VB Linux amp E 1E VDIC supply via CAP coanactor CL Der1023 Smal
86. I 12 1wie 2wie 2c LcD 1Wie 2Wwie 2c LCD Chip ExtemalSRAM Pots 1wie 2Wie 2c LCD BitBanged BitBanged Project Information Chip ExemalSRAM Pots Extemal IRQ Times USARTO 05 1 Bit Banged Project Information that runs on your PC communicates with the Micro64 bootloader firmware via a fast serial connection There s a copy of BASCOM AVR in the Florida e room s compiler library I came across Chip atmecs s Z the latest version of CodeVisionAVR as well I have CodeVisionAVR up and running right now So as Steven Stills al would say love the one you re with Bert on se lobe Boot Loader Size 2048words Boot Loader Size 4096words Project Information Chip External SRAM Ports Project Name 1064 External SRAM READ WRITE DEMO Version 1 0 0 Date 01 05 200 Author Company Circuit Celar Comments M read write code generated by the Wizard Extemal SRAM size 32k Eoo External SRAM page configuration 1100h 1FFFh 2000h 7FFFh Lower wait states Upper wait states None Y None Y Baud rate 9600 2 Baud Rate Error 0 0 Communication Parameters Data 1 Stop No Parity Mode asynchronous 7 4 he CodeVisionAVR amp Micro64 CodeVisionAVR is an AVR C com piler from the house that Pavel built HP InfoTech CodeVisionAVR s Photo 2 like to use Wizards to check my
87. IC12 AVR 8051 HC11 and ARM micro Save Time Save Money controllers Latest version includes 40 new PIC18 s Co simulate target firmware with your hardware design Includes interactive peripheral models for LED and LCD displays switches keypads virtual terminal and much more THIS 15 clearly superior in every respect x Provides source level debugging for popular compilers and assemblers from HiTech PICC B4 SYSTEMS www rdsystems com Crownhill IAR Keil and others E NC Tel 905 898 0665 info r4systems com correctly all you have to do to get the day of the week is call the function at 0 7005 Read Day Of Week The Result variable will be held at SRAM location OxOFFE in the form of an inte ger As a result all you have to do is simply read the Result memory location to obtain the day of the week Now I ll show you how to do this with the language of BASCOM AVR Things are different with BASCOM AVR You don t need to declare and define the function because inline assembler statements perform the function call The BASCOM AVR function call for the day of the week looks like this asm Call 7D05 end Asm The function of your SRAM word at OxOFFE is the same in BASCOM AVR and CodeVisionAVR It s declared in BASCOM AVR in this manner Di mResult As Word At amp HFFE After you ve made the inline assembler call the result will be passed
88. Inpul Dulput Boards and much mone www futurlec com 10 Off amp Free Shipping The first ever book to apply affordable and popular open source tools to the exciting world of robotics design Source Robotics ami PHS banira Gobo p DL BI Provided CD ROM contains valuable source Ni code and design tools save 1075 off and Free Shipping at www books elsevier com coamputerentg Use Offer Code 81030 Order online at www melabs com 119 95 Inctudes Programmer J i Serta Cable AC Power Adanter ZIF Adapter for B io Ahin DIP amp aofftware for Windows SS MggAT ZRAXP EPIC Parallel Port Programmer starting at 59 95 92 Issue 177 April 2005 hirer USB Adapter 39 95 PRINTED CIRCUIT BOA Dy QUALITY PRODUCT FAST DELIVERY COMPETITIVE PRICING UL approved Single amp Double sided SMOBC LPI mask Through hole or SMT Nickel amp Gold Plating Routing or scoring Electrical Testing Artwork or CAD data Fast Quotes Flex Circuits 990 W Pacific Ave Franklin Park IL 60131 Phone 847 2 Fax 847 233 0013 Modem 847 233 0014 vww pulsar inc com youn a flash net USB Data Acquisition ADUZUS USB VO internace ADEPON i E we es hal FEATURES relay cuspuls B LATED digital ipul Port Pasmrmi 5180 aTr 4 ther ADLIZ U 4 Channel Version eth
89. Instruments zm R amp D Education Robotics i Lab Scope Fast DAQ A WES Service iix dag Debug BitScope Pocket Analyzer uses highly integrated Surface Mount technology to provide functhonality you would expect from scopes many timas the size and price Its programmable Virtual Machine architecture means new functionality can be added via software Far custam Data Acquisition export directly ta your spreadsheet in Listing 6 The output lines used to control the LED display on the Blackfin evaluation board are looped back to the PF input lines A back ground interrupt task involving one of the processor s timers is used to mimic the temperature sensor signal A self test was performed in this situation using the LED and PF lines on one board However for more complex tests it would be practical to store the test code in the flash memo ry of a second Blackfin board The sec ond board could be used to generate a variety of video audio and logic level tests in response to requests from the TDD package on the first board trans mitted over the high speed serial port SPORT over low speed UART over the high speed serial parallel inter face SPI or through the JTAG emu lation environment s available multi processor capability Having an easy approach to generat ing these hardware tests is the next step in our research project We re examining th
90. Optional TVLB T6 VD Unregulated 10358uu0 BZ 10 90421 m ERR 4 i 2 1 OR a ERIT MM Reduce Your Time to Market Minimize your time from conception to production by utilizing one of Micromint s market proven controllers Whether your concerns are digital or analog inputs or outputs Micromint has a product to fit your needs Order quantities of one to thousands Custom design and configurations are available With over 500 000 controllers in the marketplace Micromint has been providing innovative turn key solutions to the OEM market for 24 years from design through production as well as packaging and shipping the final product Our broad line of embedded controllers and turn key solutions can turn your imagination into reality S Visit our website www micromint com to see our complete line of OEM Solutions MI Cra m t 115 Timberlachen Circle Lake Mary FL 32746 800 635 3355 407 262 0066 Fax 407 262 0069 Temperalure Humidity Logging RH U2 PTTU4 Temperature and Hurmidty Logger for PC High resohulion and accuracy No power supply required CANbus Starter Packs anc cards for almost any board format amp OS ridges industrial suloenation solution from Janz AG used by lop companies
91. RS 2 Application Kits These kits provide all of the tools needed to create a GPRS enabled embedded application including a RabbitCore Module prototyping board GSM modem Integrated Development Environment and roy Kit Price Price 699 peto ns mue Y e LL GPRS M2M alty free TCP IP stack with sample programs and libraries to simplify Konica on Kits development The M2M kit provides additional tools to facilitate machine to macnine communication 2932 Spafford Street Davis 95616 Tel 530 753 6400 lemiconductar File ITY Transfer Help Baud Parity Data Bits Stop Bits Port coni z 115200 None 7 fi zj Local Echo Is this COM port real or virtual Modem Status Comm Status Iv cts v DSR RING M RLSD CD T CTSHold XOFF Hold TX Char DSA Hold XOFF Sent TX Chars 0 ALSD Hold EOF Sent RX Chars 0 Multi threaded TTY File TTY Transfer Help Port Baud Parity Data Bits Stop Bits None 4 Only the 05 knows for suret gt Modem Status Comm Status TI ENT 2 CTS Iv DSR RING IV RLSD CD I CTSHold XOFFHold TX Char feevents tse nS DSR Hold I XOFF Sent TX Chars 0 T RLSD Hold EOF Sent RX Chars 0 iz Photo 2 After installing the virtual COM port VCP drivers you can perform initial CP2102 loop back tests on a single PC by running one copy of a terminal emulator talking to the virtual COM port and one
92. S COM Visa MClAmen Disc Phone 779 520 5323 A19 520 1867 Box 60039 Colorado Springs CO 80960 B Compilers for PIC MCUs Fasy To Lise BASIC Commands Kingos Sx Me 2R XP PicBasic Compiler 99 95 E BASIC Stamp 7 Compatible Supports most f4 hit Core PiCs Buut in ara Corin Commands PicBasic Pro Compiler 249 95 aupports al Plimicro MOUs Direct Access fo intemal Registers supports In Lirve Assembly Language Interrupts in FicBasic amd Assemtisly Bult in USB Hea z232 and More Source Level Debugging See our full range of products including Books Accessories and Components at www melabs com www circuitcellar com Neo m Front Panels amp ROLL wnload the free Front Panel Designer o peek fea tore NS Ro TCP IP TCP com v2 0 R5232 to TCP IP software Plus TCP IP to RS232 WinWedge RS232 or TCP IP data direct into any Windows app Excel Access etc _ Order your front panels online t h and receive them just in time ec RAF g T Free 30 day evals at www frontpanelexpress com CUSTOM MEMBRANE PEE SER KEYBOARDS SWITCHES P irae ACCENT w 4 E iT Em Introducing a pocket programmer with true Universal Output e TO 2 WEEKS TURNAROUND VERY COMPETITIVE PRICING e Ex 5 4 switch keyboards for 395 00 e PCE backed swtiches EM we 5 metal bocipialedassembles
93. The dou ble sided foam tape atop the assembled sensor s contacts had corresponding holes punched The wells which hold a QTC Pill have a top conducting disk punched from the thin sheet metal stock placed on top of them The dou ble sided tape holds the sensor on the gripper it allows a surface of rubber trom a Playtex glove to seal the entire sensor The rubber also prevents the gripper s surface from becoming slippery You can surface mount the circuit in NM Figure 4 to flex cir cuitry to make a complete sensor package The SPI interface allows an internal ADC to measure each sensor complete sensor on a flex circuit This design uses SPI for communication with the robot This could be FC USB or any other type communication channel you may be using on your robot WWw circuitcellar com and report back with sensor pressure data CIRCUIT CELLAR Peratech Pill Alternatively you can pro gram a TTL output as a go no go output using pre programmed EEPROM val ues as trigger points The SPI interface can set or redefine these values Your biggest concern should be choosing the divider resis tors These are based on the type of QTC material you re using and the gripper s sen sitivity requirements ELECTRIC DREAMS Although my Hero still needs sensors to guide its hand toward an object it can now grip things without mashing them to bits see Photo 6 Robots of the future may be covered with skin ma
94. Therefore there is effectively only 28 KB of external SRAM avail able If you need to access all 32 KB of external SRAM the ATmega64 datasheet describes a way to mask the high address bits and swap in and out of External Memory mode to get at the hidden SRAM Phil has also pre pared an application note detailing how you can get at the 32 KB of SRAM within the Micro64 USART I was used by the Micro64 bootloader However I wanted to spill my SRAM read results out of a serial port and that left USARTO as my only choice Note that 9 600 bps was fast enough I really didn t need a receiver for this application Entering my USARTO configuration choices in Photo 2c was as far into Micro64 hard ware configuration as I needed to go I wasn t planning to use any of the other Micro64 peripherals in this spin I took some time to fill in some of the project information just to see where the Wizard would put it see Photo 2d After that I generated my configuration and saved the files micro64 sram c micro64 sram prj xi CodeWizardA R untitled cwp File Help d ExtemalIRQ Timers USARTO USARTI Analog Comparator ADC SPI l2c CodeWizardAVR untitled cwp Ele Help Extemal IRQ Timers USARTO usar gt CodeWizardAVR untitled cwp by E CodeWizardAVR untitled cwp C Ele Help Elle Help ExtemalIRQ Timers USARTO USART1 Analog Comparator ADC SPI 12c Analog Comparator ADC SP
95. VR C and the BASCOM AVR BASIC external SRAM access code I ve just described HOW D HE DO THAT So as not to put the cart before the horse I need to explain how I set up my Micro64 development board in relation to the Micro64 Bootloader PC application Photo 5 page 59 pretty much tells the story I attached the Micro64 s USARTI to my PC s COMI via the Micro64 s development board nine pin shell connector J2 I used COMI as the bootloader programming port for both the CodeVisionAVR and BASCOM AVR environments I per manently attached COMO to the USARTO port on the Micro64 J3 I used BASCOM AVR Options Compiler Communication Environment Simulator Programmer Manitor Printer Chip Output Communication 120 SPI LCD Chip mB4def dat Y FlashROM 64 KB 4036 2048 ARAM waitstate External Access Enable 32KB SRAM Hw Stack 32 EEPROM Soft Stack 8 vi Framesize 16 Default X Cancel a Listing 3 Use of the Overlay operator is a clever way to create a pointer in BASIC language The idea here is the same as with the CodeVisionAVR C code The only real difference is where the compilers choose to call the beginning of the external SRAM space regfile mo64def dat baudl 9600 xramstart amp H100 xramsize amp H1000 Configure the serial port Config Coml Dummy Synchrone 0 Databits 8 Clockpol 0
96. What would happen if you were to apply a 3 75 V voltage source to its terminals b Plotting the forward voltage against the log of the current shows that the relation isn t exactly exponential but it s extremely close except for LED D which obviously has some prob lems c The two upper traces are LEDs from a cheap flashlight The middle trace is a good quality white LED The lower trace is an old red LED for com parison The top trace stops at 15 mA just before the LED began flickering that voltage the blinking LED passes less than 10 mA Why it blinks at that current I cannot say other than that AA cells certainly differ from my test rig Notice that the graph also shows that current through my white LED is off scale high Ooops Well if you ve never Issue 177 April2005 41 short C3 Tantalum Figure 3 A MAX1595 regulated charge pump produces a nominal 3 3 V from two AA cells to drive about 70 mA into four white LEDs In theory anyway made a mistake like that you re a better engineer than me The diode s internal bulk resistance limits its actual maxi mum current and the bond wires didn t vaporize in this case I suspect the LEDs in that flashlight came from a production line sort for high forward voltage This was a cheap flashlight and I doubt the manufacturer bought a custom run of LEDs The fact that three of the LEDs failed under what seem like normal conditions makes it reasonable to assume th
97. a a categorized list of options without having to write code to do it Combing all the control component interface and application code results in the code in Listing 2 page 26 which is all you need to accept a seri al string from the virtual COM port via USB convert it to degrees Celsius and graph and display it Graphing the data takes only one real line of code www circuitcellar com f M ul mil s il r Tl k CL TE EET n seas f ed um cm EAM i ion and creativity Lm 22 4 lt 6 gn 24 could win you a share of The Renesas M16C Design Contest 2005 is the perfect opportunity to work with the Renesas M16C family Your innovation and creativity could win you a share of 20 000 in cash prizes The Renesas M16C MCU platform is the industry s broadest microcontroller product line offering seamless code peripheral and pin compatibility from small 20 pin to large 144 pin devices all within a single common software development environment The complete line of highly optimized MCUs delivers practical solutions for your applications For the official rules and entry form go to vee 1 MU UNE verywhere you imagine www circuitcellar com renesas2005m l 6c Deadline June 30 2005 deren See the web site for c
98. a8 Early experiments showed that the system would be capa ble of differentiating and tracking color blobs effectively with only 4 bits of color data per channel This reduces the range of each of the three color chan nels red green and blue from 256 pos sible values 2 down to 16 possible values 2 Thus the system can rep resent 1 024 different colors 2 x 3 The vertical sync VSYNC signal from the OV6620 is connected to the ATmega8 s external interrupt 1 which allows the microcontroller to be inter rupted every time a new frame is about to begin The horizontal refer ence HREF signal which is connect ed to external interrupt 2 triggers each time a new line of pixel data is about to begin Finally the pixel clock PCLK signal from the OV6620 is IC5 LM2937 PCS ADCS ATmega Figure 2 Building the low cost AVRcam is fairly simple An Atmel ATmega8 microcontroller drives the system CIRCUIT CELLAR Issue 177 April 2005 13 directly connected to the ATmega8 s 16 bit Timerl The timer is configured to count exter nal rising edge transitions with an interrupt on overflow It s preloaded to overflow after an entire line of pixel data has been sampled Although the OV6620 provides a multitude of signals there s still a considerable amount of data flowing from the OV6620 to the ATmega8 that needs to be processed How much data Approximately 3 mil lion bits per second 4 bits pixel
99. abs com www circuitcellar com THE DIRECTORY OF PRODUCTS AND SERVICES AD FORMAT Advertisers must furnish digital submission sheet and digital files that meet the specifications on the digital submission sheet ALL TEXT AND OTHER ELEMENTS MUST FIT WITHIN A 2 x 3 FORMAT Call for current rate and deadline information Send your disk and digital submission sheet to IDEA BOX Circuit Cellar 4 Park Street Vernon CT 06066 or e mail kc circuitcellar com For more information call Sean Donnelly at 860 872 3064 The Suppliers Directory at www circuitcellar com suppliers_dir is your guide to a variety of engineering products and services I2C MDIO CAN SPI XA Kits i p amp ISP FLASH PC ISP FLASH 50081 XA nud AVE ESPAAE FLASH mioa fom Phi ond Alme with usse oftware ISP iniface cake others ard documentation inched for DU 2 aima Dediwecbonal communications bates any FC and EZ or MDG tasad parcphenals Windows ward coils ma nciucentalien mia yas PC I2C DEV izis the eerie programs fo cones the POM board direct eng Moroes Sal C Belg CAC Micia Weel Sidi Includes saftware DLL for custom user applicalians ard eem plate fus HG gi XTEMD Kits mime the user to debug ur prriobyne any Pips XA based design Fils dude Dew Board with ami Debug Ecl hacer ee
100. achments to generate rotary or push pull motions Three wires are used to interface to a servo driver Different servo manufacturers may use different wire color codes and pinouts CIRCUIT CELLAR is in the 100 to 200 mA range When powering several servos from the same supply you must ensure that the current rating on the power supply is adequate The command signal input to an RC servo is a PWM digital pulse train see Figure 1 The amplitude of the PWM pulse is nominally 3 to 5 V The pulse train has a period between 20 ms 50 Hz and 16 ms 60 Hz The period s actual value isn t critical The width of the positive pulse which can vary between 1 and 2 ms determines the absolute angular position of the servo A pulse width of 1 5 ms corresponds to the center position of the servo travel A typical servo will swing through a 90 range corresponding to a 1 to 2 ms pulse width variation This range however can also vary from servo to servo so check the specifications Most servo vendors provide a safety margin that allows their servos to rotate beyond the 90 when sending commands outside the 1 to 2 ms boundary As a result a lot of com mercial servo control boards support an extended mode where the pulse varies between 0 5 and 2 5 ms Be careful though because crashing the servo in its hard stops can damage its gears This is why some board vendors also allow you to set soft limits on each servo channel so that min
101. all over the world_ USB in one IC FT232BM Single chip USB 232 soluan all Windyas MaciLinux driwer amp No program mip USE knowledge required Easiest answer tp updaie AS 242 devices only 2 55 10k Morph I1C Morph JC cambies FT2232C and Alera ACEX FPGA ides for iSB upgrada amp bie praducis Uses MPSSE ip program rapre USB 4COM Swordfish Hand Held PROBE PS40Mi0 unique hand held PC Soopg scope 20KS s data logger FFT spac tum volmeiter and frequency meter 104141 ADC with a true sampling rait of up ta 40M5 s from 25606001 Alfat Easily add MB storage your new design full FAT Na aysiem slack 32 bib processor Send semal SP Gata to ALFAT and it takes care pf the resi only 75 951 Logging Module TOS2020F a cusiom CF card AD data logger or oom roller quick High level software completes projects in hours Stone GPSICANbus A or D data to card onby 194 60 qty ACOM add 4 of 8 COMperts fo your PC with this unit that plugs into your PXZ s USB pori amp LONE version gives 4 x FS amp 2 2485 ports wilh his fram 1051 i a PC adapter wih sensors for ighi PH valis and ipm Greal for science fairs Supplied with macy in nun ggf were and lots of physics ichem experiments from 101 48 USB Temp Logger Ww eee Hons iemadiaiphy wa research li and get a reply wlihin 24 hourz
102. am This helped me determine how white the CIRCUIT CELLAR line appeared to the system The course seemed much more difficult than previous ones so I was excited to set the EyeBo 3 free to see how it would hold up see Photo 4 When it was my turn to run I nerv ously powered up my robot It immedi ately locked on the line and started fol lowing it When it approached the zigza ging section normally the most difficult portion of the course it zipped right through it without skipping a beat The junctions proved to be a challenge because they weren t all 90 angles The EyeBo 3 took a wrong turn once or twice as did all of the other robots My EyeBo 3 ended up winning sec ond place in the advanced line follow ing contest The AVRcam worked exact ly as I had expected It allowed the robot to see the course and make decisions based on the visual information Now all that s left is to figure out how to use the tracking information to better follow the line ahead I guess that ll have to wait for EyeBo 4 and the next contest A LONG STRANGE JOURNEY The AVRcam is a great project It allowed me to have a crack at build ing a low cost embedded vision engine that enables my robots to see the world around them The system has a lot of potential I m thinking about including motion detection and object recognition Because of the open source nature of the project anyone can experiment with the code and add featu
103. and writes in either data or program RAM These were used for the Wat chData class The Blackfin ti mer class was developed with the system clock HARDWARE SETUP Figure 1 is a diagram of our thermal arm wrestling video game The major hardware component involves the need to read the asynchronous signals from the two temperature sensors and to determine the values of the two switches that reset and start the game The four inputs programmable flags PF are easily accessible on the Blackfin EZ Lite evaluation board Our original idea was to use an approach where changes on the PF driv en interrupts cause changes in various Core timer Voltage level shifter Video generator Figure 1 7wo ADSP TMP03 thermal sensors provide square waves whose duty cycles vary with temperature The pulse signals 5 V are limited to 3 V by a resis tor Zener diode network before being fed into the PF signal lines of the Blackfin evaluation board The on chip core timers are used to determine the duty cycles The calculated temperatures are used to position the game cursor on video frames stored in the SDRAM on the board A background DMA task transfers the video frames from the SDRAM to the video decoder and then to the video screen CIRCUIT CELLAR flags allowing the main task to transi tion between three states waiting for the game to start playing the game and resetting the game while it s running or after a winner has been
104. and enable the HREF interrupt and sleep until HREF wakes the system up Read the UV bus red pixel and use it to index into the red color map to extract redLookup Read the Y bus green pixel and use it to index into the green color map to extract greenLookup Read the UV bus blue pixel and use it to index into the blue color map to extract blueLookup Color redLookup amp greenLookup amp blueLookup Has the pixel count Close out last overflow occured run length N gt Color LastColor N Must complete in 16 clock cycles Waste cycles until the pixel block ends Figure 4 The heart of the low level camera interface samples pix els maps them to actual colors and run length ecodes the image line all in 16 clock cycles Add new entry to run length line Set LastColor Color www circuitcellar com manager is responsible for configuring the internal registers in the OV6620 The frame manager provides most of the line level processing tasks such as finding connected regions between two contiguous lines of pixels It also provides frame level processing such as parsing through the tracked object table to remove objects that are too small to be considered tracked objects Finally the camera interface provides the low level interface to the OV6620 through the pixel data buses and the various synchronization signals The vast majority of the AVRcam firmware was written in the C program
105. and receive USB Degrees Celsius Time In Minutes Sample Indicator Current Sampled Temperature Pride Embedded 27 Photo 3 Watching live graphics updates is a lot more inter esting than watching raw datastreams in a terminal emulator COM Port Status Open COM Port C COMI C COM2 Close COM Port Raw A to D value 183 gt Debug Window 26 Issue 177 April 2005 Listing 2 The Visual Basic code takes the serial string from the LPC2138 converts it and then graphs it to the chart Case A COMMAND Commandl nProcess False If CurrentStringSize gt 1 ArrayCount 1 For ArrayCount TemperatureString Temperature sensor End of Then Start Of To CurrentStringSize TemperatureString amp TemperatureSerial Data i A reading Current command any characters data Get Make the string Next Ledl LED Colour Timerl Enabled TemperatureDecNum DebugText Text vbRed True TemperatureDecNum TemperatureDecNum TemperatureDecNum Blink the virtual Val TemperatureString Raw A to D value raw A D value as sensor TemperatureDecNum A D reading TemperatureDecNum TemperatureDecNum LED Convert string to deci mal amp TemperatureDecNum Display read from LM60 via the LPC2138 s ADC 3 3 1024 Convert 3 3 V ref 10 bit A D 0 424 Remove 424 mV offset 0 00625 6 25 mV per degree
106. anged in a3 x 4 matrix To conserve the I O lines the 4 bit LCD data bus is shared with return lines of the keypad The on chip UART on the slave microcontroller provides the necessary serial commu nication link for full duplex communi cation with the host PS9C51RD2 The P89C51RD2 has only one UART channel that s reserved for the RS 232 remote control interface The other UART channel required for communica tion with the keypad and display con troller 89C2051 is implemented in soft ware Note that the software implemen tation has a drawback You can t receive the serial data in the background For this reason the serial communication protocol with P89C2051 is implemented in a command respond fashion The P89C2051 doesn t speak up by itself it responds only when it s polled by the host CPU One I O line is reserved for notifying the host CPU when a valid key is detected This frees the host CPU from frequent polling of the P89C2051 for a key Polling the slave at 9 600 bps requires an exchange of at least 1 byte requiring a minimum of approximately 2 ms CPU time Refer to Listing 2 page 77 for a taste of the firmware inside the P89C2051 Ti mer 0 scans the matrix keypad every 10 ms A state machine provides key detection debouncing repeating and other keypad features A serial interrupt is generated when a command is received The code invokes the appropri ate command handling function using a function pointer arr
107. antages when it comes to design in In what I believe may be a first the CP2102 integrates the 48 MHz USB clock on chip completely eliminating the need for an external clock source crystal resonator etc This is quite an accomplishment because the on chip clock must be accurate enough to meet USB specs a nontrivial challenge consid ering aging and varying environmental factors e g temperature and voltage The CP2102 also integrates the EEP ROM required for nondefault USB set tings that would otherwise require an external chip as is the case for the FTDI parts Like FTDI Silicon Labs provides a PC based utility for pro gramming the EEPROM via USB Although both the Silicon Labs and FTDI parts have a similar pin count 28 pins for the CP2102 and 32 pins for the FT232BM the CP2102 at only 5 mm x 5 mm has a much smaller footprint than the 9 mm x 9 mm FT232BM Another key spec difference is the 40 to 85 C temperature range for the CP2102 ver sus 0 to 70 C range for the FT232BM Price projections always come with caveats related to volume timing CIRCUIT CELLAR USB Function Figure 3 Silicon Laboratories s CP2102 represents a new low in USB to serial adapter chips lower chip count lower power and less board space channel direct versus distribution and your negotiating skill not to mention the challenge posed by edito rial lead times That being said as I write this column it appears pricing
108. are specifically designed for security purposes meaning that an attacker can t remove them without harming the underlying components Note that chemicals like methylene chloride sulfuric acid and fuming nitric acid can remove protective coat ings so be sure your compound is suit able for the protection level you desire When conformal coating is incorpo rated in a design to protect compo nents make sure that it serves its intended purpose Photo 1 shows an example of an early USB authentica tion device that stored critical data on the encapsulated serial EEPROM Aside from being able to scrape off the epoxy with a hobby knife to gain access to the device s surface mount pins an attacker could simply solder wires to the exposed footprint adjacent to the device which is intended for another serial EEPROM and read the memory contents using an industry standard device programmer The mis use of epoxy coupled with the device s accessibility could result in a success ful attack on the product Using ball grid array packages increases the difficulty of casual prob ing manipulation and attack because all die connections are located under neath the device s packaging However debugging with these pack ages is difficult Manufacturing is typ ically more expensive because X rays verify that the solder has properly bond ed to each of the ball leads A dedicat ed attacker could remove the target device and a
109. artin amp James Miller Three Axis Stepper Motor Controller Part 1 34 Embedded Security Design Part 2 ds Design Basics Circuit Board Viraj Bhanage Prajakta Deshpande amp Praveen Deshpande Joe Grand ou Li F IK e aT r 3 i s s ME a Pi PT s E Camera p 12 LPD2T2B Base 40 ABOVE THE GROUND PLANE Foolish LED Tricks Ed Nisley tz y FROM THE BENCH Stay in Touch 8 Sensor Material for Robotics Applications j LED Solution for Flashlight Jeff Bachiochi EN i Performance p 40 APPLIED PCs Test Driving the Micro64 Fred Eady SILICON UPDATE gt 0 USB Easy Riders Heathkit Hero itn CYTE Tom Cantrell _ Sensors px48 4 CP2102 Based USB Connectivity p 78 4 TASK MANAGER 94 INDEX OF ADVERTISERS My Favorite Subject May Preview Jennifer Huber 96 PRIORITY INTERRUPT Dead as a Doornail Steve Ciarcia 8 NEW PRODUCT NEWS edited by John Gorsky 11 TEST YOUR EQ edited by David Tweed 6 Issue177 April 2005 CIRCUIT CELLAR www circuitcellar com PERFORMAN AVR microcontrollers The perfect combination of performance and power consumption Spec designed for tha latest battery operated portabla k applications Atmel s naw Low Power AVA micrecontrolers provide six low power operation modes These devices T work down to 1 8 volts providing maximum battery life In iow power modes such as stan
110. asy to set up and just as easy to learn to use The support is outstanding as well The CodeVisionAVR compiler fol lows as closely to the ANSI standards as the AVR architecture will allow it to before giving in to the quirks of the AVR The package includes a bunch of utilities that do everything from drive LCDs to configure and communicate with Dallas 1 Wire protocol devices If you can t find what you want in the example code you can rub the lamp and summon the CodeWizardAVR auto matic program generator There s a big chunk of external SRAM begging to be used in the Micro64 brick I dusted off the old lamp and called on the Wizard to see if he would help me write a simple Micro64 external SRAM read write application After opening the CodeVisionAVR IDE I opted to create a new project I was asked if I wanted to call upon the Wizard I did and Photo 2a appeared on my screen As you can see I chose to create an application project The next step involved choosing the appropriate amount of external SRAM and defining how it should be accessed My choices are shown in Photo 2b I found that the Micro64 worked well with or without adding wait states The external SRAM was addressed immediately following the AVR s 4 KB chunk of on chip SRAM For the ATmega64 the first external SRAM address was 0x1100 with an ending address of Ox7FFF The lower 4 KB of external SRAM is overlaid by the ATmega64 s internal block of SRAM
111. at there is a large and ever growing list of parts to choose from Nevertheless your choice of platform is limited i e the number of USB enabled MCUs is a tiny fraction of the entire MCU universe Another concern is that you may have to learn more than you want to about the innards of USB even pre suming a lot of support from the chip supplier sample drivers application notes etc At the least you ll have to delve into the subject enough to assure yourself that handling the USB stuff doesn t compromise your appli cation s performance and robustness After you decide to sell a USB gadg et to the unwashed masses the PC side driver becomes a huge stumbling block Writing the driver is one thing but it s a problem that pales in com parison to the fact that you re now in the PC soft ware business whether or not you like it Calls in the middle of the night from brand X PC users Upgrades and bug fixes Microsoft sneezes and you catch pneumonia Yechh One good idea is to piggyback on the drivers Microsoft already provides The simplest and most generic is to impersonate a keyboard or mouse as a member of the human interface device HID class It might be tempting to go for a higher perform ance class such as mass storage and most recently video but they come with a lot more baggage overhead and complexity I ve concluded that for 3V3OUT XTIN www circuitcellar com now one of the best ways ce
112. at these are in fact production line culls DOING IT RIGHT Because LED brightness is proportion Code Activated Switches Download our free HS2372 485 amp Ethernet lermin l deep pP c em i A Emulators from www rsaB5 com 42 Issue 177 April 2005 al to current and current is expo nentially related to voltage LED flashlights become dim extremely quickly as their batteries discharge The nominal fully discharged volt age for alkaline cells is approxi mately 0 8 V so the voltage in a three cell flashlight varies from approximately 4 8 V down to 2 4 V Figure 2c shows that the correspon ding currents range from 15 mA down to just about zero so you d proba bly replace the cells at 4 V and 6 mA thus wasting much of their capacity More expensive flashlights use a power supply to boost and regulate the bat tery voltage I decided to use a Maxim MAX1595EUA33 which charge pumps a nominal 3 V battery to a regulated 3 3 V output The schematic in Figure 3 shows that the entire power supply consists of only four parts As you ll see R1 isn t required I replaced one of the three AA cells in my flashlight with a machined aluminum gizmo holding the charge pump circuit and four white LEDs as shown in Photo la Photo 1b shows a rear view of the RS242 R5 485 R5422 TTL USB 900 MHz Radio Converters Repeaters Fiber ptics Isolators Multi Hepeaters Hubs Extenders Multidrop 10 100 Base
113. ator with a relatively high and rapidly increasing current The MAX1595 datasheet calls for three ceramic capacitors which because of their lower ESR have better efficiency than electrolytic capacitors My parts www circuitcellar com stash doesn t include 1 ceramics I used a tantalum electrolytic capacitor on the input and an aluminum capacitor on the output with a 220 nF ceramic pump capacitor That s the most critical capaci tor and because it sees both forward and reverse voltages it mustn t be polarized At 2 6 V in and 3 25 V out the supply draws 323 mW from the battery At that voltage Figure 4a shows that the four LEDs dissipate approximately 180 mW for an overall efficiency of 55 That s the trade off for a nearly constant light output over the life of the batteries For comparison a 3 V flashlight bulb draws 530 mA and dissipates 1 6 W My favorite little incandescent penlight may have a tighter brighter beam but it uses five times more power than this LED flashlight Because the regulator s voltage output is closely matched to the LED characteris tics I omitted a ballast resistor and its power loss The current variation over the supply s voltage range is well within the LED s specifications Pragmatically speak ing the MAX1595EUA33 can t produce much more than 80 mA with a 3 V input The LEDs are safe from destruction even by a voltage source power supply If your LEDs require more than
114. attacker may be able to bypass many of the available on chip security mecha nisms to determine the device s content Such attacks are more likely to occur if the adversary can t easily remove the device from the board but still has space to access the component freely Decapsulation products such as those made by Nippon Scientific www nsc net co jp e and ULTRA TEC Manufacturing www ultratecusa com will delid or decap the top of the hous ing from ICs using hazardous chemical or mechanical means or a combination of both while leaving the die intact and fully functional Furthermore after a successful attack the IC package can be refilled with an epoxy encapsulate and the device will still operate normally CIRCUIT CELLAR Equipment has become available on the surplus market and the prices have been reduced to an affordable level approximately 10 000 to 15 000 Many academic institutions also provide access to such equipment After the die is accessible a tech nique known as voltage contrast microscopy can be performed with a scanning electron microscope to visu ally and passively extract voltage information from a flash ROM storage cell It also would be possible for an attacker to physically modify the die e g changing the security bits set tings Using focused ion beams FIB specialist companies like Fibics www fibics com and FIB International www fibinternational com can cut bond pads t
115. ay You may down load the complete code for the P89C2051 slave from the Circuit Cellar ftp site ROOM FOR IMPROVEMENT You ll have to make a few changes if you want the driver to be a completely Issue 177 April 2005 75 SCANO_ 31 2 o E 8 SCAN E OU Q INTO P3 2 Q INTT P3 3 1 3 5 AINO P1 0 GND AT89C2051 Matrix keyboard connector able to provide enough torque at a certain point because of excessive friction This results in a mismatch between the actual and computed posi tion The solution is to incorporate a rotary encoder for position feedback The encoder would emit a number of 4x20LCD count the encoder pulses using one of the PCA channels programmed to detect rising and falling edges A disadvantage of using a PCA counter is that it doesn t support up and down counting therefore if the motor changes direction the PCA counter would still count up and the actual posi tion would be lost Special devices are available for encoder to microprocessor interfacing e g LS7166 Such devices incorporate a filter circuit at their inputs to eliminate the effect of noise Figure 3 The 4 x 20 LCD and 4 x 4 matrix keypad controller are implemented with a 20 pin AT89C2051 MCS 51 derivative The tiny board is mounted on the LCD It can be hooked to any microcontroller with a three wire serial interface FIRMWARE TO COME Are you ready to build a generic mul pulses corre
116. batches can vary dramatically If you re using multiple LEDs for backlighting or displays you ll want consistent brightness Tweaking the cur rent of each LED isn t feasible so you must buy brightness matched LEDs Manufacturers test each LED in every production lot for brightness at a specif ic current typically 20 mA and sort them into bins LEDs within each bin differ by about a factor of two and the range across all bins spans several orders of magnitude Every functional LED goes into one of the bins which makes every LED salable the brightest LEDs command the highest prices and the dimmest ones go to surplus dealers For critical applications such as back lights a second sorting within each brightness bin groups the LEDs by color You can specify extremely accu rately matched LEDs if you pay a premi um price for the testing and sorting FAILURE ANALYSIS Shortly after I got the blinking LED flashlight I took it apart and replaced the offending LED It wasn t designed www circuitcellar com for easy repair so I used Gorilla Glue to secure the battered LED assem bly in place When I reassembled the flash light a second LED began blinking merrily away Now one failure could be a bad part Two failures represent a trend I took the flashlight apart again albeit with considerably more diffi culty removed the LED assembly and unsoldered the LEDs No matter what I discovered I would replace all of
117. cal engineering from the U niversity of Ottawa Eric has more than 10 years of embedded design experience He has worked on projects related to the International Space Station industrial robotics 3 D machine vision and embedded video Eric currently runs Digital Creation Labs Inc www digital creati onlabs com You can contact him at egagnon adigital creati onl abs com To download the code go to ftp circuit cellar com pub Circuit Cellar 2004 177 1 Scott Edwards Electronics Mini SSC II Serial Servo Controller SSC ASD2 wwvw seetron com pdf ssc2 mnl pdf ATmega8515L Microcontroller Atmel Corp www atmel com 25 Channel ServoPod New Micros WWW newmicros com SV203 Servo controller Pontech www pontech com Servo control software Roscoe Robotics http members aol com iamflb Mini SSC II servo controller Scott Edward Electronics Inc www seetron com FPGAs and development tools Xilinx Inc www xilinx com The SensaTronics IT Temperature fTlonitor Motifies you right away if your Data Center gets too hot Monitors up to 16 points with Tim Australia only one device Meeps historical data record EAVIAOAMEANTAL SENSING 61 Terrill Park Orive Concord 03301 603 224 0167 80D 633 1033 WWWwosensatronics com www circuitcellar com CIRCUIT CELLAR Issue 177 April 2005 47 FROM THE BENCH Stay in Touch sensor Material for Robotics Applications by Jett Bachio
118. chi Peratech s quantum tunneling composite QTC technology is going to change the way you approach your robotics projects Read on to learn how Jeff softened the grip of a Heathkit Hero robot with a QTC sensor Touch your thumb and index finger together I ll wait Feel that Now try the same thing using different pressures Feel any difference No Me neither Except for the muscle strain I felt I couldn t gauge the amount of pressure Nevertheless I can pick up an egg with out crushing it What allows me to do this Understanding of the world would be difficult without your sense of touch Although your entire body is sensitive to touch your glabrous areas e g fingers and toe pads are more sensi tive because of the types of skin recep tors found there see Figure 1 Your epidermis the top layer of skin con tains Merkel cells that respond to pressure on the skin and Meissner cor puscles that respond to vibrations 20 to 40 Hz Below the epidermis is the der mis which houses Ruffini endings that respond to pressure and Pacinian corpuscles that respond to vibrations 150 to 300 Hz Nerve fibers behave in two distinct ways The Ruffini end ings are slow adapting receptors that fire based on an on going stimulus The Pacinian corpuscles are rapidly adapting receptors that fire with changing activity Think of it like the difference between speed and accelera tion see Figure 2 Crime scene investigators use f
119. ck Then a close gate command transmits to ProgG ProgC waits for confirmation from ProgG and its work is done After initialization ProgT waits end lessly for commands from ProgC Only two commands are understood stop and go After executing a command a confir mation of receipt status is sent back to ProgC Now its back to the polling loop Like ProgT ProgG also waits endless ly for commands from ProgC Only two commands are understood open gate and close gate After executing one a confirmation of receipt status is sent back to ProgC and polling begins again These three basic controlling pro grams are enough to test that the simu lation works Now you can add bells and whistles For instance you can turn on the siren whenever the truck is in motion Attach a spare receiver to a PC and the PC will monitor all transmis sions and then display the progress of the simulation as it unfolds textually and graphically I implemented the former and it has proven to be extremely useful for debugging With lots of unused bits on the controllers start adding some LEDs to indicate status maybe headlights for the truck Use your imagination IMPROVEMENTS Improvisation is the keyword for low budget projects You can always scrounge parts from old equipment It isn t hard to find unused disk drives hard drives CD ROMS printers and other peripherals Most of the problems associated with this project are related to unreli
120. ctive member of the Chicago Area Robotics Group You can reach John at john robot net To download the code go to ftp circuit cellar com pub Circuit Cellar 2005 177 REFERENCE 1 J Bruce et al Fast and Cheap Color Segmentation for Interactive Robots Carnegie Mellon University Pittsburgh PA www 2 cs cmu edu trb papers wire visionOO pdf ATmega8 and ATtiny12 MCUs Atmel Corp www atmel com OV6620 CMOS sensor OmniVision www ovt com WinAVR SourceForge http sourceforge net projects winavr SX28 Microcontroller Ubicom www ubicom com Networking Multiple Serial Devices It s Easy i to simultaneously canne TOE T m a 517102 the Serial ta Ether 15k 5 Additional application samples shov Your rom Wwe E page Kirit F Ori oT i T et Ethernet to Sera tup to 4 senal devices to ar rdware module Application samples and data colectia W YOU now TO Monitor ane RabbitWeb purchase required a Ethernet Application Kit provides all the to network sensors and other serial devices This kit includes all the fo immediately demonstrate vide Web Acc Th i T Eh BRIT LESE 5 and Data Tr www circuitcellar com Li 7 Lance Tal LR rgf 1 p ER ess and Lo isSTer and storage and power thal you need RabbitiVeb Security FAT Ppp CIRCUIT
121. d s time has arrived But in OTG s case I think it just means there s no more avoiding the troubling issues that remain Chief among these is the fundamental assumption that universal device to device connectivity is a good thing As the old saying goes where you stand is where you sit For instance consider one example of a prob lem OTG is supposed to fix Many PDA users buy full size keyboards for entering large amounts of data And each brand of PDA typically has its own proprietary keyboard offering Wouldn t it be nice if every PDA user could instead choose from a variety of standard keyboards without being tied to one brand The answer is yes if you re Joe PDA keyboard user But what if you re the PDA man ufacturer Do you really want your valuable add on keyboard monopoly destroyed by cheapo clone keyboards In fact the OTG crew recognized CIRCUIT CELLAR the issue with provision for the so called target peripheral list TPL In essence this concedes the fact that the aforemen tioned PDA manufacturer may prefer to support only their own add on keyboards Another oft cited example of the need for OTG is the idea of a digital camera being able to connect directly to a printer instead of having to two step a picture file from the camera to the PC and then from the PC to the printer But instead how about just giving the printer itself limited USB host capability Check out the photo printers down at t
122. d simultaneously and independently You can also configure the PCA hardware module to count pulses Thus you can count an encoder s out put pulses to know how far the motor has reached in a closed loop system DRIVER ELECTRONICS Figure 2 shows a three axis stepper motor driver The P89C51RD2 which has a built in oscillator requires only an external crystal Y1 and two capacitors C1 and C2 Although we could have used any crystal frequency up to 20 MHz we chose 11 0592 MHz because it provides many standard data rates for communication with the PC Capacitor C3 R21 and diode D25 form a power on reset circuit You may connect an external push button reset switch with CN1 A three wire RS www circuitcellar com Everywhere you imagine iz N ES MN MCU Solutions Matched Play rosy 7 To Your Design Imagination RENESAS IS THE 1 MCU SUPPLIER IN THE WORLD Wiww renesas com Advanced 16 bit and 32 bit CISC cores that Fully integrated suite of hardware perform at up to 32 Dhrystone 1 1 MIPS and software tools Banked register architecture optimized Highly optimized C compiler and for fast context switching assembler FREE 64K limited version Wide range of high performance Download latest version from web flash memory 8 KB to 512 KB Best in class EMI EMS noise immunity Low cost Starter Kit target board USB debugger complete toolchain Designed to be pin and func
123. d actually drops slightly between 25 and 30 mA This is particularly obvious in Figure 2b with a distinct bend in the upper end of its curve I measured this LED sev eral times and came up with similar results so it s not my technique TERMINAL CONDITIONS The voltage versus current graph for a www circuitcellar com particular LED tells you two things As with my circuit if you know the cur rent the graph tells you the resulting voltage It also shows the current the LED draws at a given voltage Pop quiz suppose a designer connect ed LEDs D and C in parallel with a 3 100 V voltage source What would be the forward current in each LED Extra credit What about their brightness Peering at Figure 2a you can see that the curve for LED D crosses the 3 100 V line at 1 mA and LED C s curve crosses at 5 mA That makes a five to one differ ence in current although the other LEDs in this tiny sample would be more closely matched Because LED bright ness is roughly proportional to current LED C would be five times brighter than LED D I found it impossible to take a credible photograph but the difference is eyeballometrically obvious Not only does brightness vary with current it also depends on the exact composition of the LED which varies from batch to batch Despite what you think you know about the precision of semiconductor manufacturing there s a lot of art and magic ritual involved so LEDs from different
124. d enough on your activa signals Tha USBaae ZY and LISBae 5X data ower the High Speed USB 2 0 bus and use your PC RAM far ihe sample buffer This gies you marry times more samples than other equipment Visit our web site BA uses com 2 b dawnload ihe LIEBEs amp software far free Which nuns in damonstrabon wih m Pump Megabytes To Your Embedded Design The USBee ZA aka comes with the USBee Toalhudder Source Code and gives your own Visual C or Visual Basic applicabon direct access to the powerful data moving capabiktes of the ZX Dapanding on your PC configuration you can move up 24M EYytesisac ta and from tha WSBee ZX connected to your embedded design Connect mulliple USBee poda for more channels and combined Teabures 02 hor The USB based Electrical Engineer USBee com 951 693 3065 supportinusbee com www circuitcellar com CIRCUIT CELLAR The second approach we attempted was to fake the input signals by writ ing known values to the FIO FLAG D PF input register and pretend that the signals came from an outside device However the FIO FLAG D I O regis ter appears to be like many I O regis ters on other processors If you write a value to a pin that s configured as an input the written value is ignored We still think we might be able to get around this limitation but it won t happen in th
125. d micro64_sram cwp in my project folder I cleaned up the original Wizard generated code in Listing 1 by eliminating all of the unwanted ini tialization code for the ports interrupts and timers The next step involved adding source content that I knew I would need to select and use the Micro64 s USARTO For starters I added an i ncl ude state ment for the Micromint communica tions library MMRS485 h I declared a COM variable The value of the COM variable determined which USART would be used in the application I accessed the Micro64 external SRAM with simple pointers In addi tion to bringing in support for USARTO I added the local variables sram poi nterandsram data see Listing 2 I aimed the pointer sram poi nter at the first external SRAM location following the on chip 4 KB of SRAM 0x1100 and read the SRAM location to put a stick in the ground for what was there already I then pushed 0x AA into the same exter nal SRAM cubby I was pointing to and read the location again Now that you know how it s done with the CodeVisionAVR C compiler let s take a look at a similar external SRAM read write task I used the BAS COM compiler BASCOM AVR The BASCOM AVR BASIC compiler is similar to the CodeVisionAVR C compiler in that there are plenty of good examples and AVR biased utili ties included in the package Some of the built in BASCOM AVR goodies are shown in Photo 3a which is where I began setting up the B
126. d photonics demand a more dynamic structure As the number of lecture topics increases so does the number of experiments To avoid a plethora of separate experi ments consolidation is required and a process to combine topics into a single experiment is mandatory Prior to instituting this process a few instructors decided to make an effort to capture the students atten tion and hopefully light a fire in their 28 Issue 177 April 2005 imagination We agreed that the exper iments had to combine topics from the course syllabus and maintain the objective of stimulating student inter est One of the first successful attempts at this was based on a design that included a toy truck and a motor ized gate A small scale simulation of an automatic remote gate entry system evolved after we purchased a basic toy truck with a battery operated motor The result incorporated aspects of wire less communication and networking Optical sensors motor control and of course microcontroller applications all of which are covered in our courses SYSTEM MODULES My students work in pairs because many of them don t have experience command Stop truck a Receive command Figure 1 ProgC is the main program in the command Stop truck Close gate center ProgG and ProgT handle gate and truck control CIRCUIT CELLAR with microcontrollers They re first given a basic scenario of how the sim ulation sho
127. d then provide high level post processed image informa tion to the main controller A generic vision subsystem is shown in Figure 1 The image processing chain begins by capturing the images of interest with an image sensor Typically a CMOS or CCD camera is used to capture an image and convert it into a series of electrical signals Color cameras have tiny filters over each sensor element This allows only a specific wavelength of light to pass through to the sensor Thus an array of sensor elements with red green and blue filters results in a color image being captured by the camera because all colors can be created by combining these three These sampled pixel signals are then output from the camera in either digital or analog format Next a computing element is www circuitcellar com required to receive the sampled pixel signals and to perform the necessary processing The hard ware required for this task ranges from a small 8 bit micro controller to a full blown PC The exact processing required varies by application and usually performs tasks such as looking for abrupt changes in sampled pixels or calculating the average pixel value across an entire image The computing element also has some throughput requirements because it must be fast enough both to sample the pixel stream and to perform the needed processing In some cases it s useful for the computing element to sample an entire frame of pixels from th
128. dby AVA turns off all internal peripherals and the core Standby mode leaves only the external crystal running fo delmer start up times as low gs amp clock cycias AVR is a RISC CPU that executes instructions in single clock cyca with a rich CISC like instruction set and 32 working registers AVR micracontrollers have a very high cade density and extremely tast execution speeds up to 24 MIPS The Flash program memory and on chip EEPROM will heip you sash months off your development efforts save thousands of dollars in project costs and save YOUR energy as well Check out AVR today at hana 50 nA C 2004 iima Coroniien Aem and the Amel ooo ie You Bh AVR comes in a full selection of package and performance options and is supported by a full compliment of integrated tools to make your development process fast simple and successiul Atmel dedicated staff as well as certified technical consultants are available ta help and support your projects 5 sab makax mma ces for yourself Atmel s Butterfly exaluab n kit demonstrates AVR s law power capabilities and also serves as a development kit for the megal6o microcontroler get your project started off right Leam more about AVR at wianw etmel cor ad owpoweravr and register to win a free butterfly evaluation kil Seg why AVR offers the parfect combination www atlmel c
129. dd a socket for easier access www circuitcellar com As a result it s recommended to place critical devices in areas of the circuit board that may not have enough area or vertical height around the component for a socket to be mounted properly Another solution is to employ chip on board COB packaging in which the silicon die of the integrated circuit is mounted directly to the PCB and protected by epoxy encapsulation Even though methods exist to gain access to COB devices and even though an attacker can probe vias and traces extending from the encapsulate direct manipulation with the device and its connections are less of a threat Using COB devices also increases man ufacturing costs and isn t necessarily supported by all manufacturers because specialized equipment is required to manipulate the wire bonds between the silicon die and the circuit board A relatively new technology known as chip in board CIB embeds the sili con die within the layers of a PCB The concept is similar to COB although a cavity is created in the cir cuit board to hold the die An encap sulate is filled in over the die and cav ity creating a flat PCB surface I don t know what kind of financial burden this technology creates DIE ANALYSIS ATTACKS The analysis of IC dies although commonly done for failure analysis and chip design long has been the most difficult vector for attack pur poses With access to the die an
130. de reduced software over head and improved accu racy The PCA consists of a dedicated timer counter that serves as the time base for an array of five compare capture mod ules PCA timer modules are all 16 bits wide If an external event is associat ed with a module the function is shared with CMOD Counter mode register cio wore orsi orso Eor Address OD9H Nai bit addressable Reset value 00XX X000B CCON Counter control register Address 0D8H Bitaddressable Reset value 00X0 0000B CCAPMn Compare Capture mode register econ CAPPn CAPNn MATn TOGn PWMn Address ODAH n 0 ODBH n 1 ODCH n 2 ODDH n 3 ODEH n 4 Reset value X000 0000B the corresponding port 1 pin If the module is not CIRCUIT CELLAR Figure 1 The PCA hardware is extremely useful for timing generation and monitoring independent of the CPU You can use the PCA to run the motor in the background using its HSO mode Issue 177 April2005 69 IC2 co Cay SP cop poy EEr n3 R1 R6 Refer to text R1 MSL2 VCC VCC ic M3L1 Re Sines C MeL2 bs C10 M2L1 C13 C18 Vis 01u R Ceramic R6 M1L1 to 19 ox ew e cor gt em gt less VCC VCC 1DIR 1H F P89C51RD2 C12 R24 M2REF 10k M1DIR M1H F MICLK MIEN M1CTRL M1HOME M1LIM1 M1LIM2 M2DIR M2H F M2CLK M2EN M2
131. de of QTC material We ve come a long way baby And although we have a long way to go it s a seemingly small technological advance like this that will make all of our dreams possible Jeff Bachiochi pronounced BAH key AH key has been writing for Circuit Cellar since 1988 His background includes product design and manu facturing He may be reached at jeff bachiochi aci rcuitcel ar com PROJECT FILES To download the code go to ftp circuit cellar com pub Circuit Cellar 2005 177 SOURCES Load button cell Futek Advanced Sensor Technology www futek com Solid state pressure sensors Honeywell www honeywell com PIC12F675 Microcontroller Microchip Technology www microchip QTC Pills and Switch Substrates Peratech www peratech co uk FlexiForce A201 sensor Tekscan www tekscan com Issue 177 April2005 51 APPLIED PCs by Fred Eady Bi Test Driving the Micro64 Planning an AVR based industrial control or data logging application Check out the Micro64 which is a modular AVR based controller housed in a 42 pin 1 5 cubic inch potted brick most of you know designing professional embedded project that requires a microcontroller complex a PCB and a protective enclosure from scratch isn t a trivial task Many hours go into the mental design process before you spend days transforming your ideas into hardware All aspects of the new design must be thoroughly thought through Sometimes the
132. determined The interrupts on the temperature sensor driven lines would be used to access the value of a free running core timer This timing information can be processed to generate the temperature values We decided instead to use a single core timer driven interrupt rather than four PF driven interrupts During the timer interrupt routine we can determine the sense of the input sig nals and set the necessary flags to transfer between the main task states We also can count the number of interrupts between the various high to low and low to high transitions of the temperature sensors The counts would be sufficient as only a ratio of times rather than absolute times is needed to calculate the temperature We can guarantee sufficient precision in the time counts by having the timer interrupts occur frequently TIMER TESTS You d think setting up the Blackfin core timer would be a simple task You must place the required period reload value in the TPERIOD register and put the initial count in the TCOUNT register Next you have to set the TSCALE register This determines the relationship between the core timer clock and the 500 MHz system clock All that remains is switching the bits in the TCNTL control register so the timer comes out of Low Power mode the automatic reload feature is enabled and the timer is on Everything seems straightfor ward so why bother to write a test Listing 1 page 62 shows the
133. diagram of the com mand center with ground optical sensors The gate controller has a stepper motor interface and optical sensors for open ing and closing the gate see Figure 3c COMPONENTS BASIC Stamp 2 microcontrollers control the three electronic modules in the design the command center the truck and the gate controller There s a degree of overkill here Less powerful controllers can be substituted in but for quick and easy development I used an interpreter rather than a compiler The modules are equipped with a Ming Microsystem wireless transmit ter TX 99 and a receiver RE 99 pair which are distributed by Reynolds Electronics Operating at 300 MHz AM the transceiver setup is adequate for the short distances of the experi ment The transmitter requires a short 9 36 wire antenna whereas the receiver has its own built in loop anten na Both modules operate from 5 VDC drawing a meager 1 6 mA each The master microcontroller in the command center handles communica tion and monitors two ground sensors S1 and S2 which are reflective optical sensors for detecting the truck posi tion The microcontroller in the gate control monitors two slotted optical sensors to detect gate open gate close positions It also controls the stepper motor that operates the gate The microcontroller in the truck receives command center signals and sends back status data It also controls Issue 177 April 2005 To DE
134. e Prepare for next simulation state TI MER2 LOW STATE pTI MER2 PERI OD else __LEDstate amp TMP03 LOW MASK Output current simulated signal WriteOutputASM LEDstate Prepare for next simulation state pTI MER2 PERI OD TI MER2 HI GH STATE TEST MeasureTemperature AUTOMATEDTEST __SaveUserRegAndReset temperatureValue4 value Estabilsh the simulation environment using the signal from the pulse width modulated Timer2 signal to mimic the TMPO3 sensor register handler ik ivgll Simul ateTMPQ3_1 SR Acti vateOut put ASM ResetPFForl nput ASM may hang if correct functionality not environment will hang if output is not to test out status message puts Testing MeasureTemperature n for int count 0 count lt 4 count Set UpTi mer 2 TI MER2 LOW STATE Acti vateTi mer2l nterrupt val ue MeasureTemperature FAHRENHEI T DeactivateTi mer2l nterrupts Expected result is within 2 of 2 SHORTS CHECK abs val ue lt E signal est est rior ut iT present connected to input Iip ITP 272 24 RestoreUserReg im Taj RR wm ies Mn MTU dut ILE GU U CNG UE ULL UUU JHU 1 u ul _ f The USBea 2 and SX E capture and generate miliona of digital samples per trace letting you catch your in action meed to worry if the sample buffer ig boo small or the compression used is goo
135. e D ong Tandan Faatures BUS amp DOS SDM 12804 ash nick 3128 Thi arty in Date Logging SRAM 40 bhie CFU 16 digital bO apta rack inierface E 2 R5 712 2 imericnurmiers ample bos minare real timg chock Data nian B ch 32 bk ADC fash dks up in 238 1 RS 46 TEPP Slot mdi Tiny Sian Low Power x25 3 oF PUE m al full speed gi lowest speed Visi hip ware c om dor info prices and Plug Download m i Te end to end SORITO 4 BAGOTRONIC Stack 32 modules on simple asa laptop 2900 1 Crescent Drive les dene J Tallahassee FL 32301 the same 5 232 cable EHE sn50 942 7905 phone amp fax www circuitcellar com CIRCUIT CELLAR Issue 177 April 2005 93 INDEX OF ADVERTISERS The Index of Advertisers with links to their web sites is located at www circuitcellar com under the current issue Page Page Page Page 87 Abacom Technologies 37 Inc 91 Lemon Studios 89 R2 Controls 86 All Electronics Corp 33 ExpressPCB 63 Lemos International 58 Systems Inc 88 AP Circuits 64 FaabMedia Inc 2 Link Instruments 42 R E Smith 32 85 FDl Future Designs Inc 25 M16C Design Contest 19 27 Rabbit Semiconductor 7 Atmel 88 FieldServer Technologies 90 MCC Micro Computer Control 82 89 Rabbit Semiconductor 93 Bagotronix Inc 93 Front Panel Express 86 Mental Automation 25 71 Renesas 10 Beta Layout Ltd 92 Futurlec 72
136. e 1 step 1 Half sbit M1Clock do so If you want to do it remotely sbit 1 P0 2 7 Clock input PO 3 Enable Disable motorl control with a PC or without opening the box you can use a DAC to generate the reference voltage This requires you to add one DAC per motor There s one more option You can implement a DAC using a PWM If you can spare a few PCA channels or a timer this can be done in software We didn t do it because we were short on time Another significant improvement would be to incorporate microstepping To do so you must apply sine and cosine currents to the two windings of the motor This would require a dual DAC or two PWM channels for gener ating the sine and cosine voltages But the L297 device doesn t support sepa rate V uc input for each motor winding phase so you can t microstep with it You must replace the sequencer IC with an L6502 for microstepping and redesign the drive Stepper motors are often used in an open loop without feedback You may have an application in which you need to generate precise motion control A stepper motor can miss a step if it isn t 76 Issue 177 April 2005 sbit MlLiml 0 6 Limit sbit MlLim2 0 7 Limit def i def i def def i DI RCCW DI RCW HALFSTEP FULLSTEP ne Motor ne Motor ne H F ne 1 Hal f Full def i def i def XMOTOR 1 YMOTOR ZMOTOR 3 ne ne ne def i Run c
137. e camera and store it in memory to allow the entire image to be processed at once after it s captured However the amount of memory required for such a task can be large adding addi tional hardware to the system Finally after an image is processed the resultant data needs to be output so that some other computing entity can make use of it The post processed data typically contains the high level visual information extracted from the scene This user interface isn t nor mally going to be an actual user but this abstraction is a good way to think about the interface to the vision system AVRcam The AVRcam uses the OmniVision OV6620 CMOS color image sensor which provides a digital stream of pixel data see Photo 1 The sensor is available already mounted to a circuit board with supporting components and a lens in the form of the C3088 evaluation board The pixel data is pro vided in Bayer format which means that red green and blue pixels are inter leaved to generate a colorful image The OV6620 has a native resolution of 352 x 288 pixels It can be config ured to a lower resolution of 176 x 144 pixels This sensor provides the digitized pixel samples of each frame at a rate of 30 frames per second through two 8 bit data buses The sen sor also provides various timing sig nals needed for synchronization such as a pixel clock PCLK a horizontal www circuitcellar com Photo 1 The AVRcam measures 2 4 x
138. e immediate future A dif ferent approach is required for simu lating the expected external signals Listings 5 and 6 show two different approaches to this problem The test in Listing 5 involves manually setting up a known input hardware configura tion and then testing for the input It s straightforward but this approach completely defeats the automated testing procedure that s a major fea ture of the TDD environment Manual set up is just too inconvenient to be practical An automated test is programmed With Millions of Samples Find Bugs Fast Designed for Students and Hobbyists All in One Logic Analyzer Signal Generator Designed for Professional Engineers ul SBee Hu A All iri One Logic Analyzer Signal Generator Frequency Counter Frequency Generator I2C Monitor Control Remote Controller Async Monitor Data Logger Pulse Counter SPI Monitor Power Supply Toolbuilder Issue 177 April 2005 65 The new generation Scope for the age of microelectronics 8 Channel 40MS s Logic Analyzer gt j EN uu mdr r O ATE Ur cC iau 1E 1 na H i d DO on Ss i afer WIT rigger pattems 3 Input 100 Anz log 050 dis HL i E EET reg ik us Fs gn pi pron
139. e possibility of adapting the automated software component environment a typical software engi neering design process to generate or make easily available tests that can be used across a variety of platforms and design requirements TDD SUGGESTIONS We described how we added func tionality to a TDD environment to make it suitable for hardware and soft ware design in small embedded sys tems We demonstrated the system s capabilities through the design of our thermal arm wrestling game This system provides an automated test environment for embedded sys tems capable of handling standard code validation core timer operations including interrupts and basic I O The ADSP BF533 Blackfin microcon troller s numerous internal resources support the hardware side of the TDD We found that the current state of this TDD tool has made it easier to devel op and explain hardware based proj ects at the university level We are left with some questions though Is this approach practical for embedded systems with less internal resources than the Blackfin Can we www circuitcellar com develop a simple automated signal generator than runs on a second embedded system in response to sig nals from the system being tested Is our system unnecessarily complicat ed Are the issues we covered simply an indication that our TDD environ ment has moved out of its diapers and into the real world We d love to hear from you Any suggesti
140. eal COM port it s possible to get a reason ably accurate handle on the timing But a virtual COM port introduces a degree of uncertainty due to the fact the actual I O timing depends on USB scheduling beyond the control of your application I wrote a simple test program in BBC Data Bits Stop Bits Local Echo r haReading Flow Control Settings CTS Output Control DSR Output Control DSR Sensitivity Input Control DTR Control RTS Control Disable Disable z r Software Control Settings XON XOFF Output Control XONZXOFF Input Control Continue sending after XOFF sent Limit OFF Limit 0 0 Char m mr NENNT NE CTS v DSR RING v RLSD CD Hold OFF Hold TX Char TSP s me L Photo 3 The CP2102 includes a healthy amount of buffer RAM to support high data rates but take care not to overdo it In this case transferring a large file from a fast to a slow PC caused overruns on the latter Use hardware and software handshaking or lower the data rate to make the problem go away BASIC to demonstrate the difference see Photo 4 Refer to the London Calling sidebar page 84 for more information about BBC BASIC All the program does is sit in a tight loop tog gling the RTS line as fast as possible Sure enough probing with an oscilloscope revealed the real RTS line was switching about 100 times faster than the virtual one e g 20 kHz v
141. ease the supply voltage for the motor well above the product of the motor current I arep and winding resistance R The wind ing current will now peak to V R Decreasing the L R time constant of the winding and increasing the voltage applied across the winding increases the winding current slew rate To achieve a desired velocity profile a motor and drive combination must generate enough torque to accelerate the load inertia at the desired rates and drive the load torque at desired speeds The size of the bipolar motor generally dictates its low speed torque The ability of the driver to force cur rent through the windings of the motor dictates the high speed torque You can drive a bipolar stepper motor at its rated voltage using an H Bridge such as an L298 or one imple mented discretely using power transis tors Because the motor winding resistance is the only current limiting element you can t allow the Voc of the H Bridge to exceed the motor s rated voltage This puts an upper limit on the motor current slew rate as the www circuitcellar com time constant is fixed To overcome this limitation add a series power resistor to reduce the L R time constant of the winding and increase the motor supply voltage beyond the rated value This scheme generates an L R drive One disadvantage to this approach is significant power dissipation in the series resistance that affects the drive s efficiency Anot
142. ech com CRYPTOGRAPHY The strength of a cryptography implementation relies on the secrecy of a key not the employed algorithm However it s insufficient to assume that a large key size will guarantee security Even if a trusted encryption algorithm like DES or AES is used improper implementation could make the product easy to break You must have a complete understanding of the requirements and functionality of an encryption solution before it s imple mented in a system Many times com panies will claim to encryption in their product when in reality it s nothing more than a simple encoding scheme usually some type of logical operation like an XOR against a constant block Rolling your own custom encryption solutions is typically a bad idea because they end up being extremely insecure An example of improperly used Data Acquisition amp Control LA LE HCS 12 Motorola 68HCS12 P o ad Eod TS TE E E W Lr i 16 bit 50 MHz Processor New Report Layout Editor customizes reports labels a New Connection to mem QuickBooks 2002 2003 Pro simplifies accounting ius nao version only m New Multi currency for foreign suppliers eases exchange rate calculations Parts Vendors Visit www trilogydesign corm and download our FREE DEMO logy i www circuitcellar com JE NT Me 2K XP Or Call 800 280 5176 530 273 1985 Fax 530 477 9106 Box 22
143. echnologies 92 Elsevier Inc 88 Lawicel HB 92 Pulsar Inc 85 Zagros Robotics Preview of May Issue 178 ATTENTION ADVERTISERS Theme Communications June Issue 179 Net Radio Build an Internet Radio Receiver Deadlines Connect with USBLab USB 2 0 Interface Add USB to Any System Network GPIB Controller Theme Digital RC Servo Controller Part 2 Circuitry Details Measurement amp Sensors Three Axis Stepper Motor Driver Part 2 Software Implementation opace Close April 11 Material Close April 18 BoNus DISTRIBUTION USB Interface Development SENSORS Expo Call Sean Donnelly now to reserve your space FROM THE BENCH Speech Synthesis with SpeakJet 860 872 3064 SILICON UPDATE More Flash Less Cash e mail sean circuitcellar com APPLIED PCs Build a Wi Fi Web Server 94 Issue177 April 2005 CIRCUIT CELLAR www circuitcellar com High performance Low cost No sting Do you want to add networking to your embedded devices but keep getting stung by high product and development costs Echelon s embedded LONWORKS platform is high on performance and low on product cost and development time Our new Mini EVK gets you from design to delivery in no time and at very little cost isn t it time you found out why so many embedded system developers choose Echelon Call 1 408 938 5200 or visit us online at www echelon com mini to get started today ECHELON PRIORITY INTERRUPT by Steve Ciarcia Founder and Editoria
144. echnology Devices International FTDI for mov ing the USB to serial adapter forward Besides highly integrated chips which you ll find under the hood of many 48 MHz Data rate generator PWREN Dual port TX buffer 128 bytes PWRCTL 3 3 V LDO Regulator Dual port RX buffer 384 bytes Serial interface Transceiver engine SIE Channel B 128 bytes Dual port RX buffer 48 MHz 384 bytes 12 MHz 48 MHz EEPROM EECS Interface EESK RESET Data rate Generator 3V3OUT EEDATA Figure 2 FTDI started the USB to serial adapter chip craze Now they re upping the ante with the two channel FT2232C CIRCUIT CELLAR Channel A Multipurpose UART FIFO controller Multipurpose UART FIFO controller stand alone converters they deliver a royalty tree VCP driver They also sup port a direct driver option that comes with the requisite dynamic link library DLL and application program interface API In short FTDI bites the PC soft ware bullet i e maintenance support bug fixes etc so you don t have to FTDI latest chip the FT2232C incorporates a lot of features see Figure 2 Like earlier versions e g FT232BM it includes practically everything you need for a USB serial solution On the USB side of the chip you just need to provide a 6 MHz clock boosted to the 48 MHz clock USB required by an integrated PLL and a handful of discretes and power logic depending on whether yo
145. ecture Addison Wesley Boston 2000 R Martin ARMs to ARMs Circuit Cellar 1484350 Nov 2002 Jan 2003 Philips LPC2131 2132 2138 Prelim Datasheet rev 0 1 Nov 2004 Silicon Laboratories CP2101 Single Chip USB to UART Bridge rev 1 6 2005 SOURCES MCB2130 board and ULINK JTAG Keil Software Inc www keil com Visual Basic 6 0 Microsoft www microsoft com LM60 Temperature sensor National Semiconductor www national com LPC2138 Microcontroller Philips Semiconductors www semiconductors philips com CP2101 USB to RS 232 bridge Silicon Labs www silabs com www circuitcellar com Need Device Connectivity To The Pervasive Internet Based on experience can tell you zm 5 z that Rabbit stuff works before you oa udo s alt can get it all out of the box 4 z Fred Eady Circuit Cellar The Core of your Embedded System The PowerCore FLEX is a complete Rabbit microprocessor system with optional features such as a power supply Ethernet and a low cost rugged A D system It plugs into a motherboard you design You pay only for the options you need and we quickly manufacture n it Development Kits include a powerful software development platform and extensive libraries piy Configurable Features Microprocessor Speed On Board Power Supply SRAM Flash Serial Data Flash Ethernet Option Network and Internet Support Your embedded d
146. ep per motor The students are instructed to examine analog motor speed control and direction principles which necessi tates a discussion of H bridge operation and PWM control The trucks however www circuitcellar com only move forward in this simulation so a single MOSFET is fine and will employ PWM which is easily implemented in the microcontroller software by a single command The gate module uses a stepper motor I discuss with students the methods of driving steppers so they learn that a dedicated step per motor IC controller can ease the main controller s work This illustrates a simple example of hardware distributed processing a concept that s developed later in the course I cover other concepts too For instance I explain the principle of handshak ing and its importance in the process of sending and acknowledging commands between the modules Figure 2 All three modules include a BASIC Stamp 2 a small transmitter and a small receiver The truck controller has an additional MOSFET for turning the motor on and off a The command center has ground optical sensors b The gate controller has a stepper Students quickly realize the need for an agreed upon motor interface and optical sensors for detecting openings and closings c The truck approaching from the right crosses sensor 51 and initiates the simulation xr n x86 Embedded Processor Module Mity 5OC 1 386 Embedaed
147. er than the first into a Blackfin register etc or if we had had a different order of the parameters in the function proto type then the COUNT register value wouldn t have been destroyed by the period value This result indicated an unanticipated advantage in the Wat chData class the ability to spot WWw circuitcellar com EX INT IGNORE Doo undocumented features and changes between different releases of the board and other hardware FLAG TESTING Because of space limitations and processor specific characteristics of the code we won t explain how the core timer interrupt service routine ISR measures the temperature sen sors and switch positions Nor will we explain how to set up the code and DATA ACQUISITION GOING WI UHF MODEMS R 232 o ac r4 p a 900 MHz WIRELESS RF MODULES Transmitters Receivers Transceivers High Speed Long Range UHF Modems pa E Call Toll Free 866 345 3667 LEMOS INTERNATIONAL use the digital level programmable flags However the tests developed for these routines reveal the capabili ties limitations and potential of the TDD environment Listing 4 tests for the core timer ISR s basic functionality A software interrupt is issued using the r ai se procedure found in the standard C lan guage development A software inter rupt occurs each time around a loop The ISR is supposed to increment a known semaphore
148. er con nects to the MCB2130 debug connector and communicates directly with the ARM 7 core inside the LPC2138 via its EmbeddedICE logic see Photo 1 The typical debug options are avail able in pVision3 Single stepping watch windows break points and memory snooping are all possible with the LPC2138 An interesting item in the pVision3 IDE is the ability to interact with LPC2138 peripherals while the program is idle A separate GUI can be opened for the various LPC2138 peripherals that allows for interaction and control of them Things like manually scanning the LPC2138 s A D converter and flipping of one of its GPIO bits are possible A cou ple of the windows are shown in Listing 1 The C function from the LPC2138 takes care of reading the LM60 temperature sensor via its on board A D converter The data is then sent out the serial port to the PC running the Visual Basic application void tc0 void irq static char unsigned int LedFlag 0 AtoDVal ue Ti mer 1 second at for executes CPU clock counter 0 interrupt 60 MHz testing purposes if LedFlag 0 1151 toggle the on board 28 ED for OSETILI LedFlag 1 else OCLR1 LedFlag 0 0x00010000 0x00010000 ADOCR 0x01200000 do AtoDValue ADODR while AtoDValue amp 0x80000000 ADOCR amp 0x01000000 AtoDValue AtoDValue gt gt 6 printf A d n Ato
149. ersus 200 Hz The oscilloscope session also served as a cautionary tale that has nothing to do with the CP2102 directly but rather the RS 232 interface I noticed the voltage swing was twice as high on the RTS output from the PC e g 10 compared to the output from the USB Issue 177 April 2005 83 bus powered RS 232 transceiver on the CP2102 board e g 5 V I didn t have any problems myself but it isn t hard to imagine scenarios cabling noise using an RS 232 line as a power source in which the difference could lead to glitches and head scratching JUMPSTART Chips like the CP2102 minimize the pain of upgrading your application with USB connectivity Yes you could just stick with RS 232 and rely on users to buy their own USB to RS 232 con verter dongle That may seem like an easy way out but does it really make sense Consider the fact that by the time you add an RS 232 transceiver and DE 9 con nector there will be little if any cost London Calling size or power consumption advantage compared to a USB to serial adapter chip and connector the latter is optional as with a USB keyboard or mouse Presenting a USB only face to the world also gives your design the credi bility associated with products from major players who have the wherewith al to roll their own USB solution It also delivers cross platform plug ability e g PC Mac Linux etc that a serial or parallel solution can t Fi
150. es on the circuit board level Many of the weaknesses security vulnerabilities and design flaws of a product are identi fied when you analyze the circuit board There are a number of things you can do to make attacks against a prod uct more difficult To help you under stand what you re up against I ll describe a few successful hardware attacks By studying such attacks you ll learn how to improve your products CIRCUIT LEVEL ATTACKS Basic circuit board level attacks range from the modification of microprocessor content to the replacement of compo nents More advanced attacks involve microprobing i e a chip package is opened its internals are accessed with semiconductor test equipment and the internal data paths are observed or manipulated or fault generation attacks in which the device operates under environmental stress conditions outside its designed operational range e g extreme temperature supply voltage variations and spikes protocol violations and partial system resets 34 1 177 April 2005 Nothing is ever 100 secure No matter how many layers of security you use a determined attacker can under mine your product As gloomy as this sounds your challenge is to figure out what you need to protect in your product and how much it s worth to protect it REVERSE ENGINEERING Reverse engineering a product usu ally requires knowledge of the part numbers and functionalities of the maj
151. es the expected four writes to the timer registers together with an additional reading of the timer control register to capture its initial value that wasn t taken into account during the initial test design Because the initial test was developed when only four reads and writes were planned the test macro must be rewritten to CHECK coreti reg getReadsWr ites 225 to meet the true Set CoreTi mer function require ments The test and code match per fectly after this change Or do they Listing 3 shows the test some students wrote as part of an assignment using TDD to validate their Set upTi mer routines Much to our embarrassment our code didn t pass that test Can you spot the difference between the tests More importantly why did our code pass our test and fail the students The students test was a better test We used the same values for both the PERIOD and COUNT registers A developer could have switched the values when writing to the core timer registers That code would ve passed a 62 Issue 177 April 2005 Listing 1 The test for the Set upCoreTi mer ASM function is straightforward Three known parame ters pass into the function for direct placement into the core timer register A fourth constant value is placed in another register However the students revealed a fatal flaw in our test define define define SCALE 0 PERIOD 0x2000 COUNT 0x2000 typedef ulong unsigned long int TEST Te
152. esent and a problem arises The need for features such as error checking checksums and CRC becomes apparent even though our basic sim ulation doesn t include all of these niceties SIMULATION Let s take a look at how the entry simulation works As a truck approaches a closed gate a ground sensor tells the command center to send a wireless signal to the truck to stop it The truck stops before the gate and signals its status to the command center which then signals the gate control to open the ICOP Technology Inc Tek 626 444 6666 Email URL infociicoptech com wwvricem m icor us for cusiem desigs amp OE HDA senrices WWW circuitcellar com CIRCUIT CELLAR Issue 177 April 2005 29 gate It then waits for the gate control to indicate that the gate is indeed open After receiving a gate open signal the command center tells the truck to proceed forward After the truck pass es the gate it triggers another ground sensor which is monitored by the command center This indicates that the vehicle is now safely inside the gate The command center then tells the truck to stop and it informs the gate control to close the gate The experi ment is over after the control closes the gate and informs the command center Figure 2 shows the apparatus and con nections Figure 3a is a schematic of the truck controller with a single addition al MOSFET for turning the motor on and off Figure 3b is a
153. essones Motors Heal Sinks Terminal Strips L E D S Displays Fans Solar Cells Buzzers Batteries Magnets Cameras Panel Meters Switches Speakers Peltier Devices and much more www allelectronics com Free 96 page catalog 1 800 826 5432 Low Cost CAD Software For Windows 98 XP NT 2000 e Circuit design package with schematic entry circuit board layout with autorouting and simulation for only 3599 Buy modules starting at 149 SuperC AD SuperPCB mentalSPICE amp SuperSIM Encyclopedia of Electronic Circuits on CD with 1000 electronic circuits including schematics and design notes Vol I amp II each for only 99 Contact Mental Automation at 233 858 8104 http www mentala com Tiny yet Linux capable fast SORAM HE LHI Ethernet fMHe Coldfsre MCI 3 serial parts RSZ32 1 4 MB memory CAN port SD cand socket i IGB LCEVKPD pont EclipseC DT dev em senal debugger incl 22 lO pins amp capabilities to Dum www steroidmicros com www circuitcellar com Build It Yourself Robotics Development Kit Great for Robot The Roboflas Sumo Competition Development D Kit offers an NA Inireduetion include a to the world of f robotics for both Respond to A beginners and if Remote Cua a i advanced robot Use code 05 to get s FREE Batteries for your tek For more information request a free copy of our brochure today Soles 2
154. essor have properly configured the registers of a peripheral In practice this test class proved to be much more utilitarian It s a test that might be useful if you know exactly what needs to be done but you re distracted by an interruption in the mid dle of the creative process Used in this way it s probably better called the AVOI D LSD ERROR test class where LSD stands for the little stupid details that waste time Finally Ti mer class provides a series of timing utilities and a test The first permits a measurement of the execution time of a MEASURE EXECU TI ON TI ME Func pars macro The second is an actual test called WWw circuitcellar com MAXTI ME ASSERT Func pars which determines whether or not a function satisfies some strict real time test This is the first of a series of functional and nonfunctional tests for embedded systems planned for devel opment An example of a nonfunc tional test is MAXPOWER ASSERT which is used to determine as a design requirement whether or not a given algorithm meets the specific power restriction designated by a customer The proposed t i and Wat chDat a classes are conceptually general but they must be implemented specifically in order to meet the available resources on a given processor At the same time they mustn t restrict the normal devel opment of code The hardware watch point unit on the Blackfin processor can determine the number of reads
155. ever heard about Moore s law What kind of processing improve ment have we seen since 1965 A million times just read that disk drive capacity alone has increased over 400 000 in the last 15 years Rechargeable battery capacity energy density has increased just 300 in the same period of time All the great features we want in portable devices aren t missing because of a lack of technology It s just that the available battery power can t handle their present level of electronic integration Battery design is fundamentally an issue of chemistry Battery technology hasn t changed much because the periodic table hasn t changed either Every time you start your car keep in mind that it s using basically the same lead acid battery designed by Gaston Plante in 1859 All those NiCd batteries used in your power tools trace back to discoveries by Waldmar Jungner in 1899 Talk about a slow evolution Energy density improvements in recent years are primarily the result of fiddling with the zinc copper lead carbon nickel cadmium mercury lithium soup to tailor specialized power curves The good news is that Li ion batteries have made many of the devices we use today a reality simply because we finally have enough power to run them The bad news is that we may not be able to tweak the chemistry much more Conventional battery technology might still improve but that will take a long time and it will never result in the magic bullet that gadget manu facturers reall
156. evice can network and serve web pages Hardware and software supports Ethernet Wi Fi and cellular telephone data networks TCP IP and most associated protocols are included in the Development Kit SSL secure server software and other un A D Converter system premium software modules are available at a nominal cost With the Battery Backed SRAM implementation of optional software modules such as RabbitWeb S5L PPP and AES you can securely and conveniently communicate with your embedded device from anywhere in the world Standard Features 39 General Purpose 1 0 Development Kit Includes SSH A loaded PowerCore FLEX with all options or non Ethernet low end version Real Time Clock Watchdog Supervisor wi Prototyping board with pt Pervasive Internet Embedded development area E i pre devices providing internet Documentation on CD Dynamic C integrated development environment Serial cable power supply and more connectivity for commercial and industrial applications Learn more at www powercoreflex com xcludes Dynamic C IDE and hardware serito m i 11 i i T 4 mum Pam f Embpe ys er Ilem pb ER E LE f D n ar ce CUM Eom NN RABBIT ENERSGEBBSUL maf 11 TEEI 530 757 2400 FEATURE ARTICLE by Peter Gibbs Automatic Gate Control Peter s automatic gate control simulation
157. f this must take place in 16 clock cycles Needless to say there isn t a cycle to spare in the routine Getting the routine www circuitcellar com exactly right took me several weeks of plotting which included a change in the hardware to remap which pixel data bus was connected to which I O port on the ATmega8 The complete source code for this function is shown in Listing 1 page 16 This routine uses a novel algorithm for mapping individual color channels to a particular color in the color map Typical implementations use a large look up table in which the indi vidual channels form an index into a color table to extract the actual color represented If this solution were used a look up table containing 2 entries or 4 KB would be required Considering the ATmega8 has only 1 KB of RAM this solution isn t feasible The algorithm I used required only 48 bytes of pre cious RAM to provide a map that deter mined if a combination of red green and blue map into a trackable color SEEING IS BELIEVING In addition to the AVRcam Fighting against your PCB Design Software Here s something that will spare your time and your budget Boards designed under EAGLE are found in patent monitoring equipment chip cards electric razors hearing aids automobiles and industrial controllers They are as small as a thumbnail ar as large as a PC motherboard They are developed in one man businesses or in large industrial
158. ftware 3 weeks Delivery wisolder Mask Tools not included UL Approved MYLYDIA INC 1 800 Mylydia sales mylydia com www mylydia com CC Micro Computer omrol etr O OEM a Boards drivers relays 104 CompactFlash LCD DSP motion E control 30 UARTS 300 1 05 Custom board design Save time and money PONY 1724 Picasso Ave Suite A Davis CA 95616 USA TE zi INC Tek 530 758 0180 Fax 530 758 0181 www lern rom e Your source for Design amp Mfg At i AL J iE C 1L ERASER Services ehe tal AL SKATROXF B Tiri ny Frea s niter fa tima ur NUN v Schematic Capture PCB Design 2 DIP 15 v Rapid Prototypes Fab and Assembly EeRom 8U 495 F talag war Mi Fas coves pit Der mm n Boi 05715 EPROR Flash Eriak Lower V oae Bed 1664 ind 22 rera spi YRT 0S s C e C ASM s Basic Y PowerPCB e OrCAD Allegro High speedy LEE part Fig pee 3333 Lire e budl n BM SAAN 7 Erg Havre cwm is nsec PT rubra USB Interface d nt adul sry fs Reliable Fast Work e Free 3 I ER aver any t Fa ds Quotes Guarantee Lit ERASER mna aticani Moged Fari Lass Haid 3 LABT 110 3x iiie com TN m 115 gringo pe 4e LOO VNISOURCE DESIGN 46 TROOPS fa Pn
159. ge coupled to a stepper motor Resistors R1 through R6 are current limiting resistors for driving the LED inside an optical interrupter used as an end limit detector Alternatively they act as pull up resistors if you have www circuitcellar com mechanical end limit switches An RC circuit R7 and C13 debounces the mechanical limit switches The 24 01 IC6 is a 128 byte serial EEPROM into which the firmware stores the configuration information Because IC1 doesn t have a hardware serial port the interface is implemented in software You can make motor power supply connections with the CN7 connector You can use any unregulated power supply between 12 and 35 V for the motor We prefer an SMPS as an efficient compact alternative to the linear power supply We used the Flash Magic freeware utility to program IC1 through the RS 232 serial interface You must place JP1 in the 2 3 position and push the reset switch This invokes an on chip boot ROM on Flash Magic handles the protocol for downloading the Intel hex format executable file to the on chip flash memory It also enables you to pro gram the security bits that protect your code The utility supports in circuit pro gramming ICP and in system pro gramming ISP for most Philips MCUs MOTOR CONTROL You can drive the motors with the aforementioned hardware You need a user interface to control the motors from a front panel Most of the
160. har unsigned char char limitz0 Switch motor case XMOTOR ne MEDI UM SPEED DELAY motor one step in current RunMotor char motor d MEDIUM SPEED DELA i f else DIRCCW limit ReadLi ml motor limit 0 return 0 1 MEDIUM SPEED DELAY while d return 1 CIRCUIT CELLAR SW SW dir dir step step Define constant Define constant Define constant 180 Len tch2 counter clock wise clock wise S S ection ection indi cate XMOTOR indi cate YMOTOR indi cate ZMOTOR to to to Delay between clock pulses direction 14 GetMotorDirection motor ReadLi m2 motor E D 1 D 1 selected reached S limt Medi um speed ndi cates 11 Code for XMOTOR DIRCW limit specified delay for a delay Operation success Continued www circuitcellar com Listing 1 Continued break Rotate motor for N steps unsigned long RotateMotor char motor unsigned long int NumOf Steps unsigned long int unsigned int k for c 0 lt NumOfSteps c if RunMotor motor 0 return c Listing 2 This code fragment is for the LCD and matrix keypad controller implementation using the P89C2051 microcontroller With this code you can connect the keypad and display to any microcontroller with a three wire serial interface include lt 51 h gt typedef void
161. hat pin is that beginner it s easy to harness the power of the Micromint AVR bricks Photo 4 Accessing the Micro64 s external SRAM is extremely simple after you ve got the hang of using the pointers Both the CodeVisionAVR and BASCOM AVR compilers are easy to use and loaded with tools to make your project design flow smoothly retrieve your resultant data You can easily navigate and use any of the Micro64 built in functions For instance the PC send byte and receive byte functions Ox7CB8 and Ox7CDD respectively utilize the function reserved SRAM address of OxOFFB as the holder of the PC slave address with reserved SRAM location OxOFFC carrying the PC data The call to the PC function is performed in an identical manner to the function calls I ve described for reading and writing the RTC The idea is to provide a sim ple interface to the Micro64 s enhancements LAYING BRICKS You probably noticed there s a Micro128 brick in Photo 5 that s based on the ATmegal28 The 128 operates in the same way as the Micro64 however the Micro128 s program memory space is doubled along with the doubling of the Microl28 s EEPROM memory space Of course calling the functions is no different from what I ve described But the function call addresses will be dif ferent for the 128 All the differ ro54 Micro128 Bootloader V 1 0 rg pm Pm ettings Info C i 128 Com Port Selection AVR Based
162. he emporium and you ll see that s exactly what s hap pening look for the PictBridge logo Remember that the original success of USB was only by virtue of a huge up front investment by Intel They put USB connectors on the mother board long before there was much of anything to plug in That made sense for Intel because it made PCs easier to use more sales more add ons less support Oh yeah because they don t make the gadgets that plug into USB the commoditization of add ons was no skin off their nose So who s going to volunteer to drive USB OTG Given its goal to eliminate the PC as a middleman I doubt Intel will be leading the charge What other valiant supplier will take the risk of being first and maybe last on the block And of that short list who has the muscle to move the market Think I m being overly pessimistic about OTG Well check out the mar ket predictions in Eric Huang s USB On The Go Overview which was presented at an August 2004 USB training seminar see Figure 1 www circuitcellar com The OTG projections look rather yawn inspiring if you ask me KEEP IT SIMPLE Rather than spending time on tomorrow s problems of tomorrow I m more interested in ways to get a simple not to mention home brew gadget hooked up to USB today preferably with a minimum of muss and fuss One option is to use one of the many USB enabled MCUs as the basis for your design The good news is th
163. he remaining memory thus gaining complete access to the once protected area This is achieved by raising V to 0 5 V approximately 13 5 V during repeated write access to the security 016 8 An attacker also can passively mon itor the power supply fluctuations to determine information stored on a device In Introduction to Differential Power Analysis and www circuitcellar com Related Attacks the authors describe the process of monitoring the electri cal activity of a smart card and using mathematical methods to determine cryptographic keys Simple power analysis SPA is a predecessor to DPA in which an attacker directly observes a system s power consumption which varies according to the operation the microprocessor s performing Intensive operations such as cryptographic functions can be easily identified Although SPA attacks primarily use visual inspection to identify relevant power fluctuations DPA attacks use sta tistical analysis and error correction techniques to extract information corre lated to secret keys In Power Analysis Attack Countermeasures and Their Weaknesses Thomas Messerges looks at five countermeasures to pre vent such attacks including a noise generator using power randomization power signal filtering using active and passive filters detachable power sup plies and time randomization by desyn chronizing the clock He discusses the pros and cons of each Parts List Soffware
164. her approach involves using a chopper drive by applying Voc V4 gp With a feedback driver switch ing the H Bridge to hold the winding current at the rated value A low value resistance in the H Bridge s ground lead converts the winding current into pro portional feedback voltage This feed back voltage is compared to the refer ence voltage in a control loop When the feedback voltage is less than the reference voltage full supply voltage is applied across the winding When the feedback voltage is equal to the reference voltage the winding is short circuited to reduce the current This chopping action limits the value of peak current to a level determined by the reference voltage and thereby improves the drive efficiency to better than 75 A single IC e g L297 con tains all the electronics needed to real ize a chopper drive MCU SUPERVISOR In principle you can drive a stepper motor via push buttons that provide manually controlled clock and direction signals Adding an MCU gives you preprogrammed precision motion con trol at the click of a button A low cost 8 bit microcontroller with enough inte grated memory and peripheral devices will keep the project within our budget Choosing the right development tools for the code is equally as important We chose Philips s PS9C51RD2 for a number of reasons Most importantly it has 64 KB downloadable flash mem ory and 1 KB data on chip memory This enables you to build a
165. imum and maximum positions can be set and stored in nonvolatile memory The angular resolution of a typical servo is of roughly 0 7 out of a 90 range or 7 bits because of the built in dead band of approximately 8 us that s www circuitcellar com needed to reduce mechanical oscillations servo chatter This means that 8 us is the smallest practical posi tional increment in a pulse width command On the other hand the absolute servo position ing accuracy is affected by the mechanical back lash and material prop erties The newer digital servos claim a resolu tion of up to 10 bits or 0 09 1 to 3 us dead band at the expense of higher power consumption The trick for a lot of beginners is to figure out how to actually generate the PWM signal to control one or more ser vos simultaneously A microcontroller is usually part of the solution Most new MCUS have a dedicated hardware PWM capability but they re commonly limited to one to four channels Also because the useful pulse control range of the PWM waveform in the specific RC servo application is only 1 ms out of 20 ms i e 5 of the full scale PWM range you get limited effective output reso lution For instance a dedicated PWM module in an MCU using an 8 bit count er would only provide an effective PWM output resolution of 12 steps 256 x 5 or 4 bits instead of 8 bits The generic PWM module is designed to cover a full range of 20 ms with 8 bi
166. in gerprints for identification purposes But those little valleys and ridges are more than identifying marks they play an important role in your sense of touch Take a sharp object like a pin 48 Issue 177 April 2005 Meissner s corpuscle Merkel disk receptor Hairy Glabrous skin 7 EK Wh x i i Te r x E i his i n 4 _ pu Pacinian GEN I N PX Peri heral corpuscle Figure 1 The sense of touch comes from two types of nerve cells Merkel cells and Ruffini endings respond to pressure Meissner and Pacinian corpuscles respond to vibration Both types are found beneath the glabrous skin of the body please play carefully here and lightly draw it across your finger pad Can you feel each time the pin rubs over one of those tiny ridges It s just like scratching a phonograph needle over a record s grooves No this won t work on CDs although they will skip if the surface is scratched but that s another story Not only do fingerprints help detect movement they also aid in judging speed Wouldn t it be nice if your favorite robot had a similar sen sitivity In this column 111 introduce you to Peratech s quantum tunneling composite QTC technology I used it in a Heathkit Hero robot project ROBOTICS Intelligence alone does not a robot make Robotics projects depend on the synergy of I O functions and intelligence Yo
167. ion in whole or in part without written consent from Circuit Cellar Inc is prohibited 4 Issue 177 April 2005 CIRCUIT CELLAR www circuitcellar com To meet the July 1 2006 deadline for the Restrictions on Hazardous Substances RoHS Directive many fabricators scrambling We build lead free PCBs to withstand the for solutions They may be making promises demanding high temperature lead free but are your suppliers simply standing still assembly process We are the first fabricator to address the issue of reliability through the high temperature lead free solder process both in the lab and in the field We offer quickturn and volume production of standard technology and high technology lead free printed circuit boards proven to withstand up to 2000 cycles of 45 C to 145 C For lead free boards to be reliania NN HM undc protoss 800 763 Sierra Proto Express i is located at 1108 West jte Sunnyvale 94086 USA April 2005 Robotics FEATURES O 12 AVRcam 44 Digital RC Servo Controller Part 1 A Low Cost Embedded Vision System 32 Channel Design John Orlando Eric Gagnon Atmel AVR 2004 Design Contest Winner Atmel AVR 2004 Design Contest Winner 20 Simple USB Data Acquisition Practical Application for TDD Part 2 Bruce M Pride Automated Test Driven Environment Mike Smith Moreno Bariffi Warren Flaman Adam Geras Lily Huang Andrew Kwan Alan M
168. is 6 mm x 3 76 mm x 3 9 mm h The WEEE compliant sensor is a restriction of haz ardous substances RoHS device It meets JEDEC level 4 standards and are available in a lead free surface mount style package The sensor is designed for IR reflow solder ing with a peak temperature of 260 C therefore it s suit able for lead free solder processes Pricing in 50 000 piece quantities starts at 75 per 100 pieces Vishay Intertechnology Inc www vishay com 2 Channel 80 MHz Digital Storage Oscilloscope 16 Channel Logic Analyzer Synchronous with DSO Arbitrary Waveform Generator 2 Programmable Power Supplies 2 Programmable Clocks Powerful PC User Interface Program Probes Cables ELAB 0B0 www ovnoninstruments com Woodinville WA 98072 425 402 0433 8 Issue 177 April 2005 www circuitcellar com CIRCUIT CELLAR Get your design skills ready Coming soon ARM Design contest 2005 LPC213x 32 bit ARM7TDMI S microcontrollers We ve squeezed more in so you can get more out 60 MHz operation 54 MIPS from both User code security on chip Flash and SRAM Real time Debugging amp Trace Two UARTs two FC one SPI and one ISP IAF Parallel Programmer Support SPI SSP interfaces Tiny packages HVOFN64 9 x 9 x 0 85 mm B channel 10 bit ADC and 10 bit DAC OFP64 10 x 10 x 1 4 mm Ease your migration to 32 bit performance with Philips LPC213x microcontrollers The industry s fa
169. it In terms of image processing I was interested in being able to track multi ple objects of different colors in real time defined as 30 frames per second which is about as fast as the human eye can perceive a change This would allow my robots to map their world according to specific color codings I also wanted to be able to take full color snapshots with the system in order to evaluate its surroundings In addition to the requirements of a Imager Computing User Sensor element interface Figure 1 A generic image processing system must be capable of sampling an image processing the image and providing the processed results to the outside world CIRCUIT CELLAR generic image processing engine I wanted the system to be inexpensive easy to build and easily expandable so I could add new features as needed I also wanted to be able to do the majori ty of the software development in a high level programming language such as C This would allow me to test algo rithms on different platforms before moving to the target hardware Finally I wanted to be able to program the system in circuit so that I could easily test new ideas And thus the AVRcam was born VISION SYSTEM SYNOPSIS A vision system is typically a sub system of a larger entity thus taking the burden of the computationally intensive image processing task off the main controller The purposes of a vision system are to sample and process images an
170. k ing on embedded systems control apps he enjoys long distance swim ming He recently swam across Lake Ontario in 18 h 40 min You may con tact him at pgibbs uwichill edu bb PROJECT FILES To download the code go to ftp circuit SOURCES BASIC Stamp 2 Parallax Inc www parallax com cellar com pub Circuit_Cellar 2005 177 SAA1027 Stepper motor driver Philips Semiconductors www semiconductors philips com RX 99 and TX 99 RF modules Reynolds Electronics distributor www rentron com DOWNLOAD our free CAD software exbresspcb com CIRCUIT CELLAR or four layer PC board _ SEND us your design with just a click RECEIVE top quality boards in just days d Issue 177 April 2005 33 FEATURE ARTICLE by Joe Grand Embedded Security Design Part 2 Circuit Board In the first part of this series Joe described superficial design solutions that will help protect your embedded products This month he sheds light on security issues related to the circuit board He s got your entire design covered W ass back Last month I described security related design solu tions for your product s enclosure My goal was to help you understand and mitigate some of the risks associated with attacks against your product Designing the right enclosure can pre vent tampering and reduce the possi bility of passive attacks This month I ll peel back a layer of the embedded system and describe security issu
171. l Director Dead as a Doornail T average person these days has dozens of portable devices We ve got radios laptops cell phones flashlights cameras navigation sys tems iPods PDAs LCD TVs DVD players etc Let s face it We live in a gadget happy universe As much as we might want to deny it we love the whole idea that science fiction is fast becoming science reality Take cell phones as just one example Personal communicators were bare ly thought of 20 years ago but today you can have a cell phone with a 0 5 megapixel color view screen and features scheduling word process ing GPS navigation and mapping FM radio a web browser a TV receiver an MP3 player a digital camera a video player and a voice recorder Cell phones are fast becoming the Swiss Army knives of our electronic universe Of course these feature laden devices are a great idea until you turn on a few of the functions and the batteries die after about 10 min How many times has your laptop s battery icon claimed it has say 3 hours and 41 min left but an hour later little flashing things start appearing on the screen warning you of a low battery and imminent shutdown The manufacturer of the laptop neglected to tell you that the 4 hour battery life drops 30 if the screen is on so you can actually read it and another 50 if the Wi Fi is running the only reason you bought the laptop Battery technology is the one critical part of our electronic universe that n
172. le com cci litm Tel 1 877 674 7527 PLC apecialisi since 1993 1B8 processors 33 MHz Wi ye DOS w Flash File system 44 Digital VO fines w CPLO Console Debug Serial Fart 17 341 DC or 5V DC power 2 Serial Portes a Accepts BMA DiskOnChip 2 16 bit Timers 312K DRAM amp 512K Flash Watchdog Timer Expansion options with Peripheral Boards 1 Flashliita 186 cornirodier Borland C C ver 4 52 FREE Email Tech Support ov astern Serial Driver library i AC Adapber and cable 530 297 6073 Email sales kmicro cam On the web al www jkmicro com JK microsystems It writes your USB code NO Need to be a USB expert HIDmaker 399 creates ready to compile PC amp PIC programs that talk to each other over USB Choose your favorite languages PIC Pic Basic Pro CCS Hi Tech MPASM PC VB6 Delphi C Builder Single chip solution PIC with built in USE SYSTEMS ino Issue 177 April 2005 HIDmaker Test Suite 149 USBWatch shows your device s USB traffic even during enumera tion without expensive equipment AnyHID Test any USB HID device See what data it sends even what the data is used for 301 262 0300 WWW TraceSystemsinc com CIRCUIT CELLAR Electronic and Electro mechanical Devices Parts and Supplies Wall Transformers Alarms Fuses Helays Opto Electronics Knobs Video Accessories Sirens Solder Acc
173. le stor age areas may yield temporarily stored system data or other useful informa tion e g cryptographic keys or plain text left behind from an encryption routine In Data Remanence in Semiconductor Devices Peter Gutmann shows that it s extremely difficult to securely and totally erase data from RAM and nonvolatile mem ory This means that remnants of such data still may exist they may be retrievable from devices long after power has been removed or the mem ory contents have been rewritten Issue 177 April 2005 Temperature also plays a role in the retention of data but the retention time is unpredictable even between two of the same memory device Unfortunately there aren t many practical solutions to avoid the known problems The current best practice is to limit the amount of time that criti cal data is stored in the same regions of memory Storing data in a fixed RAM location can lead to burn in that will enable data recoverability even if power is removed from the volatile device Either move the secret around to different RAM locations while over writing the previous area or periodical ly flip the stored bits of the secret PLDs amp FPGAs Depending on the product protect ing your intellectual property inside programmable logic devices PLDs and field programmable gate arrays FPGAs can be just as important as pro tecting firmware and data in memory Essentially SRAM based device
174. lel contacts with several QTC Pills located along them I originally wanted to use sen sors on the inside of both gripper fin Programming header SPI communications discrete output 1 von vss GP4 GPi 1 12 675 Figure 4 The use of a surface mount processor enables you to construct the Metal contacts with packing tape layers Wire connections Double sided foam tape with hole punched Rubber skin Peratech Pill Double sided foam tape Cross section of robot s finger Packing tape sandwich sticky sides together Hole punched Metal contact in top packing tape Figure 3 The lower drawing shows the prototype sensor based on the Hero s gripper dimen sions The top drawing shows you how the sensor is mounted on the Hero s gripper finger gers in order to detect the pressure placed on an object between them After looking at the gripper I realized I need ed to sense only one side of its finger I decided that the second sensor would make more sense on the gripper s fin gertip sensing the complete closure of the gripper Knowing when the grip per is completely closed indicates when an object is too small to grasp unless the gripper tips are used Photo 5 shows the sensor I made using clear packing tape to position and seal the contacts Using a paper punch in the top piece of packing tape I posi tioned holes over the contacts where the QTC Pills were to be located
175. ler see Photo 1 The MCU reads the temperature sensor s analog output voltage via its ADC and sends the reading via its UART For this particular application I used the board s serial port circuitry RS 232 transceiver and connector expansion connector for hooking in the tempera ture sensor and power input connec CP2101 EB Board Ji J3 GM CP2101 LM60 Temperature sensor Figure 1 Where does the power come from The USB is used for more than just commu nicating with the PC it s also used to power both boards which enables you to remove those ugly black wall warts The schematics are posted on the Circuit Cellar site CIRCUIT CELLAR MCB2130 Photo 1 used a Keil ULINK JTAG debugger to in cir cuit debug and program the LPC2138 microcontroller soldered an LM60 temperature sensor to the prototyp ing area of the MCB2130 board tion One of the board s neat features is that it s powered from an on board USB connector This means you don t need a clunky wall wart to power the sys tem You can just run another USB line to it for power This is a definite advantage to using USB as long as your board doesn t draw more power than the USB connection can handle The Silicon Labs CP2101 evaluation board contains the CP2101 USB to UART bridge chip and an 5 232 trans ceiver This allows you to plug in an RS 232 communicating device on one side and a USB communicating device on the othe
176. level shifter con nects the board to a standard RS 232 PC serial port CIRCUIT CELLAR fixed code timing loops and precomput ed lookup tables Most exhibit addition al limitations For example by turning off system interrupts the UART which must also process serial commands has to be polled during the dead time between the periodic pulses This usu ally restricts the maximum data rate Finally the third category of RC con trollers on the market positioned at the higher end of the spectrum includes those with more than 16 channels using hardware based PWM generation One notable example is the New Micros 25 channel ServoPod which uses a DSP with internal dedicated hardware PWM generation I ll introduce you to a novel FPGA based approach belonging to the third category It s a true 32 channel hardware based PWM generation unit under the tight control of an MCUthat s responsible for all higher level functions SYSTEM ARCHITECTURE One of the best ways to generate jitter free accurate synchronized multichannel PWM signals is through a hardware implementation Figure 4 depicts the overall circuit A Xilinx FPGA contains an internal array of 32 inde pendent PWM generation units each tailored to gen erate a 0 5 to 2 5 ms pulse at 12 bit resolution 0 5 us and 16 bit timing accuracy Each of these channels is dedicated to the control of one servo A www circuitcellar com small Xilinx flash program memory is u
177. lmost metallic conduction is achieved with sufficient pressure Table 1 shows how using carbon or metallic particles in the composite changes the material s properties The compression of carbon based composites enables carbon particles to come in contact with one another resulting in conductive pathways The metal particles in QTCs don t touch they re just extremely close In fact they re so close that quantum tunnel ing is possible between particles Quantum tunneling is the effect by which a free electron within a conduc tor passes through an insulator even though it doesn t support free elec trons Based on a constant electron energy level compressing the QTC material essentially reduces the insu lation barrier This allows some elec trons to tunnel through Conversely electron tunneling can occur for any given unstressed QTC if you raise the applied voltage electron energy Stress on the QTC material pro duces a resistance change that s an inverse exponential function of the applied force Actually the way in which the QTC material is com pressed affects its behavioral curve because external compression in one Photo 5 You can see the conductors inside the clear packing tape sandwich Holes punched in the upper tape allow a QTC Pill to make contact with the conduc tors Double sided foam tape on the fingertip shows how a QTC Pill is held over the conductors 50 Issue177 April 2005 direction distorts the
178. m things like system setup real time diagnostics and tests Besides these benefits your end user or cus tomer will have a more professional user friendly interface to work with After thinking about ways to combine all of this in a single project I decided to build a simple USB data acquisition project The system collects tempera ture data from an analog temperature sensor and graphs it via a PC GUI Everyone wants to collect data of some sort tempera PC with VB ture in my case And what GUI better way than over USB via an ARM based micro controller Of course tak ing the data and doing something with it is also an important part of the process so I ll show you a PC GUI By the end of the 20 Issue 177 April 2005 article you ll be able to create your own simple USB data acquisition device Most importantly though you ll know how to develop with an ARM based microcontroller how to use a USB to UART bridge and how to make a PC GUI to tie it all together SYSTEM OVERVIEW I usually design my own boards but for this project I used a couple of evalu ation boards to implement my minimal USB data acquisition system The boards are readily available so a hardware design isn t required to get up and running The system is comprised of two boards an analog temperature sensor and a PC running the GUI see Figure 1 The Keil MCB2130 evaluation board contains the new ARM based LPC2138 microcontrol
179. ments that consist of four piezoresistors buried in the face of a thin chemically etched silicon diaphragm A pressure change causes the diaphragm to flex thus inducing a stress or strain in the diaphragm and the buried resistors The resistor values change in propor tion to the applied stress even when the product is removed or a person gets in the way Dumb but efficient This may be fine if humans are removed from the picture but the future of robotics is changing As industrial technology evolves robots will be tasked to work more closely with laborers This will create a new set of safety issues that will be tack led only by way of feedback Although feedback can be used to prevent a robot from doing harm it s also a requirement for accomplishing tasks effectively Many robots are currently used as autonomous delivery vehicles When the technology was first introduced the robots simply followed lines but it quickly became clear that external issues were preventing tasks from reach ing completion The first line following robots couldn t avoid the obstacles in their paths As a result input feedback has become the eyes and ears robots use to make autonomous decisions ROBOTIC TOUCH You touch things to explore your environment Touching things also helps you form emotional bonds with other people Photo 3 Jekscan uses a thin semiconductive coating ink to produce Flexiforce which is a flexible tactile f
180. mory programmers to USB the 2232C Clock Serial mode provides the basis for USB JTAG emu lators Another option described in the datasheet is an optoisolated connection to serve the growing stable of industri al and scientific add ons e g data log ging and digital oscilloscope KEEP IT SIMPLER Witnessing the success of FTDI it s no surprise to see competitors emerge As an aside in last month s column 751 Favorites I noted that Silicon Labs s formerly Cygnal 51 evaluation board exploited their serial to USB adapter chip the CP2102 see Figure 3 Let s take a closer look In terms of basic functionality the CP2102 is similar to FTDI s FT232BM Photo 1 The Silicon Laboratories CP2102 evaluation board bridges the gap between the old RS 232 and the new USB Notice the relative component count and floor space required for each which only reinforces the conclusion that it s time to make a change 80 Issue 177 April 2005 1 2 3 IN Voltage regulator OUT 48 MHz Oscillator TD 3 E A A A D1 D3 Both are minimalist converters featur ing the aforementioned USB direct connection on one side and a COM port oriented UART with a full comple ment of modem controls on the other Like the FTDI parts royalty free drivers both Virtual COM Port and Direct DLL are available However although similar in terms of basic functionality the CP2102 delivers some key cost saving adv
181. mplementing the S et Cor eTi function Although ourSet Cor eTi mer ASM assembly function routine doesn t have that particular code defect it still fails the test define SCALE 0 define PERIOD 0x2000 define COUNT 0x4000 typedef ulong unsigned long int TEST Test SetCoreTi mer STUDENT SaveUserRegAndReset WatchDataClass unsigned long coreti mer reg 4 pTCNTL pTPERIOD pTSCALE pTCOUNT 1 Setup expected values unsigned long expected value 0x0 WATCH MEMORY RANGE coreti mer reg SetCoreTi mer ASM COUNT PERI OD READ CHECK WRITE CHECK __RestoreUserReg CHECK coreti getReadsWrites ARRAYS EQUAL expected value coreti mer reg getFinal Val ue 4 PERIOD SCALE COUNT SCALE J test where the same period and count students test avoids this potential values were used but it would ve con tained a serious hidden defect The CIRCUIT CELLAR defect The assembly language code in Listing 2 doesn t suffer from this www circuitcellar com Listing 4 This test demonstrates the test for the ISR include lt sys exception h gt EX INTERRUPT HANDLER InterruptHandl er extern volatile long int number coreti mer interrupts include signal h gt TEST INTERRUPT TEST Coreti mer SaveUserRegAndReset register handler ik ti mer InterruptHandler int number of times round loop 0 number coreti mer interrupts while numbe
182. mulations PF simula Embedded Ethernet only 98 m 10Base T Ethernet i 186 Processor 40 MHz an DOS wi Flash File System Hardware Clock Calendar 512K DRAM amp 512K Flash Console Debug Serial Port 16 Digital I O lines Optional DiskOnChip 5V DC Power Compact 3 75 x 2 50 Expand with the pico 1 O 32 Digital Inputs 20 Digital Outputs 11 Channels of 12 Bit A D C C amp Quick Basic Drivers number of _ Clear the interrupt 2 Serial Ports 2 16 bit Timers Watchdog Timer Call 530 297 6073 On the web at www jkmicro com JK microsystems Email sales jkmicro com 64 Issue 177 April 2005 if _ number of CIRCUIT CELLAR LEDstate 0 number of _ task using a variable duty cycl to mimic the changes ADSP TMP03 temperature sensor EX INTERRUPT HANDLER Si mul 0 ISR interrupts pTI MER STATUS TIMIL2 interrupts 0 in the pulse width modulated signal interrupts amp 1 1 Continued Is it you or your EDA vendor It should be you Announcing Faabware 1 0 To get this distribution containing symbols and landpatterns for gEDA PCB and the gEDA software go to FaabMedia com www FaabMedia com www circuitcellar com Listing 6 Continued tion is slated for a later release __LEDstate _TMP03_HI STATE Output current simulated signal WriteOutputASM LEDstat
183. munity and ESD protection internal Data EEPROM Wide Operating Voltage 2 2 5 5V Up to 56 V O lines Single pack development kit ta get beginners up and Compatible with OTP Mask type devices running with Holtek devices asap excepted New range af development Part No Program Data Memory Data EEPROM I O Timer Interrupt Pins tools and volume HT 48506 1Kx14 G48 128x8 13 Bbitx 1 2 18 20 proeucnon type HTABEI0 1 14 64x8 128x8 19 2 24 IPTE NINE HT4BE3 0 2Kx14 Ons 128x8 23 Bbitx1 2 24 28 HT48E50 AKXTI5 160x8 256x8 33 Bbitx1 T6bitx 3 28 48 7 BEx16 224 2556x8 55 16bitxz 3 48 64 Under development available in May 2005 Order your Holtek In Circuit Emulator today get 10 discount Bald for dnd Sanada some aay or roia eu JRE Lousy Hae 292 Priston SEMICOMOUCTOR IMC USA Sales Office Hol mate Semiconductor Inc 46712 Fremont Blvd Fremont CA 94538 Tel 510 252 9880 510 252 9885 www holmate com gt AVRcamVIEW File View Device Window Help Connect Disconnect E3 Capture Frame 12 19 2004 11 21 31 File racking Data 8 racking Data 8 tacking Data 8 racking Data 8 racking Data 8 racking Data 8 O WARNING INFO CONFIG System Messages Configure Serial Set Registers Ping Capture Disable Tracking Enable Passive Tracking Clear Couns Clear al Reset 5 Check OANE FINER
184. nally the hope that leaving the USB issue to the user will relieve you of sup port headaches is likely an illusion The fact is that if the user has a problem using your RS 232 gadget with an exter nal USB converter dongle you have a problem too Chances are you ll still get a call if a problem arises and you may I wanted to write some simple programs to check out the CP2102 Given the USB connection that meant programming the PC instead of a simple SBC that I would typically use However I hadn t been keeping up with the times especially when it came to today s complicated PC programming mega suites Studying up on the subject a bit I quickly convinced myself that the fancy tools out there were not only overkill but also way too bloaty to get my hands around in short order Oh for the good old days when PCs came with a simple BASIC built in Almost as a matter of whimsy I punched BASIC for Windows in Google which faithfully reported 25 million hits Sigh But wait right there on the first page I saw three links for a BBC BASIC for Windows What the heck No harm in clicking BBC BASIC goes back to the roots of personal computing in the United Kingdom even before the IBM PC days a story filled with names from the past like Acorn progenitor of ARM Sinclair and even CP M I enjoyed the trip down memory lane but even better the fact I came away with a free download evaluation version of BBC BASIC for Windows Head on over to w
185. nd two enable signals for driving the L298 H Bridge device in Chopper mode We assigned MCU IC1 ports PO P2 and P3 for each motor axis The ports are bit addressable so the individ ual port pins are used to drive the differ ent motor control signals e g CLK ENABLE HALF FULL STEP CONTROL etc of the corresponding L297 IC The L298 driver IC IC7 IC8 and IC9 has a dual H Bridge for driving a two phase stepper motor in bipolar con figuration The D1 through D28 diodes are 2 A freewheeling diodes that pro vide an alternative path for the induc tive decaying current when the power to the motor winding is suddenly removed R15 16 R17 18 and R19 20 are high power sense resistor pairs used for sensing the motor winding current in each phase for each motor Each of the three potentiometers R23 through R25 provides necessary reference voltage for IC L297 to generate the required chopper output in a closed loop control You should adjust these potentiometers for the appropriate reference voltage for each motor and take into account the values of the sense resistor and required motor winding current Connectors CN4 CN5 and CN6 have L298 outputs where you can con nect the x y and z motors along with optional optical mechanical end limit detection logic We used a Sanyo Denki 200 step per revolution 2 A stepper motor for each motor axis You may need to detect the end limits while driving a linear transnational sta
186. nd greatest GOING GOING GONE But let s start with some not so great What s up with USB On the Go Not much as far as I can tell To refresh your memory the USB On the Go initiative was announced to great fanfare way back in 2001 The idea behind OTG has been to evolve USB beyond its PC centric host device architecture to a more democratic peer to peer device device nirvana OTG propo nents look forward to the day when your cell phone PDA MP3 player etc can talk directly to each other without needing a PC in the loop Sounds good but don t hold your breath If you poke around the Net you ll find all manner of press releases 78 Issue 177 April 2005 in the years since the announcement The annual PR ritual invariably includes a prediction that USB OTG enabled devices will be on the shelf by the end of this year i e whatever year it was when the hopeful hype was penned There may be some shelves somewhere with OTG on them but they aren t the ones at my local electronics emporium Sure OTG makes sense from 50 000 From that lofty vantage point oxygen deprivation induced euphoria tends to make a lot of ideas look good including the 99 that go nowhere Only from a much lower altitude do the messy details and the devils that come with them become apparent Yes the first OTG capable chips are peeking out from behind the curtain Usually the availability of silicon says a standar
187. ngthe Xbox An Introduction to Reverse Engineering No Starch Press San Francisco 2003 P Kocher et al Introduction to Differential Power Analysis and Related Attacks Cryptography Research Inc 1998 www crypto graphy com resources whitepapers DPATechInfo pdf O Kommerling and M Kuhn Design Principles for Tamper Resistant Smartcard Processors 1999 www cl cam ac uk mgk25 sc99 tamper pdf T S Messerges Power Analysis Attack Countermeasures and Their Weaknesses Communications Electromagnetics Propagation and Signal Processing Workshop 2000 www iccip csl uiuc edu conf ceps 2000 messerges pdf www circuitcellar com Whatever processor Tamdy vou ane Targeting whether it i th ARM FIL 6051 or ane gil the ahar chip fares we support tools can help you write better code and bnng it to market faster Our raputatian proven our tools are first rate and our support Start is the Dest in The industry HI TECH ARM C The HI TECH ARM C 5 high pe r wm pa ES comailer for the powerty microcontrallers based on the ARM architecture debvenng excellent code adensity and reliability HI TECH PICC HETECH FICC is the oversvhealm ng choece for developers on the Microchip PlCMicro supporting every one of the extensive range of PiCMicro devices HI TECH 8051C p ili rh D ee oe al The 8051 family 5 the most successtu
188. number core timer interrupts Theregi s ter handler function provides calls the VisualDSP C run time environment to place the ISR s address in the event handler and unmask the timer interrupt bit in the global IMASK interrupt mask It was unclear whether or not a soft ware interrupt produced by calling the raise function requires a corre sponding call toa ower function to clear the interrupt and stop reen trance to the ISR Therefore we added an additional CHECK opera tion to ensure that the number of INVENTORY CONTROL IS EASY TECE ECAT _ Long Range Class amp Il viva 1305 Post Road Suite 305 Fairfield CT 06430 Tel 203 254 153 Fax 203 254 7442 Email salesiplemosint com LEPPE www lemosint com CIRCUIT CELLAR Issue 177 April 2005 63 times the ISR was entered was equal to the number of calls toraise Listing 5 Known input signals can be manually established prior to the test But this approach defeats the purpose of an automated testing approach which should be equal to the number of times around the loop In hindsight this was a pointless test If a call to the ower function is required to stop the ISR being reentered then the CHECK statement wouldn t be reached Regardless the test shown in Listing 5 demonstrates the functional pf reg ity of the ISR READ CHECK Developing the test for the func tionality of the programmable flag input routines sho
189. o execute XCKCK CK KE OC OK OE K OK CK OE OEC CK CE OE OO OE KK OK CE OE OE CK CE OEC OC OE OE OK OEC OK EEG OE EGG EG KG EGG KG KG KG KG Xx Xx x x Track frame handler XCKCK CK KE SE SE SE SE SE OK CE OE OEC OK CK OE TE SE SE SE SE OK CK OE OE CK OE OEC OC OE CE OK OEC CK SE SE SE SE SE SE SE SE KG EG EG X KG KG KG Xx Xx x x _trackFrame sleep And we wait for cycles to return Disable the HREF interrupt in tmpl SFR IO ADDR GI CR andi t mpl out SFR 10 ADDR GI CR couple of NOPs empirically by trial nop no t mp1 and error HREF to wake us up Returning from the interrupt sleep wakeup will seven to wake up from idle sleep are needed here to sync consume 14 clock three to vector and four HREF NTERRUPT DISABLE MASK up the pixel data determi ned X CK SE SE SE SE SE SE JE SE SE TE TE EO OE OK OECK CE E OK CE CK OE OE EK ECKE CECOK CK EE OK EK EK OE XCOK ECKE XC E GE EG KG EG X Kx x X Acquire pixe block R G B triplet hae E SE SE SE SE SE SE JE SE SE E E E E E E KK KK KK KKKKK KKK RK KK KKK KKK KKK KKK KK KKKKKKKK KK EG KG FG X Kx x X acquirePi xel Block in ZL RB PORT in YL G_ PORT andi YL OxOF clear Idd color Z RED MEM OFFSET in ZL RB PORT Idd greenData Y GREEN MEM OFFSET Idd blueData Z BLUE MEM OFFSET and color greenData and color blueData some interrupt need to hop out brts _cleanUpTrackingLine color lastColor check if breq _acquirePixel
190. o remove a trace or add ion deposits to add a jumper or set a bit on the die Oliver K mmerling and Markus Kuhn s 1999 article Design Principles for Tamper Resistant Smartcard Processors details tech niques to extract software and data from smart card processors including manual microprobing laser cutting FIB manipulation glitch attacks and power analysis Much of this attack research is based on Friedrich Beck s Integrated Circuit Failure Analysis which details failure analysis techniques for opening the package chip insulation etching procedures for removing layers of chip structure and health and safe ty procedures Even though all of these die analysis attacks are easier said than done the available technolo gy is fascinating and the threat is real BUS PROTECTION Device operation and information can be gleaned by analyzing an embed ded system s internal address data and control bus lines using a logic analyzer digital oscilloscope or cus tom circuitry Targeted bus lines could be probed by simply removing the sol der mask on the outer layers of a cir cuit board Critical traces should be hidden on inner board layers Trace paths should be obfuscated to prevent the easy reverse engineering of the cir cuitry Use buried vias which con nect two or more inner layers but no outer layer and cannot be seen from either side of the board to reduce Issue 177 April 2005 35 potential probing point
191. ode This per Photo 1 The 500 Mhz ADSP BF533 Blackfin EZ Lite evaluation board has audio and video capability and digital inputs There are six LEDs that can flash CIRCUIT CELLAR mits the message to be wangled out of the target one character at a time but it completely disrupts the real time operation of the embedded system There is a background telemetry channel BTC in the ADSP BF533 Blackfin development environment specifically designed to permit message interchange with minimal disruption of real time operation We ve demonstrated the advantages of BTC embedded TDD but we have more work to do before gaining the full advantage of this high speed communication channel EMBEDDED TDD The modified TDD environment s source code was compiled linked and downloaded to the embedded system without changes to the standard envi ronment running on the VisualDSP IDE that came with the evaluation board Given that the code was written in C language we didn t expect any compatibility issues We were con cerned however about code size issues The original TDD environment requires a number of key extensions to be added for use in the embedded system environment The first requirement is the ability to reconfig ure the hardware environment to a known state prior to issuing a series of tests To capture this functionali ty we developed three new hard ware oriented TDD procedures The __CaptureKnownState
192. of the objects How far away are the objects The answers to these ques tions enable the appropriate post pro cessing of the environment as would be required by a particular application Several existing systems can per form vision processing at different lev els of capability For hobbyists the CMUcam is a small low cost system capable of tracking one colored object at 16 7 frames per second www 2 cs cmu edu cmucam It uses Ubicom SX28 microcontroller running at 75 MHz to acquire and process images through software However 12 Issue 177 April 2005 the CMUcam isn t very extensible because almost all of the SX28 s resources are required for the aforemen tioned image processing task A step up from the CMUcam is the Cognachrome system www newtonlabs com which is capable of tracking multiple objects of various colors at 60 frames per sec ond This system which costs several thousand dollars performs much of its image processing in hardware to achieve its impressive processing tasks I had considered trying to develop a small real time vision engine for several years This effort mostly involved back of the envelope calculations about the kind of processor logic needed to process a pixel stream and the amount of RAM needed to make it work It seemed like an interesting problem The bottom line was that I wanted to give my robots the ability to see the world around them This article describes how I did
193. ogic Analyzer up to 500 MSas 100MSa S max sample rate Variable Threshold Variable Threshold Vollage EIE Extemal Clocks Large 128k Butter ALES EM Small Lightweight and Portable a upio 512K samplesich Only 4 oz and 4 75 x 2 75 x 1 USB 2 0 and inmeriace Parallel Port interface to o Trigger Out Pattern Generator Windows Soltware sary t SB 2 i DARET 2DOIMHz 40CH 1700 USB 2 DrParalial LA2124 128K 100MBa n Ae ACMA Z PILH 94 3530 WS 2 D Parallel m our Wies inseriace Cable AC 5540 500MHz JICH 52500 USB 2 D Parallel Adapder and Software BOCH 3500 USB 2 0 Paralial 5800 455160 SO0MH 7 160CH 57500 USE 2 0 Paralial All pices inchite Pods and Sotbware Digital Oscilloscopes 2 Channel Oscilloscope 100 MSa s max single shot rate samples per channel Advanced Tnagering Only and 6 3 x 3 757 x 1 25 Small Lightweight and Portable USB or Parallel Port interface Advanced Math s FFT Spectrum Analyzer optional 0510 21025 5525 DSO 2 102M S650 DSO 21025 US8 600 DS8O0 2102MI LISB 725 All prices include Oscilloscope Probes Interface Cable Power Adapter and Soltware Link Instruments 873 808 8990 d i 174 Danel Road East Fairfield NJ 07004 Fax 1973 508 8786 www Linkins4 com Seetron Serial LCDs almost too
194. om ad lowpowerawvr i Everywhere You is a mark ol Aime Dorri N i gt N i W WN mmm 1 W y QN Ww W wh W b Y Ww A W T V V Y Y B V d AL B VF 1 BB N B OPTICAL SENSOR OPERATES DISTANCES 40 A new reflective optical sensor capable of detecting objects at operating distances of up to 40 mm is now avail able The surface mount TCND5000 reflective sensor which includes an IR emitter and PIN photodiode in a sin gle package is well suited for use in object presence sen sors touch sensors and proximity sensors in a broad range Edited by John Gorsky of consumer industrial and automotive applications With high sensitivity and an operating distance from 2 mm to as great as 40 mm the highly integrated TCND5000 sensor offers designers a compact and reliable solution for enhancing the performance of electronic sys tems such as cell phones in which the device compen sates for the proximity of your ear and adjusts the volume of the speakerphone function accordingly The sensor s high intensity IR emitter features an oper ating wavelength of 950 nm while a 950 nm IR band pass filter eliminates interference from daylight An optical barrier between the emitter and detector reduces crosstalk to very low levels The TCND5000 sensor
195. omplete details RENESAS CIRCUIT CELLAR This is a powerful design tool for GUIs The end result is shown in Photo 3 The temperature data is graphed nicely the red line and the current temperature updates every time a serial string is received over the virtual COM port This puts the finishing touch on the USB ARM DAQ system and makes for a professional looking demo SWITCHING TO ARM I hope you now have a better under standing of ARM based microcon trollers USB to UART bridges and the process of implementing simple GUIs You can combine all three to make a simple data acquisition device The new ARM microcontrollers like the LPC2138 are opening doors for designers many of whom are now questioning the use of the venerable 8 bit microcontroller for some applica tions When you account for the ARM7 core s processing power low power consumption vast number of periph erals memory size tool debug sup port and incredibly small physical footprint switching to a 32 bit ARM microcontroller may be a reasonable choice The USB to UART bridges like the CP2101 make it simple to update UART peripherals on microcontrollers or lega cy RS 232 devices and enable USB connectivity Embedded code isn t required to make this transition so the update process is fairly seamless The virtual COM port drivers provided by companies like Silicon Labs also allow PC applications such as the Visual Basic GUI I created to send
196. on to TTL level signaling Finally the standard AVR STK200 300 10 pin ISP header is integrated in with the sys tem to allow for the complete reprogramming of the ATmega8 s firmware CIRCUIT CELLAR AVRcam SOFTWARE The software behind the AVRcam ties everything together and makes the system work Figure 3 a class diagram of the AVRcam firmware highlights the main mod ules in the system As you can see a simple executive sits at the center of the system It s used to dispatch events to the classes as needed There are actually two types of events in the system regular events and fast events denoted in the code by EV xxx or FEV xxx Regular events are low priority events placed in an event FIFO Fast events are placed in an event bit mask because the time to insert and remove them from a FIFO is too long Fast events are used for the time critical events like a line of pixels ending Regular events are used for less time sensitive events such as when a serial byte of data is received The user interface manager is responsible for parsing and processing incoming serial commands from the UART interface It also generates the appropriate responses This includes publishing events after a command is received The camera configuration Sleep until VSYNC interrupts and wakes the system up Set up the pointers to the currentLineBuffer set up the intial pixel run point the Y and Z index registers to the color map
197. ons i Mike Smith has been writing computer related articles since the early 1970s Heis a professor of electrical and com puter engineering at the U niversity of Calgary Canada You may contact him at smithmr ucalgary ca Moreno Bariffi is an international internship student visiting from the U niversity of Applied Science Fribourg Switzerland You may con tact him at mbariffiGhotmail com Warren Flaman is an electronics techni cian at the University of Calgary You can reach him at wflaman ucalgary ca Adam Geras is a graduate student at the University of Calgary You can reach him at ageras ucalgary ca Lily Huangis a graduate student at the University of Calgary You may contact her at fhuang ucalgary ca Andrew Kwan is a computer engineer ing student at the U niversity of Calgary You may contact him at akckwan ucalgary ca Alan Martin is an electrical engineering student at the University of Calgary You may reach him at ajcmarti ucalgary ca James Miller is a professor of electri cal and computer engineering at the University of Alberta Canada You may contact him at jm aee ualberta ca RESOURCE TDD tutorials The University of Calgary www enel ucalgary ca People Smith embeddedTDD SOURCE ADSP BF533 Blackfin microcontroller TigerSHARC family and TMP03 Analog Devices www analog com CIRCUIT CELLAR PIC SE R VO Motion Control Low C Tor Brush Brushless anc New
198. ontrol on each channel is to reduce servo twitch ing when commanding large motions There are programmable servo start up positions too Also note that you have the ability optional to turn off servos i e go limp and allow them to be moved manually The serial servo controller s UART data rates can be changed to suit your application Finally you can transparently daisy chain several con trollers for system expansion Currently market offerings appear to be partitioned into three main cate gories The first represents the boards which control only a limited number of channels 1 through 4 These boards typically use an MCU with built in hardware PWM generation modules Doing the PWM in hardware reduces pulse jitter The waveforms usually can be synchronized However the effective position resolution may not be the full 8 bits so carefully examine the speci fications The small number of PWM channels supported makes this approach the low cost low end of the spectrum A second category of servo con trollers offers up to eight channels sometimes 16 These boards general ly use an MCU with firmware based bit banging generation of the PWM on all channels The bit banged algorithm is based either on timed interrupts or simply on the open loop firmware delays or a combination of both Probably the simplest interrupt based implementation of a multichannel Byte 2 Byte 3 Ox00 OxFE Servo 0 00 Position
199. ootloader ren h for C SPI Dall visor pp ED TIME R5232 X10 Compact Flash Memory Cards and USB Serial Communicator VIRTUAL SIMULATION Simulate your project in Online Updating RealTime using the integrate Proteus Virtual PIC Boards Plugin Architecture Visit www r4systems com to see our latest projects using Protont PROTEUS Ihe Complete Efectronics Design System Schematic and PCB Layout Powerful and flexible schematic capture Auto component placement Rip up and Retry PCB routing Polygonal gridless ground planes Library of over 8000 schematic and 1000 PCB foot prints of materials reports and more PCB AutoRouting Proteus PCB design includes an interface to the Electra Gridless autorouter Mixed Mode SPICE Circuit Simulation Berkeley SPICE3F5 simulator with custom extensions for true mixed mode and interactive simulation For the cost of the software compared to the productivity gains Six virtual instruments and 14 graph based analysis types I consider Proteus to be pivotal in the commercial viability 6 000 models including TTL CMOS and PLD digital parts of my company and by far represents the best value for money Fully compatible with manufacturers SPICE models of anything Tempus possesses ROB YOUNGS Tempus Consulting Proteus VSM Co simulation and debugging for popular Micro Controllers FREE DOWNLOADABLE DEMO Supports PIC16 amp P
200. or factors stored in v Display Eros T No writing CR gt CR LF HeEvent Font Comm Events Flow Control Timeouts Disconect lr Autowrap ene Multithreaded TTY File ITY Transfer Help Virtua Press F1 for Help Photo 4 may not matter in most applications but this simple program to toggle the RTS line reveals there are low level timing differences between a real and virtual COM port www circuitcellar com the USB INF file to allow a non standard data rate 194 57 7 CIRCUIT CELLAR Port Baud Parity pow z 115200 sj None fi Font Comm Events Flow Control Timeouts Disconect Hana Depending on the speed of your the COM Port drivers handshaking features CRIS CIS KXON XOFF gt may need to be enabled to avoid overrun note error message bottom right gt to impersonate a standard one For example you could set the entry corre sponding to 115 2 kbps with the clock divisor factors corresponding to 1 Mbps Then when an application specifies 115 2 kbps the rate is actually set to 1 Mbps behind the scenes Although it s tempting to succumb to the illusion of real COM ports don t for get there s a lot that goes on between the two ends of the virtual connection Consider an example application that takes direct control of the modem con trol lines perhaps to monitor a switch closure or drive an LED With a r
201. or components on the board Understanding what the components do may provide details about particu lar signal lines that may be useful for active probing during operation The part numbers and the manufacturer s marking on the package easily identify components An attacker can also fol low their traces to see how they inter connect with other components Nearly all IC manufacturers post component datasheets on the Net On line services like IC Master www icmaster com and Data Sheet Locator www datasheetloca tor com provide part number searches and pinout and package data for hun dreds of thousands of components Photo 1 Early USB authentication tokens improperly used epoxy encapsulation to cover a serial EEPROM The adjacent footprint can be used to read the contents of the protected device CIRCUIT CELLAR To increase the difficulty of reverse engineering and device identification I recommend scratching off the marks on the top of your chips This is known as demarking or black top ping Depending on the quantities of ICs you are ordering you may be able to ask the manufacturer to leave the markings off of the devices you order The next best option is to remove the markings in house during the manu facturing process You can use a laser etcher or demarking machine typical ly a controlled microbead blasting process that removes all identifiable markings from the device You can also use a stainless steel br
202. orce sensor www circuitcellar com The bit is the ultimate input It s decisively simple Yes no On oft Open close It either is or it isn t Most microcontrollers give the bit its own instructions Robots use switches to acquire binary information Although other types of input can give the robot a sense of where it stands in relation to other objects the robot s bumpers indicate when it comes into contact with something The problem of course is that objects can hit the robot without striking a bumper Someday robots will be covered with a sensory material like human skin After a robot has the ability to move around freely it can provide delivery assistance Having the ability to load and unload the cargo would make the robot truly autonomous This might be the mail medicine or your favorite beverage The best appendage would be some kind of arm that could grasp objects Sounds easy right Assuming you ve perfected the robot s ability to move around and position its arm you ve got to address the issue of touch How much force is needed to pick up an object You can design an end effector that s matched to the necessary function For instance an arm with a scoop would n t necessarily require information about the items it would scoop However an arm with a grasping effector would require feedback to complete the task Again simple and specific tasks can be performed using simple feedback switches The
203. ork a number of Micro64 modules I ve written enough about the Micro64 hardware Download the datasheet and application notes from Micromint s web site for more infor mation Now I ll describe how I applied some power to the Micro64 and test drove it CODING THE Micro64 My Micro64 came with a develop ment board that provides all of the necessary power and communication hookups Supporting power circuitry communications subsystems and a large breadboard area surround the Micro64 see Photo 1 The various jumpers allow the communications port to be configured for RS 485 RS 232 or RS 422 operation Screw ter minals make easy work of attaching the Micro64 to a twisted pair half duplex RS 485 or RS 422 network The Micro64 development board is configured for standard RS 232C which allows you to connect immedi ately to your PC s serial port via the Micro64 development board s DS14C232C RS 232 converter IC The Micro64 is based on the ATmega64 which means you can pro gram it using AVR assembler C lan guage or compiled BASIC Micro64 example code for CodeVisionAVR and BASCOM AVR is posted on Micromint s web site Micromint s bootloader program Photo 1 The Micro64 was designed to participate in rugged industrial environments The light footed 4 coupled with the 32 KB of SRAM allows the Micro64 to be used in a variety of applications strength lies in its simplicity The CodeVisionAVR C compiler is e
204. project involves everything from wireless communi cation to motor control Read on to learn how to build the controllers and place the sensors Keeping students interested in a sub ject area can be a major headache Some teachers argue that applied disciplines have the luxury of lab work that stirs interest in students This may be true but it s an ongoing challenge particular ly in the dynamic field of electronics Years ago teachers wooed their class es with demonstrations of technolo gies that were beyond the means of their students But times have changed Today kids can buy off the shelf gizmos with the sort of processing power that would have been the envy of the NASA engi neers who won the race to the moon Here at the University of the West Indies in Barbados a major requirement in my microcontroller applications course ELET3150 is a lab Course lectures are traditionally reinforced by laboratory experiments Almost every major topic mentioned on a syllabus is allocated a separate experiment to illustrate the prin ciples taught in the classroom Students taking the course are usually comput er science majors mainly program mers who have a tendency to think that CPUs come only in desktop and laptop machines Many of these students would rather take a basic digital course but they probably haven t had too much hands on experience at a component level Rapidly growing technologies e g embedded control an
205. r tainly the easiest to get on board is a simple USB to serial adapter solution In conjunction with a virtual COM port VCP driver on the PC a converter can allow seri al port based applications to hook up to USB yet run as they are with no hardware or software changes If you re connecting an existing design that includes an RS 232 transceiver and the famil Number of USB products shipped per year thousands 1 200 000 1 000 000 800 000 600 000 400 000 200 000 0 2003 2004 2005 2006 2007 2008 E USB Low or full speed BSUSB high speed USB On the Go Figure 1 Heady set don t go USB On the Go faces a long and winding road before it achieves anything near the popularity of the original Source In Stat MDR February 2004 XTOUT 6 MHz x8 Clock Oscillator multiplier TEST gt GND__ iS iar DE 9 or DB 25 connector there are plenty of off the shelf convert er dongles to choose from Besides compatibility and simplici ty using a converter offloads all of the USB processing from your host MCU And now you have the luxury of choos ing any MCU with a UART hardware or bit banged for your application pro cessing If you have the luxury of mak ing a PCB you can streamline things a lot by connecting a USB to serial adapter directly to your UART eliminating the need for two RS 232 transceivers and connectors and presenting a clean USB only facade to the outside world Kudos to Future T
206. r The board and its virtual COM port software drivers form the link between the MCB2130 board s 5 232 port and the PC s USB port The National Semiconductor LM60 is a simple three pin analog Celsius temperature sen sor It s wired into the expansion connector on the MCB2130 board which connects to the LPC2138 s ADC to read the analog voltage from the sensor Its output is www circuitcellar com 54 MIPS when running at 60 MHz which is easily achieved by utilizing the LPC2138 s on board PLL So not only do you get a vast number of peripherals and tons of memory you get all the benefits of using an ARM core What are the benefits you ask An obvious one is its high perform ance and low power consumption combination Others are its vast soft ware tool support real time debug ging and code density options Thumb for high volume applica tions with memory restrictions The ARM core definitely has found its way into numerous appli cations via microprocessors ASICs SoCs and FPGAs And now with its growing use in cost effective microcontrollers I may think twice before choosing a performance lim ited 8 bit microcontroller for my next application Either way if TMS TDI TRST TCK LPC132 2138 System Test debug functions interface n ARM7TDMI S ARM7 local bus System Vectored clock interrupt controller AHB Bridge advanced high performance bus Emulation
207. r com or subscribe circuitcellar com To Subscribe 800 269 6301 www circuitcellar com subscribe htm or subscribe circuitcellar com PROBLEMS subscribe circuitcellar com GENERAL INFORMATION TELEPHONE 860 875 2199 Fax 860 871 0411 INTERNET info circuitcellar com editor circuitcellar com or www circuitcellar com EDITORIAL OFFICES Editor Circuit Cellar 4 Park St Vernon CT 06066 NEW PRODUCTS New Products Circuit Cellar 4 Park St Vernon CT 06066 newproducts circuitcellar com AUTHOR CONTACT E MAIL Author addresses when available are included at the end of each article For information on authorized reprints of articles contact Jeannette Ciarcia 860 875 2199 or e mail jciarcia circuitcellar com CIRCUIT CELLAR THE MAGAZINE FOR COMPUTER APPLICATIONS ISSN 1528 0608 and Circuit Cellar Online are published monthly by Circuit Cellar Incorporated 4 Park Street Suite 20 Vernon CT 06066 860 875 2751 Periodical rates paid at Vernon CT and additional offices One year 12 issues subscription rate USA and possessions 21 95 Canada Mexico 31 95 all other countries 49 95 Two year 24 issues subscription rate USA and possessions 39 95 Canada Mexico 55 all other countries 85 All subscription orders payable in U S funds only via VISA MasterCard international postal money order or check drawn on U S bank Direct subscription orders and subscription related questions to Circuit Cellar Subscriptions P O Box 5
208. r coretimer interrupts Force a software interrupt 1 ti mer 0 lt 10 number_of_times_round_ o00p t register_handler ik_timer CHECK number of times round loop RestoreUserReg defect but it fails the students test Our code failed because of a feature in the Blackfin silicon that wasn t in the hardware manual The Blackfin processor has a num ber of timers the core timer used in this project a system clock a watch dog timer and three pulse width mod ulated timers for various microcon troller applications The PWM timers are designed to continuously change duty cycles However the core timer typically isn t programmed in this mode Its standard mode of operation is to produce interrupts at regular intervals which means the period value is continuously used to reload the count value If the core timer is powered down loading the PERIOD register automatically loads the COUNT register with the same value We wrote the assembly code version of the SetupCoreTi mer ASM func tion from the bottom up i e the first parameter into a timer register the second parameter into a register and so on However because of the way the timer hardware had been opti mized this meant that the value put into the COUNT register was over written with a PERIOD value that was written to the timer registers at a later time If we had used a top down approach i e third parameter rath
209. r the full product line see the Digrlent website DIGILENT www digilentinc com WWW xml com www circuitcellar com CIRCUIT CELLAR Issue 177 April 2005 11 FEATURE ARTICLE by John Orlando 2004 DESIGN CONTEST AVRcam A Low Cost Embedded Vision System The AVRcam is a low cost image processing engine The system shows great promise for robotics applications as well as motion detection and object recognition always been amazed by how well humans perceive and react to the world around them in real time I can drive a car at 65 mph on the express way following the white lane separa tion stripes and the yellow border stripes without getting into an accident Throw me a ball and catch it or at least get out of the way before it hits me Trying to figure out how to mimic some of these capabilities in a man made system has driven my interest in robot ics ever since I was 6 years old This is in part the reason that I ve found a life long hobby in robotics The eyes are arguably the most complicated sensors attached to the human body Thus artificial vision systems tend to be extremely complex These systems typically require a con siderable amount of computing power to acquire and process their environments in real time The end goal of most vision systems is to determine specific infor mation about the environment How many different objects exist Are objects moving What are the colors
210. re from the duty cycle of an Analog Devices thermal sensor Note that this tem perature calculation was a straight software testing issue This could have been handled with the original CppUnitLite TDD environment devel oped by Michael Feathers and distrib uted under the terms and conditions of the GNU license http c2 com cgi wiki CppUnitLite In this article we ll describe the process of modifying TDD to produce a prototype TDD environment for embedded systems 60 Issue 177 April 2005 CppUnitLite The key to adapting Michael s CppUnitLite for an embedded system involved minimizing memory usage in order to ensure that it would fit with in the embedded system environment In particular we replaced print state ments that involved formatting with simpler ones like puts astring The sheer generality of the formatting associated with statements like cout lt lt val ue andpri ntf 9d val ue pulls sufficient code from the lt stdio gt library to occupy most of the available program memory space possibly leav ing little room for additional code The changes don t solve all the prob lems associated with the reports generat ed during TDD in a live rather than sim ulated environment Messages are sent back from the target to the develop ment environment over a serial USB or JTAG connection Transmitting strings is a complex task The target must be stopped and switched into Emulator Interrupt m
211. res as needed I m thinking about adding a generic analog video input to allow for an NTSC or PAL video signal to be used as the image source This would allow Photo 3 The EyeBo 3 with the AVRcam was my entry in the ChiBots 2004 line following contest www circuitcellar com Photo 4 Take a look at the advanced line following course for the ChiBots November 2004 competition Looks like fun doesn t it the system to work with any of the small video cameras that are abundant on the market today But such a project may require a step up from the good ol AVR I guess I ll have to wait and see k Author s note I d like to thank my wife Lindsay for putting up with my robotics addiction She knew how important this project was to me and gave me the time needed to make it work I d also liketo thank my mom Anne Orlando for teaching me the meaning of hard work and perseverance Her example has provided me with a foundation like none other Finally I d like to thank my friend Brent Taylor for developing the AVRcamVIEW applica tion It turned out great John Orlando received his B S E E from the Rose Hulman Institute of Technology in 1998 15 currently finishing his M S in computer science at the Illinois Institute of Technology John is a software engineer for the Applied Technology research group at Motorola He also owns JROBOT www jrobot net which specializes in various robotic endeavors Heis an a
212. restling solar roller and maze solving I had entered my EyeBo robot now in version 3 in the line 18 1 177 April 2005 following contests in the past but now it was time to strap the AVRcam to my robot and see how it would fare against the competition in the ChiBots 2004 competition see Photo 3 The line following contests require each robot to follow a white line on a black background Each robot must complete three laps around the course The robot that completes the laps the fastest wins the contest Typical entries use infrared sensors facing straight down to determine if the robot is straying off the line and to perform the needed adjustment I attached my AVRcam to the EyeBo 3 so that it could see approximately 2 ahead and track the line visually The color map was set to track the color white thus providing bounding box information about the line In practice however the white line appeared as one tracked object without enough contour information to describe the orientation of the line ahead I made a simple one line firmware modifica tion to the AVRcam to force the system to start tracking a new object after the currently tracked object reached a verti cal height of 17 pixels This resulted in the AVRcam tracking eight white bounding boxes that followed the con tour of the tracked line see Photo 2 I arrived early at the ChiBots con test site so I could take snapshots of the course with the AVRc
213. rfect for troubleshooting USE optimizing Gata flaw and USB training USB I2C GND pimedes simple drop in solution for conmeciing your PC io SIkHz 2 20 VO ines Free software Use multipin hoards for more Fac Ico only 79 Saal Co brings fo Jeanna peaducts fo niis 24 24 latched LC lines set powered from your PC s USS pon Ubioom 5X52 alma individual pin WO programming control via PCs USE pari from 654 for PCs PORGLY indusity slandard 210 card for PCs WINI2CIPCI son warm qwes windows imerfacn to develop and debug 2C bus s tems UCASSLY is new USB version NOW transgarently monitor aL 4O0KH2 amy 4991 SM PC B Adapters OM Adapt have bwo footpnnis on emer Mos uen your ula Tie plc SMD componenis wilh more weet i 1 inline spaced holes COna Ip ang pinouts 6 95 USB Serial Adapter SM minibaards Serial port for laptepe without One US232B instantly updates oder RE23X2 productis ip USE PC thinks it s using COMpart nut usas ihe USB connection only 39 1 or 29 100 STINGRAY PC SCOPE t ADAPTOR D S1M12 1 MS s sampling 12 bit 2 ch USB scope adapter for PC Looks like Scape on your PC screen Great far laptops and servicing only 995 2555 B FREE COFFEE Call 1 888 7SAELIG Mention Offer SEWNV fo qet a free STARBUCKS Card with your order cani and Cus
214. rol Chonnels PWM and Analog Outs fii Encoder Index Inputs 8 11 Analog Inputs 10 bir E 2 Iso Power Dig Outputs a Watch Dog Enabled 5 PWM Command Ins 5 so Dis 2 so DOs R5232 Debug IO Single Power Supply 6V to 24V Input 350mA at 12V PowerPC 555 2i Floating Point X 3 Axis Gyroscope iy 3 Axis Accel 2g Ead 3 Axis Compass 5 T 2MB Burst Rom B r GPS Interface CAN Bus 4 Channel Ultrasonic R Configurable 70 to Drive tol Robot ul ntroller 149 7 7 Color LED ezLCp Intelligent LEU Module Instant LCD Gratification 6100 7 7 Color LED LLO Development Kil Incorporate a COLOR LCD in your project in no time AAO eM sd Rails Programmable Display Module Serials USB Parallel Interface FCI AVRIBASIC Stamp VE Compatible Onboard Flash Bitmap Memory Graphic Text Commands Downloadable TTF Fonts nico as Sony 2 7 Color TFT LCD 240 150 OVGA Transflective with LED Frontlight EEBNTIIDEC www circuitcellar com Modular Software Framework Including a e C Compiles with GCC On Board Debug ilies t Autonomous Path Playback Application with SimpleTeach Integrated Knowledge Systems www IKnowSystems com or 602 705 8978 CIRCUIT CELLAR abt rr udo Readable Why can t everything be this quick and ez aes Work EARTH com Ve Make S Issue 177 April200
215. roller based project is well suited for projects that require versatile servos including walking robots and ani matronics applications By upgrading from typical RC servos to digital RC servos he achieved a hardware based solution that features 16 bit accu racy and 12 bit resolution In the first part of this two part series Eric cov ers the architecture Be sure to come back next month when he ll discuss the circuits and FPGAs Columnist Jeff Bachiochi also delves into robotics as he analyzes Paratech s quantum tunneling composite QTC technology page 48 He wanted to explore ways to improve the sensitivity or rather a lack thereof of robots Sensitivity and input feedback will become increasingly impor tant as robots become more integrated into fields such as manufacturing and military applications By adding QTC sensors to his Heathkit Hero Jeff was able to make the robot pick up an egg without crushing it Finally we have an interesting article entitled Three Axis Stepper Motor Driver written by the design team of Viraj Bhanage Prajakta Deshpande and Praveen Deshpande page 68 Their RC system which was built around Philips P89C51RD2 and Atmel AT89C2051 microcon trollers improves component control It was designed to aid laser techni cians who have to precisely control optical components hope you enjoy reading these intriguing articles as much as did A special thank you goes out to the Connecticut State Police for allo
216. rrect password attempt wasn t random at all It was calculated based on the input pass word and a constant block of data stored within the DS1991 device The secure coprocessor originated from the notion of a protected subsystem that can execute sensitive functions in a trusted manner Programmable secure coprocessors typically contain a number of essential ingredients including hardware tamper response randomness a layered design self ini tialization authentication a general purpose processor and coprocessor persistent storage and a third party programming interface If possible any cryptographic functions in your design should be moved out of the firmware and into a dedicated crypto graphic device Physical security is a central assumption upon which secure distributed systems are built Without a secure foundation even the best cryptosystem and the most secure ker nel will fail The IBM 4758 is probably the most recognized commercially available secure coprocessor Its design has been presented in a number of academic papers and articles including Joan Dyer et al s Building the IBM 4758 Secure Coprocessor Mike Bond and Richard Clayton provided the first known attack against the IBM 4758 which has since been fixed by taking advantage of a flaw in the common cryptographic architecture CCA sup port software to export any and all of the program s DES and 3DES keys www cl cam ac uk rnc1 descrack
217. rts the cycle over This works fine for one channel but when a large number of multiple channels are involved the MCU must manage and share the timer with all 8 16 parallel channels It means establishing a global schedule of all time deltas between the falling edge of one channel and that of the next channel to be toggled off The problem here is that if two channels must be toggled off at the same time or one time step after each other the interrupt will be triggered too quickly for the MCU to have time to respond and reload the counter This results in tim ing errors In fact you can verify this by commanding two or more channels to have the same pulse width or even a few counts apart By looking at the PWM signals on an oscilloscope you may see timing errors To attempt to solve this problem a serial servo controller will stagger the pulses of the 8 16 channels in time so that the pulse 46 Issue 177 April 2005 16 to 20 ms lt Channel 1 Channel 2 Channel N Synchronized PWM channels all pulses start at the same time on every PWM channel b Channel 1 Channel 2 Channel N Nonsynchronized PWM channels pulse start staggered in time on every PWM channel Figure 3 Take a look at the differences between synchronized multichannel PWM generation a and nonsynchro nized staggered PWM generation b The illustrations aren t drawn to scale All of the PWM channel pulses in a Star
218. ry miam i with rpm Technologic SYSTEMS PC 104 Computer Boards Enclosures PC 104 Peripherals Custom Designs g Exceptional Support TS Linux v3 0 Introducing TS Linux version 3 0 Dur latest distribution is buil fron open source featuring a 2 4 18 kernel Apache web server FTP client server bash etc With a Iooiprint of 15 MB o less this is a great place to start your application Tha TS development environment compiles application code using ihe librarias and headers installed in TS Linux Applications developed on your desktop computer copy directhy Dur User Mode Linux patched kernel runs TS Linux 3 0 kernel and file Eystem as an application on your desktop computer during development PIC Programming Made Easy Proton t PICBASIC Development Suite Next Generation IDE Proton IDE is a professional and powerful visual Integrated Development Environment IDE which has been designed specifically for the Proton Plus compiler Proton IDE accelerates product develop ment a comfortable user environment without compromising performance flexibility or control SAVE TIME WITH END TO END INTEGRATIONS Code Explorer NEW IDE New IDE makes development using Compiler Results Programmer Intearation INTRODU Proton even faster and more intuitive 9 OFFER ORY COMPILER The popular Proton compiler has Integrated B
219. s and technologies Joe holds a B S C E from Boston U niversity His interests include competitive running collect ing classic video games and banging on drums You may reach him at joe grandideastudio com REFERENCES 1 J Grand Kingpin Attacks on and Countermeasures for USB Hardware Token Devices Proceedings of the Fifth Nordic Workshop on Secure IT Systems 2000 www grandideastudio com files security tokens usb hardware _token pdf CIRCUIT CELLAR 2 C O Dale Integrated Circuit Troubleshooting Using Voltage Contrast Techniques http teste quipmentcanada com VoltageContr astPaper html PIC16C84 Security posted Apri 26 1995 www brouhaha com eric pic 84security html RESOURCES F Beck Integrated Circuit Failure Analysis A Guide to Preparation Techniques John Wiley amp Sons Hoboken NJ 1998 J Dyer et al Building the IBM 4758 Secure Coprocessor 2001 www cs dartmouth edu sws papers compOl pdf J Grand DS1991 MultiKey iButton Dictionary Attack Vulnerability 2001 www grandideastudio com files security tokens ds1991_ibutton_ advisory txt P Gutmann Data Remanence in Semiconductor Devices Proceedings of the Tenth USENIX Security Symposium 2001 P Gutmann Data Remanence in Semiconductor Devices Tenth USENIX Security Symposium 2001 www usenix org publications library proceedings secO1 gutmann html A Huang Hacki
220. s are the most vulnerable to attack because of their requirement to have configuration memory external to the device stored in separate nonvolatile memory or program firmware which is then loaded into the FPGA at power up The bitstream between the configuration memory and FPGA simply needs to be monitored to retrieve the FPGA configuration Currently available flash memory based FPGA devices are arguably more secure than their SRAM based siblings Some product types worth investigat ing further are Actel s Antifuse FPGAs www actel com and QuickLogic FPGAs www quicklogic com both of which eliminate the need for external configuration memories required by SRAM based devices With your programmable logic make sure you implement protection against simple I O scan attacks in which an adversary attempts to reverse engineer a programmable logic design by cycling through all possible combinations of inputs and then mon itoring the outputs to determine the internal logic functions This type of attack is easiest against low density PLDs with dedicated inputs and out puts and for designs containing only asynchronous circuits and latches A CIRCUIT CELLAR solution is to use unused pins on the device to detect probing or tampering Pins can be set to inputs and if they detect a level change the device can assume it s being probed and can per form a countermeasure or response When designing state machines in FPGAs
221. s for the attacker If a multilayer board isn t used protective encapsulant should be applied at least to the target traces In Hacking the Xbox An Introduction to Reverse Engineering Andrew Huang describes a tap board used to intercept data transfer over the Xbox s HyperTransport bus Huang was able to retrieve the sym metric encryption key used for the protection of a secret boot loader which ultimately allowed him to exe cute untrusted code on the system This attack might have been prevent ed if those critical bus lines were on internal board layers MEMORY DEVICES Most memory devices are notori ously insecure Some have security features that prevent access to data whether through fuses in ROMs and boot block protection in flash memory or via a password protected memory area Even though they may be able to be bypassed with die manipulation attacks such features should be used because they will sufficiently raise the bar against attackers who may be try ing to clone or reverse engineer the device In this case they add an insignificant level of protection Atmel s CryptoMemory family of devices includes EEPROMs and syn chronous and asynchronous flash memory with authentication pass word and encryption features www atmel com products secure mem Most standard memory devices don t have this type of functionality and are readable often in circuit with standard tools Reading RAM or other volati
222. sed to load the FPGA code every time the board is powered An ATmega8515L MCU is the heart of the system Making full use of its exter nal memory bus interface it controls the set up and operation of the 32 memory mapped PWM generation units and handles other system activities The ATmega8515L is responsible for running the serial protocol and updat ing the PWM registers An external interrupt pin times the loading of the registers to occur in the dead time of the PWM cycle so that runt pulses aren t generated The ATmega8515L also runs the servo speed control algo rithms and performs real time limit checking on each servo axis The speed and soft travel limits on each channel are user defined and stored in the nonvolatile EEPROM memory inside the ATmega8515L An RS 232 level shifter allows for access to the ATmega8515L via a standard serial port STAY TUNED So far I ve explored the theory You Saved Dur Data Center IP Sentry Big Brother Nagios and more behind RC serial servo controllers reviewed some commercial offerings and introduced the architecture of a true hardware based 32 channel con troller Next month I will present the circuit schematics and delve deeper into FPGA territory to expose the inner workings of the circuit Until then start sharpening your FPGA skills il Eric Gagnon M A Sc P E has been hooked on electronics since the age of 12 He earned both of his degrees in elec tri
223. some of the most fascinating projects That s not to say the 11 other themes throughout the rest of the year don t attract great applications It s just that this particular topic brings out an incredibly high level of creativi ty among designers Their excitement for these inventive and fun projects is contagious Each year look forward to reading about the newest advances in robotics and the interesting ways they re being applied We selected a few for this issue that are sure to give you some great ideas for your own projects A couple Atmel AVR 2004 Design Contest winners used the contest as an opportunity to experiment with AVR microcontrollers in robotics appli cations and the results were impressive Turn to page 12 to learn about the AVRcam Designed around ATmega8 and ATtiny12 microcontrollers this camera provides real time tracking of multiple different colored objects in addition to still photography capability John Orlando discusses his range of goals which included designing an inexpensive system that would be easily expandable and how he and codesigner Brent Taylor accomplished them Their successful design won them Second Prize in the contest The well designed AVRcam is also appropriate for motion detection and object recognition applications For another terrific AVR based robotics application turn to page 44 Eric Gagnon won Honorable Mention for his 32 channel RC digital servo controller This ATmega8515L microcont
224. sponding to the angular incre general purpose stepping motor con troller The motor current is presently programmable via a potentiometer You can adjust the voltage on the reference pin of L297 and divide it by the sense resistor value to set the motor current This requires you to expose the poten tiometer from the front panel and insert a screwdriver to set the required voltage The board doesn t have an on board ADC so you must measure the refer ence voltage with a voltmeter as you set up You must open the top panel to mented movement when coupled directly to the shaft By counting the encoder pulses you can obtain information about the actual angular movement You can derive a signal for the direction of the rotation from the encoder output You can tiple axis stepper motor controller Next month we ll describe the firmware Until then happy step motoring k Viraj Bhanage received a bachelor s degree in electronics and tel ecommuni cation from Shivaji U niversity Listing 1 Use this code to test stepper motor hardware after connecting the motors and its power supply You can set the motor s speed as well as select the direction of rotation and full and half step operation 1 Code to test stepper motor 1 ude reg51f gt sbit MIDir P0 0 sbit MlHalfFull eader 1H 10 0 1 10 Fu fi counter hardware P89C51RD2 CPU clock wise step operation le for clock wis
225. st SetCoreTi mer INSTRUCTOR SaveUserRegAndReset WatchData unsigned long coreti reg 4 1 Set up expected values unsigned long expected value 0x0 WATCH MEMORY RANGE coreti mer reg SetCoreTi mer ASM COUNT PERI OD READ CHECK WRITE CHECK RestoreUserReg CHECK coreti mer reg getReadsWrites 4 ARRAYS EQUAL expected value coretimer reg getFinal Value 4 pTCNTL pTPERI OD pTSCALE pTCOUNT PERIOD SCALE COUNT SCALE Listing 2 Setting up the core timer registers requires three writes with passed parameters and a fourth with a known fixed value global SetCoreTi mer ASM L1 code ulong SetCoreTi merASM ulong count ulong period ulong scale Set CoreTi mer ASM H hi TCOUNT RO First SSync hi TPERI 00 P0 R1 11 Second parameter SSync H hi TSCALE POLL lo TSCALEJ R2 Third parameter passed in R2 SSync PI H hi TCNTL PQ L lo TCNTL RQ P1 Return the old contro PO L lo TCOUNT parameter passed in RO PO L lo TPERI OD passed in Rl register value RELOAD ENABLE NORMALPOWER Acti vate the ti mer Set CoreTi mer ASM END RTS Listing 3 This student developed test might be a better test than the one in Listing 1 Different values are assigned to the period and count registers This can catch a code defect where writes to these registers have been swapped when i
226. stest ARM family provides up to 512 Kbytes of 60 MHz Flash memory with a host of on chip peripherals and interfaces All of this comes with low power consumption tiny packages and full support from recognized third party tool providers It s the performance you would expect at a price you can afford For more information go to www philips com microcontrollers Part Memory Timers c Analog Interrupts Packape Number Interfaces Flash RAM gol PYM ATC Pins UART FOC SPI A D DAC Ext L UM WD h h 106 10t E LPC2131 32 EK 4 6 47 F 2 2 1 22 4 16 60 LOFP64 PHILIPS sense and simplicity Koninklijke Philips Electronics N V 2005 All rights reserved NEW PRODUCT NEWS 40 MHz PICs WITH SELF REPROGRAMMABLE MEMORY Four new high pin count high density members of the PIC18Fxxxx family are now available These devices offer a cost effective 96 and 128 KB of self reprogramma ble high endurance flash memory with up to 10 MIPS performance over a wide operating voltage range 2 to 5 5 V These features combined with nanoWatt Technology power man agement and a rich set of analog and digital periph erals allow the microcon troller series to compete with 16 bit devices in high end embedded appli cations while retaining ease of use and helping you to preserve your 8 bit development tool and software investments This family meets the needs of engineers with 8 bit code and develop ment
227. suggest improvements like these in their reports Some have gone a bit further A student recently suggested planting a solenoid under the truck s path in front of the gate The idea is to destroy hostile vehicles that attempt to enter the compound Deadly force PERFECT PROJECT This project has excited my students Most of all it has generated meaning ful answers to the what if questions they ve asked along the way Many students now realize that they can use a computer for more than surfing the Internet and playing games They now know that the majority of processors go into control applications not PCs When they begin they view the experiment as a simple modeling and simulation exer cise But it quickly dawns on them that it could easily become complicated My students have willingly committed extra time to this project despite its sim plicity I think it s the sort of spark that can ignite a lifelong interest in design How do I know I still remember the excitement of turning on and off my first LED under TRS 80 software control Peter Gibbs is a senior lecturer in physics and electronics at the U niversity of the West Indies Cave Hill in Barbados He holds bachelor s degrees in www circuitcellar com physics and math as well as a diploma of education from the U niversity of the West Indies He also earned a master s degree in physics from the U niversity of Guelph Ontario When he isn t wor
228. t CROSSING THE BRIDGE After the code is running on the LPC2138 the raw temperature data exits the MCB2130 board s Ei IODIR1 0 00FF0000 08 1 0004000 FTTTTTTT FIETTTTTT TTTTTTTT TTTTTTTT 100181 00000000 FTTTTTTT TTTTTTTT TTTTTTT FTTTTTTT IOPIN1 0403400000 CCC PROC serial port and meets the USB to UART bridge board which con tains the CP2101 USB to UART A D Converter 0 x A D Control ADODA 0x01 200401 CLKS Tele Obit w 0 04 START Now A D Clock 3000000 Iv SEL 4 D Data ADDR pxenonzcno p 00 VISA Ox0080 General Purpose Input Output 1 GPIO 1 xi 31 Bis 24 23 Bis 16 15 Bits EOM Bits B EH OD ED vVITITITTI Ivivivivivivivi BURST EDGE IY DONE OVERUN A D value to a real temperature Celsius and then graph and display it Visual Basic provided the control components for the graphing and the serial data communications and I wrote the temperature conversion code The serial data is received over the COM port It s provided by a control component called MSComm Control in Visual 0 Basic By simply adding this com ponent to the project you can set up and open and close serial ports bridge controller and an RS 232 transceiver The board s power also comes from the USB port once again eliminating the need for an ugly wall wart power sup ply I used
229. t project s easier than you might think USB FIFO up to 8 mbps USB UART up to 3 mbps USB Microcontroller boards pre programmed with firmware Absolutely NO driver software development required www dipdesign com Design services available PLP Design Issue 177 April2005 85 86 Put Your Devices on the Internet and in local networks too Networking isn t just for PCs Learn nbe dded howrodesian aa and program small devices INTER NET that exchange OMPL ETE data via TCP IP host Web pages communicate using e mail LOW 2 and FTP and IN Axtiacg much more Embedded Ethernet and Internet Complete by Jan Axelson ISBN 1 931448 O0 0 549 95 Lakeview Research www Lvr corm From the author of USB Complete E Hardwired Lighting Control System ffs Modular zade ai Ex d E Friendly All the cool features RTC Scenes IR Bi ESL nd antral program y www w brightan com a desison af Zanthi nnologies Inc PLCs for OEMs Program like a PLC Ladder BASIC Low Const amp Flexible like a Micro p Ethernet XServer Web HMI 8 Analog l as 15 5199 PTT eet al MODBUS LCD Port PWMs RTC Stepper Interrupts Hi Speed Counter Modem Internet New Option L Ethernet Wi Fi wi Free Web HMI Incredibly Easy to Program Our software is used by many 4 colleges for teaching PLCs IK Get Free Ladder Logic Simulator Trianple www tri p
230. t and hardware configurations to choose from If you go with an AVR you ll be breadboarding or creating PCBs to implement your initial and final designs At minimum you ll need a regulated power source a clock source and a microcontroller reset cir cuit If you need to communicate most embedded designs do you ll probably have to design in network interface circuitry Chances are that somewhere down the road you ll need to revise your firmware or squash a latent bug So you ll have to design in a user friendly programming port as well There s never enough extra SRAM floating around Depending on what your little AVR will have to do you may find yourself clipping on an external SRAM IC If an AVR project is in your future and if some of the aforementioned requirements sound familiar don t reinvent the wheel at your bench Take some time to get familiar with Micromint s new Micro64 which is a modular AVR based controller housed in a 42 pin 1 5 cubic inch potted brick Micro64 BASICS The Micro64 s core is an ATmega64 microcontroller running at 11 0592 MHz As you may already know the ATmega64 natively supports 64 KB of CIRCUIT CELLAR in system reprogrammable flash mem ory 2 KB of EEPROM and 4 KB of SRAM Micromint s Phil Champagne enhanced the raw AVR core embedded within the Micro64 He added a full 32 KB of SRAM and a factory loaded bootloader application that shares the AVR flash memory space with
231. t at the same point This ensures that all servos move synchronously The scenario in b results in relative servo trajectory tracking delays for the first channel is generated This is followed by the pulse for the next channel and so on see Figure 3 At any point in time the MCU resources are only focused on generating the timing for a single pulse which greatly simpli fies the firmware The limitation here is that in 16 to 20 ms of overall peri od you can only squeeze in between 16 and 20 concurrent channels before filling up the possible time slots Now the servos aren t synchronized In other words there s almost a 16 to 20 ms delay between updating the pulse width of the first channel and that of the last channel This can result in a 5 to 6 degree dynamic tracking mis match for a standard 0 2 s 60 servo In addition to all of this the MCU s internal UART which must process incoming serial commands can also generate additional interrupts This adds random jitter to the PWM waveforms There are numerous other approach es to generating PWM pulses such as 3 3V 1 8V Regulators Atmel ADDR DATA MCU o gt a ks Qo Figure 4 A Xilinx FPGA contains the 32 parallel hardware PWM generator modules The modules are controlled through memory mapped registers The heart of the circuit is the 85151 MCU which makes full use of its external memory bus A
232. the L1 0 WSTH50 1 LEDs this time One of the non blink ing LEDs failed at 30 mA before I began recording its voltage Although that s above the usual 20 mA continuous rating a device intended for use directly across three AA cells shouldn t fail at such a low current That makes three failures of po 0 oes d 1 12 1531 2 2d 28 3 42 35 UNA Flashlight LEDs the four original LEDs The blinking LED worked fine for currents under approximately 18 mA Above that level it exhibited brief inter mittent open circuit fail ures Although I couldn t see anything obviously wrong with the internal wire bond attachments I don t have failure analy sis facilities Figure 2c shows the voltage versus current curves for the two remaining flashlight LEDs the first white LED I installed and a red LED as a baseline Notice that the forward voltages for the two flashlight LEDs are much much higher than that of the white LED from my stash The flashlight uses three AA cells that provide approximately 1 6 V each when they re new for a maximum of 4 8 V The non blinking LED passes 15 mA at CIRCUIT CELLAR a Bad T by LED a Thar LED LED Current mA Figure 2a Ten nominally identical white LEDs show a wide variation in for ward voltage for a given current The voltage for LED D the top trace actually drops slightly between 25 and 30 mA
233. the board to convert RS 232 serial data from the MCB2130 board to compatible USB data for the PC The CP2101 is highly integrated and requires no components other than a USB connector It includes a USB 2 0 full speed function controller USB trans ceiver oscillator EEPROM and asyn chronous serial data bus UART with full modem control signals The device s packaging is an unbelievably compact 5 mm x 5 mm MLP 28 I ve soldered many surface mount components under the microscope on prototype boards but this device was by far the trickiest espe cially because it doesn t have external leads If you plan on soldering by hand make your PCB footprint pads a bit longer to allow for better solder flow with a fine tipped iron Looking toward the software end of things the nice part about using this device is that special software isn t needed for the RS 232 to USB conver sion This allows USB communication to become totally transparent for the LPC2138 and its UART Just connect the LPC2138 UART pins to the CP2101 and it will take care of the rest You ve probably guessed that there must be some software intervention for CP2101 data to get to the PC over USB Yes there is It s via a virtual COM port driver installed on the PC side These drivers make your USB port seem like another COM port on your PC s operat ing system thus the virtual COM port name Silicon Labs provides the virtual 24 Issue 177 April 2005 Photo 2
234. ting code for various actions or events like receiving serial characters or a button click is extremely simple For this application the goal was to take serial data from the virtual COM port convert it from a raw temperature CIRCUIT CELLAR data rate etc It also allows you to respond to a variety of events like receiving characters The COM port speed is preset to 9 600 bps to match the speed from the MCB2130 board The receive Comm event will pro vide a receive character event and allow viewing and reacting to incoming serial characters from the virtual COM port After the raw temperature A D data has been received it can be converted to real temperature data for graphing This conversion involves multiplying the raw temperature data which is the LPC2138 s A D sampled voltage by the A D reference 3 3 divided by 10 bits 2 1 024 Following this the LM60 sensor s 424 mV offset must be subtracted The value left must be divided by 6 25 6 25 mV C to get the actual temperature in degrees Celsius and then converted to an integer After the temperature conversion is finished MSChart Control provides the graphing By adding this compo nent to the project a variety of charts and display options are provided for graphing data Little set up code is needed because the chart is set up beforehand via the chart properties windows This is definitely an advan tage You can modify the component controls vi
235. tion code the device needs to be set up after it s powered on Fortunately most IDEs will either set this up for you or provide some kind of boot assembly code to handle the task For this par ticular project I used the evaluation version 16 KB code size limitation of the Keil uVision3 environment I was pleasantly surprised with its boot up implementation The graphical config uration wizard allows you to modify the proper setup registers for your appli cation This made the boot and start up process transparent and allowed me to focus on the application itself Let s look at the LPC2138 s PLL setup as an example To change the PLL mul tiplier value on the LPC2138 you must perform a few extra steps after writing the new multiplier and control values to the PLLCFG and PLLCON registers These steps entail writing OxAA and then 0x55 to the PLL feed register PLLFEED This action loads the PLL control and configuration information from the PLLCON and PLLCFG regis ters into the shadow registers that actu ally affect PLL operation It s basically a good way to prevent accidental chang ing of the PLL value This code imple mentation is taken care of with the pro vided boot code in uVision3 Punching in the desired multiplier in the GUI automatically updates the boot code I learned this the hard way in a different IDE when designing with the LPC2106 The point is that using the graphical configuration tool is an easy and fast
236. tion compatible eta rting at S49 between families and packages ae Easy online access to application notes Extensive peripheral integration everythin sind PHONE eu Gerona ADIRE example code software development tools from POR and LVD to CRC counters C Compiler Assembler IDE Cost Get your product to market faster using Renesas Interactive SKPSCMINIT3 R5F21134FP 49 SKPSCMINIT R5F21174FP 549 Evaluate test and learn SKP16C26A 30260 FREE 49 about Renesas products SKPIGC26 M30280FAHP intei d 54 in an interactive online SKPIECE2P NM3a0626FH vertical 49 aKP32CB4 M30845FH3P S4 E negra prong is ini US dollars from Aenesas suthonzed North American datribusnrs only and is subject bo change Popular Devices Data Flash KB 9 SE e BP 8 1 E amp Series EE E NE Group Part Number D w 5 R8C 17 R5F211725P 18 20PinSS0P 20 g 2 512 1 1 15 WOT 513907 RBC 13 RSF21134FP 16 32PnlFP 20 9 16 4 W 2 2 2 X X WO 5238 MiBC 26A MSOZBDFBAGP 16 ABPinlOFP 20 13 2K 3 1 12 X X 5476 Mi6C 28 M30281FAHP 16 20 886 4 55 13 X WDT a MiBC B2P M3OG2AFGPGP 16 100 24 16 256 20K j 3 87 26 X XO TMWOT 8 25 M16C 82P MsoS26FHPGP 16 MXPinOFP 24 16 38 5 3 H7 28 X X 10 05 M32C B M3DRASFIGP 168 MAPnLGFP 32 32 512 22K 5 5 124 3 X X 1I
237. titasking BASIC modules for quick propects 100 000 ICOM2ZO0 ready made wit LCD and Touch240 controler Il with touchpad and LCD display USB gt R5465 USB COM dinar iseisiged cr L6S COMIS offer eni powered USE 30 ASSES conver wilh baud rales T1B4bps JMbps PC thinks ils taking io a COMnpon only 48 85 CAN USB CAN LUSB inielipent CAN con nection from PC s LSA port Provkles Hug n pay opto solat ed SJ47000 CAN canitroller with 128kB of on board Flash and SRAM memory from 253 65 Tinytag Instrument A range ol high resolution data loggers Gesagnod for the maniloring of lemperalurg across a wida ranga Hun accuracy 12 bit 1 5080 only 1787 Co Inc f 565 385 1768 USB to 24 x VO R35232 422 4B85 KI Bp 5n RE 22 985 Bo Bp igolaied RS 422 4855 K2J 232 Bp 3p isolated RE232 25 26p R amp 232 KD4 5 5TD Difirail solated KD4S5 PROG programmab ae uroquartz Europe s largest mtr of quartz crystale asc a filters and frequency products Custom fiers high rel rad tol aso s Novel EQ HM soreac spacium oec mduce PV problems FT2232C tatest version af FTDls aasy use LUSB sarial combines two serial or parallel devices combined in one ic FT2328M FT 2458 4 28 10k USB Bus Analyzers Tracker 1t xplorar 200 high panamenca economical USE 1 420 protocol anah reg Pe
238. tives including devices with extended address space and enhanced instruction sets Contact us today for a Free Demo CD 800 348 8051 wwW keil com 16 1 177 April 2005 firmware my friend Brent Taylor developed a PC application called AVRcamVIEW to provide a cross plat form calibration and test environment for the AVRcam The application which makes the system accessible to anyone with a PC was written in Java It can be executed on any plat form with the appropriate Java run time engine Windows Linux and Mac OSX are currently supported Note that it interfaces to the AVRcam through the RS 232 port on the PC AVRcamVIEW allows you to take full resolution color snapshots with the AVRcam It displays the captured image in both a Bayer format and a bilinear interpolated version in which it calculates a 12 bit color value for each pixel in the image Each image dump takes about 4 s to transmit the full image back to the PC at a data rate of 115 2 kbps This image then can be used to better understand how the AVRcam views the surrounding environment A dumped image also can be used to configure the color map on the AVRcam You can use the color map to set the bounds of the eight colors that the AVRcam can track In addi Listing 1 The core function is for sampling pixels mapping to colors and run length encoding the line The routine has strict timing requirements regarding the number of cycles it takes t
239. tools There s a growing need for micro controllers with increased Servicing your Prototype needs Instant online price quotations No Hidden Costs Tooling and set up included No Minimum Quantity Any Contour Full DRC on all orders Top Quality and on time delivery if your fast turn rou ind is late get it free POOL COM 10 Issue177 April 2005 CIRCUIT CELLAR computational power and larger program memory sizes because of the transition of code development method ologies from assembly to C language The PIC18F8722 8 bit microcontroller series addresses these performance and memory needs by providing linear access no pages to a memory space as large as 2 MB while offering complete code and tool compatibil ity with smaller Microchip microcon trollers In addition the new microcontrollers include two synchronous serial ports capable of SPI or and two asyn chronous serial ports LIN capable USARTs for expanded connectivity Pricing starts at 6 81 in 10 000 piece quanti ties perius CSPI Microchip Technology Inc www microchip com PCBPOOL COM www circuitcellar com T CHLAR PIPER Problem 1 15 it possible to create a digital Problem 3 If you could operate your all pass filter that has a group delay that s automobile on Mars what would the brak a fraction of the sample period ing distances be like relative to Earth Problem
240. ts as opposed to covering the servo s 1 ms use ful range with 8 bits Likewise a generic 16 bit PWM module would generate an effective 12 bits of servo resolution A solution to this problem is to perform the PWM waveform entirely in firmware through bit banging Unfortunately this can use up a lot of the MCU s resources It requires criti cal firmware timing A simpler approach is to purchase a purpose built servo controller board and let it handle the critical multichannel timing while sending low overhead position com mands on a standard serial port COMMERCIAL CONTROLLERS Scott Edwards Electronics s Mini SSC II is the best established serial servo controller on the market It allows you 3to5V www circuitcellar com k gt 2 mS 16 to 20 ms Vera V t milliseconds 1ms 90 3to5v1 t milliseconds Figure 1 An servo position control signal consists of a pulse width modulated digital pulse train The 1 5 ms pulse width moves the servo to its middle range or center position Varying the pulse width from 1 to 2 ms will rotate the servo from one extreme to the next to control up to eight RC servo channels simultaneously The Mini SSC II uses an efficient unidirectional binary serial pro tocol for controlling the servo chan nels see Figure 2 This protocol has quickly become the de facto standard A large number of serial servo con
241. u can watch robots slug it out in an RC arena with flippers CIRCUIT CELLAR nerve bundle Modality Receptors X Receptive spike train Stimulus and blades But the robots aren t autonomous they require an operator They have no input feedback between the processor and an output function The only input feedback is what the opera tor sees Locomotion accuracy is based solely on the operator s ability to adjust the robot s move ment in real time Weapons are also operated in this fashion Many times however winning a battle depends more on equip ment functionality than on a par ticular battlefield strategy Robots are also used on assembly lines Do the sparks generated by automatic line welders fill you with a feeling of respect for industrial power or do they worry you about the future of the human labor force The point here is that even those robots have lit tle or no feedback Many will contin ue performing their programmed tasks io ECT a Meissner s Merkel corpuscle cell corpuscle endings Location field Intensity and time course Neural jf ip te 1 L L Figure 2 Take a look at how each type of nerve cell responds to stimuli The pressure cells respond only to changes in pres sure The vibration cells have a continuous response www circuitcellar com Photo 1 Solid state pressure sensors contain sensing ele
242. uation The P89C51RD2 has five programmable counter array PCA chan nels This on chip periph eral is similar in function to the popular Intel 8254 programmable timer IC The PCA provides more timing capabilities with less CPU interven tion than standard PCA Timer LS Interrupt service routine using the port pin the pin still can be used for standard I O Each of the five modules can be programmed in any one of several modes Rising and Falling Edge Capture Software Timer High Speed Output HSO Watchdog Timer and Pulse Width Modulator PWM The timer counter for the PCA is a free running 16 bit timer consisting of registers CH and CL which are the high and low bytes of the count values It s the only timer that can service the PCA The clock input can be selected from any one of four sources Special function register CMOD contains the count pulse select bits CPS1 and CPSO that specify the PCA timer input This register also contains the ECF bit which enables an interrupt when the counter overflows In addition you have the option of turning off the PCA timer in Idle mode by setting the counter idle bit CIDL to reduce power consumption Each of the five compare capture mod ules has a mode register called CCAPMnh n e 0 1 2 3 or 4 to select CCAPOH CCAPOL Match Module 0 PCA Interrupt optional Next compare value CCAPOH CCAPOL Clear CCFO timer counters Its advantages inclu
243. uei77 April 2005 rx FIFO Previous line buffer UART configuration Interface manager tx FIFO Figure 3 Familiarize yourself with the AVRcam software architec ture Here are the major classes with their data structures crystal signal isn t output by the OV6620 by default however setting one of the registers in the OV6620 through its C interface can enable it But the ATmega8 can t set this register in the camera because it has no clock source to execute instructions Ah yes the old chicken before the egg problem The best solution I could come up with was to add the smallest possible microcon troller to the board to take care of set ting up the appropriate register on the OV6620 to output its clock source Enter the AVR ATtiny12 This small 8 pin microcontroller had everything I needed an inter nal 1 MHz oscillator and up to six I O lines Two of the I O lines were configured to bit bang an interface to configure the appropriate reg ister on the OV6620 to output its clock signal I used anoth er I O line to hold the ATmega8 in Reset mode until the clock signal was set up and stable This solution worked well and added only a slight delay at start up Must complete in 16 clock cycles There isn t much left to the hardware The system includes a standard MAX232 level conversion chip which supports RS 232 level serial communications through the ATmega8 s UART in addi ti
244. uld unfold A command center located a safe distance from a gate controls the entry of vehicles into a compound The students task is to set up a wireless control system that com municates with the gate and the vehicle The project introduces students to the concept of a master slave multi processor environment During pre liminary discussions with tutors the students soon realize that this is the way to go The concept of distributed processing is also discussed at this stage Next the three modules of the sys tem are outlined and a basic flowchart is developed see Figure 1 Each system is equipped with a transceiver even if both sections transmitter and receiver aren t used in anticipation of future experi ments based on these systems which may require both sections in a module Motion and position detectors are added to increase the command center s intelligence Optical sensors are used because they are inexpensive to mon itor the truck The sensors which operate on a simple proximity reflection principle should be infrared not visible to minimize room light interference The microcontroller however doesn t have interrupt capability so the virtue of interrupts hardware versus polling software arises for discussion Although hardware interrupts win the debate stu dents are compelled to move ahead knowing they aren t available Both truck and gate modules contain motors one analog and one digital st
245. ultiple ven dors dongles drivers etc than if you were to bite the bullet and take charge of the USB side of the equation yourself There s no doubt that the time has come to ditch the past and get on the USB bandwagon The only question I have is What the heck should I do with my closet full of soon to be obsolete nine pin and even older 25 RS 232 stuff Oh well that s progress il Tom Cantrell has been working on chip board and systems design and marketing for several years You may reach him by e mail at tom cantrell circuitcellar com REFERENCES 1 E Huang USB On The Go Overview www usb org develop ers onthego san_jose_otg_presenta tions zip 2 A Denver Serial Communications in Win32 1995 http msdn microsoft com library default asp url library en us dnfiles html msdn serial asp RESOURCES J Axelson USB Chip Choices Finding a Peripheral Controller Circuit Cellar 120 July 2000 J Bachiochi USB DMX Circuit Cellar 172 November 2004 USB in Embedded Design Circuit Cellar 165 April 2004 Eady Mission Possible Achieve Cheap USB Connectivity Circuit Cellar 157 August 2003 J Pollard USB FTDI Style Circuit Cellar 132 July 2001 USB Implementers Forum www usb org SOURCES FT232BM and FT2232C Chip Future Technology Devices International www ftdichip CP2102 Chip Silicon Laboratories www sil
246. upport pcbfabexpress com af GITE development tools for CypressM PSoC NEW ARM compiler Philips AVR amp tinyAVR LPC Atmel SAM etc H 108 11 12 16 Ri fi MSP430 demos on our website ree A Pte gt fv hardware kits gt Elektroniklacen Hcos amp 812 12 design amp starter kits e CANDIP AVRICAN on a chip am e SMS IU T PaSA TAn cadi ex j MC if AMEX JM Check Money Order CIRCUIT CELLAR Hagh Quality PCBs 02 Low Impact Prices Get the most out of the Rabbit s powerful feature set with the first reference book dedicated exclusively to the Rabbit 3000 embedded Systems Design Using the Rabbit 3000 m4 Y Microprocessor Oum i F By Kamal Hyder and Bob Perrin RABBIT www rabbit3000book com S Microprocessor Core Module Reduce your development time and time to market with the ideal core module to simplify integration and design of any control project Based on a 8051 SOC Microprocessor providing 30 digital VO high precision 12 bit analog 64k Flash 128K SRAM and much more Program in C or Basic Controls Non Contact Distance Measurement Machinery amp Industrial Automaton Ultrasonic sensors measure target distances from 2 in to 37 feet e Motion Control S Easy to install a Dimensioning e inexpensive Posirionimg e Many options e High sensitivity OFM models 800 677 3649 e mail com
247. ur USB gadg et is bus powered or self powered Bus powered designs are served with an on chip voltage regulator that con verts the nominal 5 V USB bus voltage to 3 3 V You can choose to add a small serial EEPROM chip if you want to over ride the default USB set tings vendor ID product description transfer mode etc The EEP ROM connects directly to the 2232C and FTDI provides a utility that allows programming it via USB The EEPROM can be shared with a local MCU by virtue of the fact that the 2232C EEPROM interface pins i e chip select clock and date are tristated when the chip is held in reset It s on the MCU inter BDBUSO BDBUS1 BDBUS2 BDBUS3 BDBUS4 BDBUS5 BDBUS6 BDBUS7 BCBUSO BCBUS1 BCBUS2 BCBUS3 SIANUB Issue 177 April 2005 79 face side of the part that the 2232 breaks new ground starting with two completely independent ports The power up default configuration has both ports configured as PC COM port style UARTs including a complete set E of modem control lines RTS CTS etc The big news is that the ports also can be configured in a vari ety of other modes including FIFO MCU bus emulation and clocked serial These additional modes enable higher per formance across a broad range of applications In some cases they may even eliminate the need for an MCU altogether For instance to support the migra tion of PC based emulators download ers and flash me
248. ush or small sander manual or computer controlled to remove the markings Using off the shelf components make it extremely easy for an attacker to obtain information about your product Designing with proprietary custom devices or at least off the shelf cores with custom functionality will prevent most attackers from easi ly reverse engineering them But this solution isn t practical for all designs ACCESSING COMPONENTS Make sure sensitive components that are most likely to be targeted for an attack e g a microprocessor con taining product firmware ROM RAM and programmable logic are difficult to access Covering specific components with a conformal coating or an epoxy resin can help to prevent tampering Conformal coatings and encapsu www circuitcellar com lates are typically used to protect devices from moisture fungus dust corrosion and tampering Urethane provides a hard durable coating that offers excellent abrasion and solvent resistance It shrinks significantly dur ing curing which may stress compo nents Epoxies also offer excellent resistance to moisture and solvents Usually consisting of a two part resin the coating also shrinks during curing leaving a hard difficult to remove film that makes it difficult for attack ers to probe the device and remove it from the board Such products are provided by a large number of manufacturers Unfortunately I don t know of any coatings that
249. ution you re looking for QTC Cable is manufac tured like RG 59 coax cable The core insulator located between the inner conductor and the outer shield replaced with QTC material CIRCUIT CELLAR Note that the QTC Cable can be terminated with a standard BNC plug Its minimum bend radius 10 cm pre vents erroneous switching QTC FORCE SENSORS A QTC Force Sensor has a large lam inated surface area capable of sensing large impacts It can be manufactured in various sizes and shapes to over 1 m Similar to the Switch Substrate the Force Sensor features a connector tail for electrical attachment via conduc tive epoxy solder or riveting The choice of lamination provides some level of force impact distribution When mounted to a hard flat surface you can alter the sensor s sensitivity by adjusting the size of a pressure spreader attached to the top surface MY HERO What comes to your mind when you see the word robot Many people think about R2 D2 and C 3PO Kudos to George Lucas for making these two robots popular trivia subjects Robotics enthusiasts usually think of the Heathkit Hero which was one of the most successful robots ever produced You won t find robots on Heathkit s web site www heathkit com however you can follow the support link to sites that are continuing the proud tradition Although the original Hero s arm Photo 6 My Hero robot can successfully pick up an egg without cracking the
250. vance started with lots of technical obstacles and naysayers predicting their failure If you look at how far we ve come you can easily envision that fuel cell batteries will be in common use eventually for one never want a battery that is dead as a doornail again prefer the option where can simply say Fill er up steve ciarcia Q circuitcellar com L ___ 96 Issue 177 April 2005 CIRCUIT CELLAR www circuitcellar com MAZ 18 Channel Fortawe Logic Analyzer L x o dens miris Sipp en A E ties Auto Hardware Com ression Ca tures from 128K to 30 Billion Samples 10ns resolution only 3499 00 UP TOO MAES OF 10057 cage ang Fallen 1 Hea Me Naraware press r Job POWErES TOT POs lity S Analysis SSOTLWATE e rage Hace Drag Snap NAVETO NEXLErEVIOUS Nearest cage snapping VIT T a Weta aeS WIUTLITRASTOUDS 3p Waverarm views VIIMINE Calo UES try one Software QuickWriter Multi Function PlCmicro MCU Programmer In Circuit amp Gang Operation only 199 00 Jugyuri Bey bx TB Series HGM Maus usi Ez Lits Ero eon rain Manuel seriatization im Gode or EE Vata FITTTWTE sure Tzes t0 version GOMITO res protect setings ACCEBIS Command Gine TF aramelters d ESUS
251. venture with our BASIC Stamp controlled Boe Bot Robot Kit We ve packed it full of everything you ll need to build an intelligent robot just add a PC The included Robotics with the Boe Bot text will walk you through robot assembly programming in PBASIC and on to many illuminating Boe Bot experiments Thesolderless breadboard on the Board of Education makes it easy to create a circuit and very versatile for when you re ready to move beyond the book Free technical support completes the package The Boe Bot robot is suitable for ages 14 and up Boe Bot Robot Kit Serial 28132 199 00 Boe Bot Robot Kit USB 28832 199 00 Order robots online at www parallax com or call the Parallax Sales Department toll free at 888 512 1024 Mon Fri 7 a m to 5 p m PT BASIC Stamp Board of Education Boe Bor SsmoBor and Toddler are registered pretefermarks af Perales ine Pallar and the Parallax logo trademarks of Parallax Inc
252. way to set up the microcontroller so you can start working on your application Now that the boot up code is taken care of let s concentrate on the main 22 Issue 177 April 2005 application I chose C language over the native ARM assembly language to write the driver and application code So the next step involved writing a C code driver for a timer interrupt an A D scan and the UART Fortunately the example C code that came with the uVision3 IDE had examples for all the peripherals I modified and used them The code for each peripheral was extremely straightforward and easy to understand and integrate Creating the application code including the C code for each peripheral resulted in the code shown in Listing 1 In this code a timer match interrupt occurs from the interval timer and then the AIN 1 A D channel is read to sample the analog output voltage from the LM60 temperature sensor The analog tem perature data is then masked because only 10 bits are valid because of the 10 bit A D resolution Now the read ing is ready to be sent out the serial port via the UART through the printf statement Listing 1 is all the code you need to read the LM60 tem perature sensor every few minutes and send the raw ASCII converted A D result out of the serial port You must download code to the board and begin debugging at this point I used the ULINK JTAG debug ger which integrates nicely with the Keil uVision3 IDE The debugg
253. wed us the prob lems We needed to push the test driven environment to the next level Now the tests must involve peripherals with externally generated signals rather than the internal sig nals provided by the core timer One TEST CheckPFI nput 1 Set unsigned short unsigned short CHECK pf Wai tForHardwareReady Set ResetPFForl nputASM WATCH MEMORY RANGE ret value WRITE CHECK RestoreUserReg USHORTS EQUAL expect val getReadsWrites MANUALTEST SaveUserRegAndReset WatchData unsigned short pf_ unsigned short up a return value reg pFIO FLAG D ret value 0 switch pattern to 0x03 ReadPFASM expect val 0x03 ret val ue lj RestoreUserReg Listing 6 You can avoid the process of manually setting the input signals by using other internal or external resources to simulate the timing of expected signals from controlled devices But keep in mind that the reliable and accurate generation of the simulated signals as well as the recovery of the simulation from probable error states can be complex and time consuming volatile long int volatile long int nterrupt TI MER2 si gna possible solution is to switch the tests away from the real board and place them on the architecturally accurate simulation environment available with the development IDDE Although the VisualDSP IDDE for the ADSP BF533 supports numerous peripheral si
254. wing us to photograph their bomb disposal robot for the this month s cover One last note to the robotics enthusiasts headed to Hartford this month Good luck in the Trinity College Fire Fighting Home Robot Contest THE MAGAZINE FOR COMPUTER APPLICATIONS CHIEF FINANCIAL OFFICER Jeannette Ciarcia CUSTOMER SERVICE Elaine Johnston CONTROLLER Jeff Yanco ART DIRECTOR KC Prescott GRAPHIC DESIGNER Mary Turek STAFF ENGINEER John Gorsky QUIZ COORDINATOR David Tweed EDITORIAL DIRECTOR FOUNDER Steve Ciarcia MANAGING EDITOR Jennifer Huber TECHNICAL EDITOR C J Abate WEST COAST EDITOR Tom Cantrell CONTRIBUTING EDITORS Ingo Cyliax Fred Eady George Martin George Novacek Jeff Bachiochi NEW PRODUCTS EDITOR John Gorsky PROJECT EDITORS Steve Bedford Ken Davidson David Tweed ADVERTISING E mail dan Q circuitcellar com PUBLISHER Dan Rodrigues ASSOCIATE PUBLISHER DIRECTOR OF SALES Sean Donnelly Fax 860 871 0411 860 872 3064 E mail sean Q circuitcellar com Cell phone 860 930 4326 ADVERTISING COORDINATOR Valerie Luster 860 875 2199 ADVERTISING ASSISTANT Deborah Lavoie 860 875 2199 Fax 860 871 0411 E mail val luster circuitcellar com Fax 860 871 0411 E mail debbie lavoie circuitcellar com Cover photograph Chris Rakoczy Rakoczy Photography www rakoczyphoto com PRINTED IN THE UNITED STATES CONTACTING CIRCUIT CELLAR SUBSCRIPTIONS INFORMATION www circuitcella
255. ww cix co uk rrussell products bbcwin bbcwin html and check it out Compared to the original BASICs of yore BBC for BASIC is extremely improved You can have long variable names and line numbers are only required for state ments that are the target of branches Fortunately you don t need many of those because it has a good complement of structured programming features e g proce dures with local variables making for readable code instead of GOTO spaghetti Otherwise BBC BASIC is an interesting mix of powerful features 32 bit integer and 32 or 64 bit floating point math and eclectic ones obscure graphics com mands from the days of Teletext and EGA The GUI is simple and clean just the thing for dashing out some one liners and it has excellent built in HELP Best of all it came with a healthy complement of serial I O features that were easy to use and worked properly on both my XP and Windows 98 PCs The bad news is the free evaluation version is limited to 8 KB of program space The good news is that because it s a tokenizing interpreter 8 KB goes further than you might imagine For example the program I wrote to toggle the RTS line only consumed a couple of hundred bytes Or go ahead and splurge on the full version which is only 29 99 and includes a compiler generate an EXE file Jolly good show I say 84 Issue 177 April 2005 CIRCUIT CELLAR end up having even more USB related support headaches e g m
256. x0100 AFTER Ox Parity None Stopbits Overlay Hex sram poi nter Hex sram poi nter reserved SRAM between addresses OxOFFB and OxOFFF The functions cover processes of using the 12 bit A D converter the real time clock and the PC communications subsystem Suppose you want your application to read the RTC and determine the day of the week For the Micro64 the function that reads the day of the week is located at offset 0 7005 To access this partic ular function via the CodeVisionAVR you must declare and define the func tion with the following statement void Read Day Of Week voi d 0x7D05 Either the result of the operation or an error indication will transmit via SRAM addresses OxOFFE and OxOFFF You must define the SRAM area to obtain the resultant data A simple C statement does this unsigned int Result GOxOFFE Assuming you do the housekeeping AY BASCOM AVR Options Compiler Communication Environment Simulator Programmer Monitor Printer COM port COM2 z Handshake None Baudrate 9500 5 Emulation NONE Parity NGRE z RTS Font Navy Databits 8 Stopbits 1 Backcolor X Cancel Photo 3 You can t miss if you have the right set of numbers As you can see in the tab structures you can invoke some hefty automation within your BASCOM AVR project WWw circuitcellar com CIRCUIT CELLAR Issue 177 April 2005 55 200 MHz ARM PC 104 49
257. xamine how the LPC2138 fits into the USB ARM data acquisition DAQ design DAQ VIA ARM In this simple USB ARM DAQ application the LPC2138 must read analog temperature sensor voltage at a timed interval The data must be for matted and then sent to the MCB2130 board s serial port Therefore you must use the LPC2138 s timer periph eral for the interval timer its A D peripheral for reading the analog tem perature sensor voltage and its UART peripheral for serial communication The LPC2138 s timer is a 32 bit timer counter with a programmable 32 bit prescaler It s an extremely flex ible timer given its capture channels match registers external outputs and interrupt capabilities I preloaded a timer match register for this applica tion The LPC2138 generates a timer interrupt when the timer counter matches this value Its A D converter is a 10 bit successive approximation Issue 177 April2005 21 A D converter A 10 bit reading of the analog temperature sensor provides more than enough resolution for the USB ARM DAQ example The LPC2138 s UART is your typical UART with data rate generation but it also includes 16 byte receive and trans mit FIFOs for added flexibility Given that temperature data is sent out every few minutes the data rate is set to 9 600 bps Now that you re familiar with the LPC2138 s peripherals let s move on to the embedded software EMBEDDED SOFTWARE Before writing actual LPC2138 applica
258. y want as a portable energy source In the meantime how do we keep adding new features to all these gadgets First we improve efficiency If companies want to sell portable computers with everything including the kitchen sink and more than a half hour run time then they have to design special energy efficient processors and circuitry that shut off unused buses logic and memory blocks They also need to find an alternative to energy wasting LCD backlights for portable devices with video displays One technology with potential is organic LED OLED display Of course there are little prob lems It s expensive fragile and the colors fade But hey all that used to be true about the stuff we commonly use today The ultimate solution is a fuel cell battery On the drawing board for the last 50 years a fuel cell is essentially a battery that combines hydro gen and oxygen to produce electricity Conceivably when you need to recharge you would simply pour in a little methanol and away you would go Like gasoline in a car engine the appealing advantage is that for a given volume methanol has far greater energy density than something like Li ion Of course before fuel cells become a reality there are little issues to deal with some fuel cells like to run at 350 C they prefer being constant current generators and they re made with expensive platinum Plus methanol is hard to find and you can t get on a plane with it Of course every technological ad
Download Pdf Manuals
Related Search
Related Contents
ママの声から 生まれた 加湿器です 省エネ 節 電 Chapter 2 - Rackmount Mart Descarga el Manual de Uso Samsung OL46B Vartotojo vadovas TABLE OF CONTENTS SERVICE MANUAL Includes: Standard IGPS-R9084GP User Manual Truecoat Pro-X Fine Finish カタログ PDFはこちら Copyright © All rights reserved.
Failed to retrieve file