Home
COMMUNICATIONS
Contents
1. ndog 5 pue 55
2. PBS 1 PB6 OC2 OC1C PB7 troller s flash memory I created a small procedure that moved sequentially through different initialization settings displayed the current configuration on the LCD and tried to play the small MP3 file When I heard the correct song I looked at the LCD and wrote down the current configuration s ID I was also able to store the 256 color boot up logo in the flash memory The logo is 17 KB long It takes a little more than one quarter of the flash memory The ATmega64L microcontroller s internal SRAM is only 4 KB That s enough to store the code variables that control the program but it isn t enough for buffering Because the data comes from the Internet I have to take care of a small buffer to prevent any skip I hooked up an external SRAM to the ATmega64L microcontroller see Figure 1 The MCU has an XMEM interface that can drive an external SRAM as if it were part of the internal RAM it s on the same address space so the code doesn t have to take care of the external SRAM control signals and wait states But the problem with the interface is that it s in the same address space as the internal 4 KB SRAM so you lose 4 KB in the exter nal memory And because the AVR architecture can handle only a 16 bit address space it would have limited the directly addressable memory to 64 KB which is too small for this project Furthermore I wanted to use the 128 KB memory chip I had on h
3. 3 3V D1 D2 747844 4 T 53005 5300H5 HEARTBEAT STATUS LED FPGA Decoupling capacitors 1 8 RS 232 level shifter optional Figure 2 The 32 servo channels were organized into four banks of eight because of the potentially large currents flowing through the servos Each bank has a local power supply connector that enables external star ground and power distribution The power con nection to the electronics also has been separated out tor across the MCU s power input ing the pulse generation phase which connector can potentially generate runt pulses An 8 bit system configuration regis TRUE CONCURRENCY ter ctrl reg allows you to select certain A 100 000 gate Xilinx Spartan IIE FPGA houses the 32 parallel PWM generation modules Each module has a 16 bit register pair MSB LSB that specifies the respective pulse widths 12 bits are used The resulting group of 64 byte registers is memory mapped to an external memory bus Figure 3 is a block diagram of the FPGA s internal architecture I created the FPGA design in VHDL with Xilinx ISE tools The master 16 bit counter on top is driven from the 4 MHz system clock which is conveniently generated externally by the ATmega8515L microcontroller A bank of 32 independent PWM genera tion modules is synchronized to the master counter The UPDATE_REQ signal is trig gered at the master counter s quarter count mark It s used to generate an interrup
4. D gt H Device to host GD Get descriptor device Descriptor type device 12 01 08 Show first 2 bytes and total num ber of bytes transmitted in hex 8 H gt D Host to device SA Set address 2 Address is 2 D gt H Device to host GD Get descriptor device Descriptor type device 12 01 08 Get all 18 bytes of d8 04 08 Device descriptor 00 01 02 D gt H Continue getting GD Config and String Config Descriptors H gt D Host to device SC Set configuration 01C Config is set to 1 00 ff 00 Mouse data transmitted once HID H gt HID Host to HID Sidle Set idle stall I gt H Interface to Host HID RD Report descriptor 05 01 08 50 bytes of report a1 00 08 Descriptor are 15 00 08 transmitted 81 02 08 05 01 08 25 Tf 08 cO cO 02 00 ff 00 Mouse data transmission starts Repeat eight times 00 ff 00 00 ff 01 Repeat eight 00 ff 01 Continues drawing figure 00 01 01 8 until unplugged Table 4 The HID report descriptor was transmitted correctly in this debug output from a run made after the early runs that revealed an error In this run a compiler error caused the report descriptor to be stored incor rectly and the USB enumeration failed The problem occurred in the fi
5. Low Cost Logic Analyzer for FPGAs Internet amp Connectivity Intelligent Automatic Garage Door Opener PIC and Sensors Sophisticate Automation Call Sean Donnelly now to reserve your space 860 872 3064 e mail sean circuitcellar com ABOVE THE GROUND PLANE RF Attenuation Resistors at RF APPLIED PCs Embedded USB Made Simple FROM THE BENCH Surface Mount Technology Guide SILICON UPDATE Best in Show 94 Issue 178 2005 CIRCUIT CELLAR www circuitcellar com High performance Low cost Do you want to add networking to your embedded devices but keep getting stung by high product and development costs Help is at hand 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 With more than 40 million devices 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 Editorial Director Are You Driven by the Means or the End Eus you are among the people who frequent the Circuit Cellar Discussion Board forums http bbs circuitcellar com phpBB2 Along with interesting handles occasionally we get some thought provoking questions like these Does anyone feel like they want to get involved in com
6. e rage Hace Drag Snap NAVETO NEXLErEVIOUS Nearest cage snapping VIT a aeS WIUTLITRASTOUDS SPIT Waverarm views VIIMINE try one Software QuickWriter Multi Function PlCmicro MCU Programmer In Circuit amp Gang Operation only 199 00 Jugyuri Bey bx dB5eresriumicro Maus Ez Lits d suis nl rain ps AUTO Manuel seriatization im Gode or EE Vata FITTTWTE Tzes 10 version GOMITO res protect setings ACCEBIS Command Gine d ESUS MI OTITEOTS Signa TOT Se I EBWETEUG Gere Our Other asd 4 dany adaig aiius 1 ITICIUGES GADES SOTWATE ROWE T Supply m besar __ Mo jarana ig E Times buin EE MART iR k k k E i k _ k k ioois EconoROM Ill FlexROUM lll EPROM amp FLASH Emulation at its best from 179 00 Paper Fuga m Ee limy r amalnmar lemmas LI li pra geen rmm This minimi s P d Vi lama i 1 m HI HEH HE E ___ _ E x P 6 umm E um EN HN Fem osa Lgs Ba LL 8 if tools Copyright 2005 TechTools E DigiView FlexROM E
7. i LOW data 3 temp st EERE A GET http temp 5 switch temp UE tepdatalen out n dof packet TCP_datatk http_ok i 1 lt lt 8 http ok i 2 j 72 while j gt 1 if j packet TCP_ data k http ok i set_fin packet enetpacketLen11 0 0000 ear 802 11 length EC fs the number of bytes A nowledged dete how many bytes are ai tanding and adjust the outgoing sequence number accordin AE S ENT AA ick lt p ed ack my seqnum expected expected incoming my expected acknowledgem expected ack my segnum BAR RE len out tcn nacket c c_projects_avr airdrop_memory airdrop_amem_icc c amp SRAM start 0100 2 SRAM size 65536 Temporary page buffer 256 SRAM start 1100 Loaded objectfile PROJECTS_AVR airdro JTAGICE mkII Target received external reset mc ee NBuld Messd 2 lATmegai28 Auto topped 1298 Col19 cap num sce v 816 sbe Address o2cc Cob 15 gt 0002 48 54 54 50 2 31 2E 31 20 32 30 30 20 4F 4B 20 1 1 200 OK OD OA 43 6F 6E 74 65 6E 74 2D 54 79 70 65 20 Content Type 0002 74 65 78 74 2F 68 74 6D 6C 20 OD OA OD OA 68 text html h 0002 74 6D 6C 3C 68 65 61 64 3C 74 69 74 6C 65 tml gt lt head gt l
8. I also decided to add a fast 128K x 8 SRAM to the mix this time around With the exception of the additional SRAM there are no frills on the devel opment board other than a standard RS 232 serial port and the Atmel ISP programming portal I decided to include an AVR JTAG debugging pro gramming port to make it easier to debug and correct my coding mistakes The JTAG interface also allows me to show you the details behind the code snippets in this column The Atmel AVR JTAG port is wired to support the JTAG ICE and the newer mkl If you don t breath and sleep with Atmel microcontrollers note that the JTAGICE mkII is identical in operation to the legacy JTAG ICE but it also includes support for the new Photo 1 stretched the original universal Wi Fi design to make room for the 128K x 8 SRAM and its companion address latch also added an official six pin FC portal Cutting jumpers on the bottom side of the board can disconnect the four general purpose LEDs from their respective I O pins After the LEDs are disconnected the jumper removal you can add some pins and jumper blocks to reconnect them to the ATmega128L s I O pins CIRCUIT CELLAR single wire debugWIRE interface found on the smaller low pin count AVR microcontrollers The JTAGICE mkII also supports USB communication between it and the AVR Studio IDE which makes the debugging cycles move much faster I took a lot of flack in the AVR foru
9. Power on in rush SRAM FPGAs Active frequency dependent System supply voltage IP Static Time or frequency Configuration SRAM FPGAs Figure 1 The big power on current surge of an SRAM based FPGA is bad news for battery driven applications Furthermore the configu ration process itself i e downloading the bitsteam consumes power and takes time By contrast flash memory based FPGAs are live and less demanding at power up have to be an electronics expert to antic ipate that the resulting crossed con nections and contending buses might be problematic In fact if you take a close look at the SRAM based FPGA datasheet specs or better yet an oscil loscope trace like the one in Figure 1 you ll likely notice a relatively huge and long lasting current surge at power up This is obviously problematic per haps even a showstopper for battery driven applications But even if power Flash memory antifuse isn t a concern per se it still means you have to size up your power supply circuits to accommodate the surge Otherwise voltage lev els and rise times may fall out of spec and cause the FPGA to burp during start up And of course Murphy assures us that such glitches probably will be intermit tent the worst kind to deal with Then there s the small matter of cosmic rays If it seems as though the stars are aligned against SRAM based FPGAs well that s literally true As I ve me
10. SAUL a Jan Ax k A CIRCUIT CELLAR I2C SPI XA Kits i p amp ISP FLASH PC ISP FLASH prgamzs 90051 md AVR ESPAAE FLASH fom Polis and weh Vows EP inkata ard rocumentrbon inched lor 3159 DUI POAEC KIT alow bediecbanal communications bene any FC and EC SPI oc MPO Masad pacphenals wad inigrinos mi acum alent m lur 00 PC I2C DEV lets the User mie prams a conten the SPOR board dredy uang Rioc Sal Ct Borland Buda elc Includes a sobane DLL for custom user applcalions arat a eem plate fos qb 050 Kits mie the weer fo debug nr praiobyoe amy Pni ps XA based design Kris dude XA Dew Board with Manier ami Debugger Ex hacerse Deuter bal iore Shema Power and Serial Cabke XTEMLD GaxX 23 GS of STEND BXk 33 for 8240 81 ATEHD C3 o 239 03 Lu Future Designs Inc 2702 Triana Bivd Huntsville AL 35805 255 883 1240 Fax 255 883 1241 Serial Ethernet Web Email Simple DTE DCE No SW Changes 99 05 Qty 1 Grid Connect Inc 1 800 975 GRID www serlal to ethernet com www circuitcellar com Chi Maz Progems cerr 00 devices 48 Pin Tess Loge IC Lom p Tw Orig ard proa arand Universa AC BXG
11. rm Mr DUILI II THAN YOU And for those needing even more Functions amp Power see our New 3000 Series Modules Established 1904 www noritake elec com New York Canada electronicsenortake com Los Angeles Factory ISO 7001 Certified Atlanta Boston Chicago Dallas Toll Free Toll Free Toll Free Toll Free Toll Free Toll Free 1 888 395 3423 1 800 779 5846 1 588 218 3423 1 888 795 3423 1 BBB8 296 3423 1 416 291 2946 1 888 326 3429 SourceBoost IDE C SBoost RBL C BoostC usbtest __c SourceBoost IDE C SBoost RBL C BoostC usbtest __c Dne ug amp E File Edit View Project Build Settings Plugins Window Help Aas ET usbtest c 4 E C SBoost RBL void interrupt Cvoid gt usbtest c MEN Files B Browse usb_defs h 28 Output usbtest asm usbtest lst USBRes usbtest hex HN cHUSHIE m bUSBIF gt lt 1 USB Spend Conf i ua elsel ear indicator leds BA if CHUSERST Fie bUSBRST E277 USB reset must be serviced immediately 8 pendii uie b if XUSB address pending gt RDDRESS STRTE Edi Project Build Settings Plugins Window Help xsesemnpucx ox usbtest c Te on 0 8 i 18 0 t cen 11000111b set up timerB as 8 b NER g bRCTIUITV E 77 WAS IT AN A
12. 0x00 0x02 0x01 0x02 0x00 0x01 DeviceDescriptor 0x01 Class code Subclass code Protocol code Maxi mum packet Vendor id 0408 Product id Device M o o K a Number of initialized to start the TO timer with a 10 9 ms period Following this the main program waits until the timer overflow flag is set to call the Servi ceUSB function to handle any USB requests The Servi ceUSB function does one of four things it restarts the system if a stall is detected it reports USB errors it puts the USB to sleep if the IDLEIE bit is set in the UIE register or it calls Process Req if the processing of a pending transaction is complete no CT L 79 0x12 Device descriptor type USB specification release 2 00 0009 release number Index to string that Index to string that Index to string that Tiny 18 bytes long size mi crochip 2 00 describes describes describes vendor product Serial number none possible configurations The interrupt routine is minimal It s triggered by USB interrupts If there s activity on the bus while the device is asleep the activity interrupt will wake the device up If a USB reset is received from the PC it s serviced immediately And finally if there s a set address request from the PC it s also serviced immediately USB DESCRIPTORS Each USB class
13. 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 Delivering the latest with the greatest It s easy to order from our catalog via phone or online in nanoseconds Mouser is the catalog distributor focused 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 New Products New Suppliers a tli company Mew Technologies 800 346 6873 New Catalog Every 90 Days www mouser com FEATURE ARTICLE by Eric Gagnon Digital RC Servo Controller Part 2 Circuitry Details In the first part of this series Eric introduced you to the theory behind RC serial servo con trol This month he describes the design of a high resolution 32 channel RC servo controller with a serial interface Last month I explored the principles behind RC serial servo controllers
14. een Sams Name Address amp Phone for 19 Years Isn t it Amazing 7 Other Modal ADLI2DU 4 Channel Version En 5232 133 00 1 TE Hes shanna Rh F AP Circuits me Intronics Inc A i Logi bad i 8232 and SAMP Rel 00 Bor 13723 i 61 2 Newton St ONTRAK CONTROL SYSTEMS INC nn Ex gt P A 403 250 3406 705 671 2652 Fax TOS 8718127 Edwardsville KS66113 Ax 57 00 COD Tel 913 422 2094 Add 6 00 Shipping WWW IN KS COM Visa Disc staffi apcircuits com www ontrak net NT gum ppm y Phone 719 520 5323 Order online d Cinginecring Labs Pa J J 520 1867 www melabs com Development Tools for PIC Microcontrollers colorado Springs CO 80960 Serial Programmer Boards M BASIC Compilers for PIC MCUs for Plas eran 1 Pre Assembled Board 7 Easy To Lise BASIC Commands Available for B 14 18 28 ROUES Windows Interface and 40 907 PIC MCL s ie MS Jim er A 2 line 20 char LCD Module PicBasic Compiler 99 95 M em 8 nin Serial Port BASIC Stamp 1 Compatible b I 5 most f4 hit Core PiCs 119 95 We gt EN Nec Serial Comm Commands Fill Schematic Diagram Includes _ from 69 95 to 349 95 PicBasic Pro Compiler 249 95 Programmer supports ah MOUs Sain Seria Ga
15. 872 3064 E mail shannon Q circuitcellar com ADVERTISING COORDINATOR Valerie Luster 860 875 2199 ADVERTISING ASSISTANT Deborah Lavoie 860 875 2199 Cover photograph Chris Rakoczy Rakoczy Photography www rakoczyphoto com PRINTED IN THE UNITED STATES CONTACTING CIRCUIT CELLAR Fax 860 871 0411 E mail val luster circuitcellar com Fax 860 871 0411 E mail debbie lavoie circuitcellar com SUBSCRIPTIONS INFORMATION www circuitcellar 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 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 offic
16. Furthermore microcon trollers are usually powerful some have CAN bus and development tools for working with high level languages high er than assembler are usually expensive And I still had to build a programmer That s why I decided to use a microcon troller without an embedded Ethernet interface the Atmel ATmega64L I also used the extremely powerful and optimized AVR GCC cross com piler which is part of the WinAVR package The GCC is the GNU C Photo 1 No PC in Sight T The main board is on the left The LCD back light power supply and switch debouncer board are on the right The LCD is at the bottom CIRCUIT CELLAR compiler used by designers around the world to compile huge well known projects e g the Linux Kernel And thanks to the open source community it s debugged and free I got an AVRISP through the Atmel AVR 2004 Design Contest so I didn t have to worry about any programming issues An AVRISP is an official Atmel programmer for the AVR family One end connects to a PC s serial port The AVR is connected on the other end via a programming connector I used a Lantronix XPort to interface the microcontroller to an Ethernet network The XPort is basically an Ethernet to serial converter It has all the components for interfacing with an Ethernet network including a microprocessor that handles all of the common protocol stacks TCP IP This is important because the TCP IP protocol is diffi
17. Intec Automation www steroidmicros com www circuitcellar com Get a hot deal on ColdHeat a 19 99 value With purchase of 20 or more of component parts soldering equipment test equipment or Kronus Tools RadioShack You ve got questions We ve got answers Must present coupon at time of purchase r E aa PPE ood 9 tl FREEColdHeat m mme dun p With pur hase of 520 of more af omp aun soldering equipment test equipment or Kic 5 PH pera Shomer 9 RadioShack 5 Instructors IF the c customs purchases S mom E omponeni Paris Test Solder E Tool the Price Change key to reduce ig il al the emn al i MG Ene Rex 1 min Pm upon and scan the barcode on the Lipt on DH ho 4 ct pan CBS Ji xn 24 Noe atacopres Vaid Stores only May NEW PRODUCT NEWS SBC SYSTEM FOR INDUSTRIAL APPLICATIONS The IC51 is designed to be a complete industrial con troller assembly It includes a versatile complement of the input and output circuitry needed by many common control applications The IC51 which is based on the AT89C51 microcon troller can be reprogrammed using any number of soft ware development tools and device programmers avail able for Atmel microcontrollers You can program
18. 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 O 2 Serial Ports Shown with optional A D CK a 5 ch 12 bit A D weenn aan Ere Optional USB WiFi adapter and 85 495 ET The 256 ME USB drive shown holds our Debian 3 0 2 ARMS processor with MMU development environment lor ARM Boating to the d velepment m 4 E fla File system aliews code develapment re take place directi an Baots 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 i 400mA n 3 8 X 45 Cross compiler tools are also available for Windenws and Linki www embeddedx86 com 480 837 5200 Tech n ol ogi C 16610 E Laser Drive 10 SYSTEMS Fountain Hills AZ 85268 USA 104 PCMCIA slot a 10 100 Ethernet SPI bus 2 Serial Ports Compact Flash 24 Digital 1 0 12 bit 8 chan AID oy a POCHO0A Low EMI AMD Elan 133 MHz 586 with 32 MB 164 MB optio
19. The XML RPC protocol performs remote procedure calls using HTTP as a transport and XML as the data encoding Requests are issued via a standard HTTP POST request nor mally to the RPC2 URI path on the server The server always sends a response to a request An example XML RPC request response sequence for a GPIB send function is me ee 10005 Ef il u This cycle repeats for O pM each byte of data Again the transmis sion is terminated by an EOI or a line feed The GPIB driver provides a standard must monitor these commands To send data the driver first needs to set talk enable on the trans ceivers to ensure that you re driving the correct signals onto the bus ATN is then driven low to force all of the ZZ ZZ ZZ ZZ Photo 1 Take a look at the GPIB control lines ATN is de asserted so these are data cycles EOI signals the end of the transaction www circuitcellar com CIRCUIT CELLAR Issue 178 May 2005 67 shown in Listings 1 and 2 The availability of a web server in the ZTP package made it extremely easy to integrate our XML RPC server because all of the HTTP processing was handled automatically The XML RPC server hooks into the ZTP web server by overriding the default POST processing function We considered using an off the shelf XML parser based on either the stan dardized DOM or SAX
20. amp mm Dalir quetatipat LAYOUT SOFTWARE Schemetir Capture koloriit Avioplocer a T gt TOLL FREE dim 4877 3908541 EN i Issue 178 2005 79 SILICON UPDATE by Tom Cantrell More Flash Less Cash Actel s flash memory FPGA concept has Tom excited Read on to learn about the ProASIC3 E families of flash memory FPGAs Es no secret that I m a big fan of FPGAs My frequent articles on the subject are full of praise and bright hope for a future in which every designer has their own desktop foundry I imagine simple develop ment tools that make designing a System on a Chip SoC as easy as using a paint program Drag and drop an entire board s worth of modules you choose from a well stocked library click the Done button and out pops your own homebrew custom chip These days you can even include a soft core processor in your FPGA with choices ranging from minimalist 8 bit controllers to full blown Linux RTOS capable 32 bit processors For the utmost in versatility and flexibil ity you just can t beat soft soft ware running on soft hardware since day one While their silicon effi ciency i e area gate will never match a custom chip keep in mind it doesn t have to For many designs the quick turnaround reconfigurability and versatility of an FPGA based solu tion justify paying a bit more for each gate That s
21. contact him at ronbo austin rr com Patrick Jackson received a B S E E degree from the U niversity of Texas at Austin He has been developing embedded signal processing and com puter networking systems for 10 years Patrick is currently a software engi neer at Cisco Systems You may con tact him at austin rr com Scott Shumate is a software architect at Cisco Systems where he s current ly designing Metro Ethernet products He has been involved in the develop ment of embedded communication systems for nine years in the areas of ATM DSL and Ethernet Scott holds a B S degree in computer engineering and an M S degree in electrical engi neering from the U niversity of Kansas You may contact him at scott shumatech com PROJECT FILES To download the code go to ftp circuit cellar com pub Circuit_Cellar 2005 178 RESOURCES Hess Linux GPIB 3 1 98 Documentation 2003 http linux gpib sourceforge net doc index html HPIB Tutorial http ftp agilent com pub mpusup pc iop hpibtut ibO toc html XML RPC information www xml rpc com SOURCES Am79C874 Ethernet PHY dvanced Micro Devices Inc ww amd com TDS 210 Digital oscilloscope ektronix ww tektronix com SN75160 and SN75161 GPIB Transceivers exas Instruments Inc ww ti com eZ80F91 Microcontroller Zilog Inc ww zilog com Issue 178 May 2005 69 by Jeff Bachiochi opeech Synthesis with Spe
22. from the talker Handshaking received data takes on the opposite role from a send After ATN is de asserted the bus has been turned over to another device as the talker so the transceivers must be switched out of Talk Enable mode The driver then raises NRFD and asserts NDAC to indicate that it s ready to receive data 3 After DAV goes low the driver asserts NRED and retrieves the data from the bus the XML RPC server These routines mirror those of the well known API used by GPIB libraries for various platforms like Windows and Linux The functions map directly into the network control functions provided by the XML RPC server to the client software Because of time constraints we implemented the functions for demonstrating the board s functionality Sendl FC SendCmds SendDataBytes Send Recei veSetup RcvRespMsg and Recei ve rather than the entire stan dard API XML RPC SERVER The network GPIB controller requires a network server with a pro tocol that can manage GPIB requests and responses from remote clients The primary requirements for the pro tocol are that it must be simple it must operate reliably over an IP net work and it must be built on top of the ZTP TCP IP protocol stack We considered the implementation of a proprietary server and protocol but because of its simplicity broad plat form support and ease of implemen tation we selected the XML RPC for the task
23. initial GET string For instance following the GET string you could specify a file name to retrieve or include some codes to control or monitor I O pins on the server 1 really wanted to do was set up a simple HTTP server framework and send some HTML to the client browser After that was accomplished I could add the code to serve a real web page and con trol or monitor stuff using the Wi Fi web server s ATmegal28L Let s start at the beginning and fast forward to the breakpoint in Photo 2b The Wi Fi web server module initialized and joined the basic service set 855 controlled by the EDTP AP with a 192 168 0 151 IP address The simple HTTP request http 192 168 0 151 issued from a hard wired PC wasn t equipped with Wi Fi capability A TCP IP session was established between the PC client and the Wi Fi web server via the EDTP AP After the TCP IP session was 38 Issue 178 2005 established the client could exchange data with the Wi Fi web server The client PC then issued the HTTP request via its web browser applica tion The Wi Fi web server received the HTTP request data determined that it was addressed to 192 168 0 151 port 80 the well known HTTP port and parsed the incoming HTTP data looking for the string Normally if all goes as planned the Wi Fi web server will find the GET string It will then push some HTML into its transmit buffer tack on a FIN in the TCP header and transmit
24. l hird prize 1000 Honorable Mention B prizes 500 each Plus five 1000 Bonus prizes 31000 bonus for the best project the 2138 T1000 bonus for the best project incorporating the 2136 1000 bonus for the best project incorporating the 2134 1000 bonus for the best project incorparating the 2132 000 bonus for the best project incorporating the 2137 Deadline entries October 24th 2005 just het wrww cireultcellar comi philips2005 for the compettion rules and entry form PHILIPS sense and simplicity Electron NV 2006 nghi reserved FEATURE ARTICLE by Bertrand Achard TEN i gt P NetRadio IP ES LY HF 200 4 D ESIG N CONTEST Contest Winner Build an Internet Radio Receiver Bertrands Almega64L based Net Radio enables you to listen to Internet radio broadcasts without a The Radio handles the Internet protocols and MP3 decoding tasks M people enjoy listening to the radio Some people use it for ambient background music Others like listen ing to debates and talk shows What about you It probably depends on the types of programs offered in your area Some regions are covered by dozens of stations while others aren t covered at all Times are changing though Many radio stations are now broadcasting programs over the Internet and if you have a relatively fast Internet connec tion you can use your PC to listen in But
25. rd cf reg unsigned int char data i wr cf addr reg addr 1 while data data in set OE NOP return data reg data unsigned int reg addr amp 0x07 reg addr KE OK OE OE CK CK OE OE OO OE OE OEC OK CK OE OE EK CK OE OE OCC OE OEC KKK CK EE CC OEC GGG GE GG KE x Xx x KES After X CK KK OK CE E OE CK OE OE OCC OE OE EO OK CK OE OE EK CK CE OE OCC OE KKK KKK CK EE CC EGG GEEK EGG X EGG XX KG KE x Xx Xx x x x void wr cf addr unsigned int addr TO NIC set ALE addr hi addr lo cir ALE make8 addr 1 make8 addr 0 void wr cf reg unsigned int wr cf addr reg addr data out reg data cir delay ms 2 set WECF FROM NI C char rd cf reg unsigned int char data i wr cf addr reg addr FROM NI C clr OECF 1 while data data in set OECF NOP return data www circuitcellar com reg data unsigned int reg addr reg addr CIRCUIT CELLAR Now let s take a look at the after section of code I still have to leave the combined address data bus in Input mode when I leave a function But the TO NI C macro which puts the combined address data bus in Output mode is only issued in the write address function wr cf addr After squashing a few more minor bugs I found in my port I O pin direc tion assignments which are opposite the PIC I O pin direction bits I finally got the tuple hashin
26. remote server sends the data you can t stop reading even if it sends data too fast In fact if you do you ll lose data and it will result in sound glitches In Streaming mode you continuous ly send MP3 data to the decoder Nothing guarantees that you ll receive the packets in the same order that they have been sent This is especially true when you re working with the Internet Thus the XPort must reorder the packets before you can send them to the ATmega64L microcontroller which can result in a short or random delay Furthermore the Internet does n t guarantee that the delay between each packet always will be the same This results in another random delay So if you barely read the data from the network stream and send it to the decoder you ll have problems If the server s clock has a small drift compared to the decoder s clock your buffer will either slowly fill itself or run out of data The VS1002 family s special Streaming mode addresses all of the aforementioned problems It automat ically adjusts its data rate to keep the buffer 5096 full If the buffer is more than 50 full the VS1002 will www circuitcellar com P _ modem desi F i J ETEN Key benefits Single layout for all speeds ISOmodem The ISOmodem family of products ore pin compatible complete i i Small footprint two chip modems that support all speeds 2400 bp
27. simple and Successful Atmel dedicated staff as well as certified technical consultants are available to help and support your projects See for youself Atmel s Butterfly evaluation kit demonstrates AVR s low power capabi tes and also serves 35 a development kit for the megalb3 microcontroller 50 get your project started off Learn more about AVR at WwW com ad lowpowergvr and register to win a free butterfly evaluation kit See why AVR offers the combination www atmel com ad lowpoweravr Less man 100 2004 Amal Corporston arat and Te looo are regesered eadem You Me 8 3 sendce mar of Corporation NEW PRODUCT NEWS USB POWERED PLED DISPLAY The PK202 24 USB is a 2 x 20 text display with built in font and provision for up to eight user defined charac ters The 116 mm x 37 mm x 27 5 mm unit comes with 3 2 x 5 55 mm yellow green characters on a black back ground with a 160 viewing angle It sources power and data from one USB cable and accepts USB or serial TTL communication Up to 100 modules can be used on the same USB host Splash and start up screens can be customized Luminance is configurable with a timeout setting of up to 90 min The display can accommodate horizontal or vertical bar graphs and also exhibit double sized digits The PK202 24 USB features a keypad interface with 24 keys and a 1 Wire bridge interface that work with 1 Wi
28. the device is in the addressed state and no mouse data transmissions can occur Table 4 shows the com mented output of a run after the compiler error was fixed To turn off the debug output the defi ne DEBUG SERIAL 1 line in USBDEFS h should be commented out SIMPLE USB I chose a chip and software develop ment system and built a circuit board I also tested the circuit board with a simple HID mouse application Now it s your turn The PIC18F2455 provides an excel lent platform for building a wide range of USB devices The BOOSTC C com piler is a low cost alternative to more expensive compilers for PIC software development Good luck al Robert Lang 15 a professional electri cal engineer interested in embedded microprocessors mechanical musical instruments and MIDI He has writ ten several articles for electronics computer and synthesizer maga zines You may contact Robert at rlang netdoor com PROJECT FILES To download the code and a complete parts list go to ftp circuitcellar com pub Circuit_Cellar 2005 178 RESOURCES E Ackermann The Essentials of the C Programming Language Research amp Educational Association Piscataway NJ 2001 Microchip Technology PIC18F2XX0 2XX5 4XX0 4XX5 Flash Microcontroller Programming Specification Debug Output Comments USB Irritating Mouse V1 1 Program debug begins USB initialization complete TMRO up Timer is working
29. when sellz l else Highest priority val 3 downto 0 amp 0000 Output PWM logic pwm out lt 0 when en 0 else sell MSB case both high or sel high Qzoff mode enabled and value 0 Q when pwm val 0000000000000000 and pwmzero enable 1 else l when count 0 when count Multiply value by 2 i ae gt 1111100000110000 else gt 000 amp val 11 downto 0 Count of 63536 amp 0 else Shift left by one for 180 servo control mode deltaT 2 ms reduces the FPGA s design size It s still higher resolution than the 10 bit digital servos can resolve The reason for ignoring the bottom 4 bits of the LSB instead of the top 4 bits of the MSB is that it s still possible to com mand the servo with only the 8 bit MSB for backwards compatibility with the 8 bit Mini SSC II protocol The end result is a programmable pulse that varies between 0 5 and 2 5 ms at 12 bit resolution and 16 bit accuracy Note that the initial 0 5 ms common to each PWM cycle is generated at the end of the period for simplicity instead of at the beginning But this produces the same result because the signal is periodic ATmega8515L CONTROL The ATmega8515L MCU runs the system I developed all the firmware in C language using an ImageCraft ICCAVR compiler The low cost ATmega8515L has many features that make it well suit ed for this application I
30. 0 InOutBuf 1 break case DSPSTR char i l putc c Il nOut Buf 0 putc nOut Buf i whi e c break case SLAVE STATUS Slave Status zc break void Str2Lcd char s char pel while s InOutBuf 0 i 1 AccessKBLCDSlave DSPSTR char void AccessKBLCDSl ave GET KEY return KeyCode void GotoXY char x char nOut Buf 0 X nOut Buf 1 y AccessKBLCDSI ave GOTOXY 1 L 1 L www circuitcellar com Read Clear Display one char at Cursor Display string at Code Set Read keyboard status Read keyboard status last key pressed OxFF gt no key LCD Current pos position current loc 20 byte comm buffer void AccessKBLCDSlave char cmd X position y position strlen Send string Return slave status InOutBuf i 5 Compute strlen CIRCUIT CELLAR table Another routine executes the command TASK MANAGEMENT If your software will be a part of a product shipped in large volumes to remote locations keep in mind that it will be extremely expensive to update if errors are discovered A common error involves overlooking event com binations that occur when an applica tion runs in an intended environment Your firmware should be organized in a modular hierarchical fashion Each independent task should be in a separate module This will help with testing maintenance and debugging By treating e
31. 0x01 DATA 100 EP8FIFOBUF i DATA Send ADC out put data from port D Loop 512 times B0 is active low Read port B looping if bit B2 1 enable command to bit Bl 1 Delay loop to slow down sampling frequency for k 0 k lt 5 k L L 1 SYNCDELAY EP8BCH 0x02 SYNCDELAY EP8BCL 0x00 for 1 0 1 lt 512 i LOB 0x03 0x02 OB 0x03 ReadyLoop2 STATUS OB while JSTATUS amp 0x04 goto ReadyLoop2 0x01 DATA 100 EP8FIFOBUF i DATA Do it Enter number of bytes in buffer high byte Enter number of bytes in buffer low byte all again for second buffer Delay Loop to slow down sampling frequency k 0 k lt 5 k L L 1 SYNCDELAY EP8BCH 0x02 SYNCDELAY EP8BCL 0x00 WWw circuitcellar com 11 ends here CIRCUIT CELLAR can also download the program to an EEPROM on the board Typical applica tions have two C files that are compiled with other files to make the 8051 exe cutable file Listing 1 shows the code added to the fw c file to take data from the ADCO0820 and store it in the buffer If you install the EZ USB files the original fw c file for the application will be located in C Cypress USB examples FX2 bulksrc I copied this entire directory to the FX2APPS directory where I modi fied the fw c file The bulksrc directory contains t
32. 1 Each has its own advantages and disadvantages The FTDI FT232BM is the simplest chip to use but it has two disadvan tages The chip manufacturer supplies a simple serial driver with a user application programming interface It s extremely simple to write a pro gram in Visual Basic to send USB data out the chip at just about any data rate The problem is that the Microsoft USB HID driver sends data in data packets The HID device must decode the data and process it Because the FT232BM has no on chip programming capability it can t be used as an intelligent USB device that does internal processing It s also avail able only as a 32 pin SOIC which makes it a little difficult for the home solderer to use The second chip I consid ered was the Cypress AN2131 The problem with this chip in addition to its small form factor is that it has no permanent memory The AN2131 has USB firmware programming that handles the initial USB response however the USB interface also must be used to download programming from the PC to the device before it can act as an intelli gent USB device I decided to avoid the additional com plication of downloading D 2 www circuitcellar com Serial Comments ports 32 pin SOIC 1 Chip Driver API Software Program Form factor memory Unknown FTDI Vendor FT232BM Vendor None Chip programming not required Vendor written API is easy to incorporate in Windows program
33. 178 2005 d 7 25274 75349 9 4 95 U S 5 95 Canada NetBurner Mod 5270 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 PSoC device changing functionality on the fly in any application Select from hundreds of predefined blocks in our mixed signal library j 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 ur Reduce board size and BOM up to 80 CYPRESS ENHANCED ANALOG Front End with Adjustable Goin Difference Amp Insinomeniohon Amo writ Deroen Shaka 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 anas Toning ur 4 Hour Ippll oOrTIOns SU i n i anime ons support ress com ad psoc ceal 100 pieces 24 72 hour turns Stencils amp As
34. 4 main thread of execution is responsible for processing and exe cuting incoming serial commands as well as updating the FPGA registers with fresh values computed by the velocity loop with bounds checking The 5 interrupt service rou tine ISR If charac CIRCUIT CELLAR interrupt service routine simply buffers any incoming characters The external interrupt service routine raises the refresh_fpga flag Issue 178 2005 45 brightness By implementing two secutive intensity ramps with differ ent time constants I was able to gen erate a really cool heartbeat effect When powered the board truly appears alive FOLLOWING PROTOCOL A serial communications protocol was developed to be compatible with the Mini SSC II so that existing com mercial software could be used A number of modifications were per formed to the original protocol to enable bidirectional communications to and from the board The existing protocol allows the use of OxFF only as the synchronization character This limitation had to be removed to allow the transfer of arbi trary data values The restriction is preserved on the address range OxOO OxEF Because of this compro mise I designed the serial parser state machine with the ability to resynchro nize itself automatically if it receives Servo channel address OxFF during the address slot should the state machine get out of sync Let s take a
35. 510 770 1417 842 vene Fomai E 88 Issue 178 May 2005 Digital USB to Serial 1 2 4 and B part modek R5 232 R5 422 and RS 485 interfaces Data rates to 921 6K bps USB to Digital 48 96 TTL SSR rock compatible Reed and Form C relay outputs Optically isolated inputs Daisy chain multiple units ad a KwWwelectronics com Radio Modules AM amp FM Off Low cast FM transmitters and receivers High performance FM madulgs a Marrc band FH mecdules Transceiyers and Aritenrinas 313MHz 418MHz amp 433 32MH Range to 1900 feet Okwelectronics corm Enter Now Submission deadline October 24 2005 Thank you to everyone who participated in the USB Serial NavDrive II Autonomous Robot Controller NavOrive is combination of software ond hord ware for building custom mobile robot opplice Honk Source ls provided for the extendable C framework that integrales sensor dala and controls a robot s path while avaiding objects Onboard Hash contoins complete application demonstrating MavDriva s copo as and tools S ium Le B 5 xBg PowerPC 3 Axis Compass D 3 Axis Accelerometer 3 Axis Gyroscope GPS Interfaca 4 Channel Ultrasonic 2 Encoder Inputs 2 Axis Motor Control Tracked or Steered Many Digital Analog Inputs and Outputs
36. I also described a true hardware based 32 channel digital serial servo con troller architecture that s well suited for demanding multichannel RC servo control applications Unlike all of the other com mercial offerings the design uses dedicated parallel hard ware resources for PWM pulse train generation at 16 bit accu racy and 12 bit resolution with all 32 channels fully synchro nized This month describe the circuitry CIRCUITRY UP CLOSE Figures 1 and 2 p 44 show the digital servo controller cir cuitry Note that the 32 chan nels were partitioned into four banks of eight Because of the potentially large currents flow ing through the numerous ser vos it s important to carefully plan the servo power and ground return paths In fact large currents flowing through the PCB can result in ground bounce and servo chatter Each isolated bank of eight channels should have solid power and ground copper planes as well as a power con nector mounted on the side This configuration will enable you to connect heavy gauge wiring in a star pattern from each bank to the power www circuitcellar com supply which of course must be able to handle the system s peak current demands The power connector to the MCU and electronics is set aside so you U1 XC28100E 68TQ144C 28 DATAS 31 o9 DATAS 22 30 DATA4 33 i31 DATAS 34 32 DATA _ 55 38 bDATAT 36 39
37. Integrated Knowledge Systems www ystems com 602 705 8978 Wireless Design Challenge Femi Ser 2 freescale Wireless Design Challenge The entries are now being judged Stay tuned for the winners announcement www circuitcellar com m agazine cont ests htm CIRCUIT CELLAR www circuitcellar com INSTANT 4 ANSI C sofi MARKETING 54 Ay m compiler Philips development tools for Be you have a great product but yeu don t want to bother with all the marketing phone calls ond order fulfil t ment We tan handle product premation sales and invoicing tradit card services and shopping cart Fras wabpagest Fulltime phone response s Instant sales office LPC Atmel SAM al ail Version 7 1811 Full featured 45 day a demos on our website l r d bo el Le 1 enl lg E E 5 cd LE e I 1 14 et more time fer yourself f for desi gning new EAN yE ARCAN ee We cam shoot product photos produce H i literature issue press releases and ss AVR 21 ate market product amp Saelig Company Inc p Email 706 Colorado Ave Palo Alto 94303 Cali 1 B88 T5AELIG 650 493 9326 FAX 650 493 9329 CISMBus E 5 l Add Industrial Automatio
38. PCO A8 PCO A8 PCO A8 PCO OC2 PB7 Figure 1 The Wi Fi web server hardware may be simple but without the CompactFlash and 802 11b driver firmware this would ally manipulating the SRAM control lines and the address data bus The CompactFlash card and the SRAM can t operate concurrently when the ATmegal28L external SRAM is under the AVR s spell However it s possible to talk to both the CompactFlash card and the SRAM when the ATmegal28Us external SRAM control bits are dis abled As you can see in Figure 1 the rest of the hardware is pretty simple stuff the way I like it Now let s cover the firmware behind the hardware FIRMWARE The same types of Ethernet packets that flow across wire are almost iden tical to the Ethernet packets that float in thin air That relationship makes it pretty easy for me to reuse some time tested code from my Easy Ethernet series of hard wired Ethernet devices The Easy Ethernet code is basically a minimal TCP IP stack with just enough oomph to get a message from one point to another by way of stan dard Internet protocols Easy Ethernet devices come in two microcontroller flavors PIC and AVR lt ______ 7222 LL 5 CY7C1019CV33 12 ipm Bypass caps all 0 1u c9 C10 C11 C16 JTAG Header just be another standard ATmega128 configuration with external SRAM Issue 178 2005 CIRCUIT CELLAR CompactF
39. RU REIS ro MER talen out t Name lue Ti Location http tenp unsigned OxlOAC SRAM packet unsigned ir 0x028C SRAM ng pac E c c_projects_avr airdrop_memory airdrop_amem_icc c m NWatch 1 Watch 2 Watch Walch 4 7 0 4 Watch 2 AWatch 3 Walch 4 7 amp SRAM start 0100 2 amp 1 Data 7 8 16 Address ox2cc SRAM size 65536 Temporary page buffer 256 SRAM start 1100 oaded objectfile yeu PROJECTS JTAGICE mkII Target received exter Messa 4 Cols 15 0002 47 45 54 20 ZF 20 48 54 54 50 2F 31 2E 31 OD OA GET HTTP 1 1 00020 41 63 63 65 70 74 20 69 6D 61 67 65 2F 67 69 Accept image gi 0002 66 2 20 69 6D 61 67 65 2F 78 2D 78 62 69 74 6D f image x Eum tm 0002 61 70 2 20 69 6D 61 67 65 2F 70 65 67 2C 20 image jp 00030 69 6D 61 67 65 ZF 70 6A 70 65 67 20 20 61 70 70 image pe oF oop x 00031 6C 69 63 61 74 69 6F 6E 2F 76 6E 64 2E 6D 73 2D ication wvni 00032 65 78 63 65 6 2 20 61 70 70 6C 69 63 61 74 69 port address is valid there is data in t incomin ice INS j PSH In temp 5 i D j 0 while temp gt 1 1 http temp i LOW BYTE packet TCP data j Bun temp i 1 HIGH BYTE packet TCP usa while temp gt 0
40. Return code return rc Status Register Status CmdCode Mask Status Result Mask EvStat Cmd Bit Mask EvAck Register Listing 3 Everything in this super simple HTML line between the ht ml gt and ht ml gt tags can be found in the browser window shown in Photo 3 const char r n r n lt ht ml head titl e EDTP Wi Fi PAGE lt title gt lt head gt lt body gt lt b gt lt u gt Wi FI WEB SERVER CODE DOESN T HAVE TO BE COMPLI CATED b gt lt u gt lt body gt lt ht ml gt CIRCUIT CELLAR http ok HTTP 1 1 200 OK r nContent Type text html Server www circuitcellar com AYRStudio cc projects avriairdrop memory airdrop amem icc c AYRStudio cc projects avriairdrop memory airdrop amem icc c E Ele Project Edit View Tools Debug Window Help E Ele Project Edit View Tools Debug Window Help c me Denga breg mme EF ETES BG SOP HR gt G e eo ODA A e x gt a B X x T mm w alue Type Location In P PSH IN Ha tci m ta d Rd unsigned cl Oxl0AC SRAM t temp 5 signed cl OxlOAC SRAM 150 signed cl Oxl0AD SRAM exc ES Signed cl OxlOAE SRAM signed OxlOAF SRAM Signed OxlO0BO SRAM Signed cl OxlO0Bl SRAM j signed cl Ox10B2 SRAM temp 2 signed cl 0 1083 SRAM Signed Ox10B4 SRAM s
41. So I m sticking by my predic tion that the future is bright for FPGAs and that they will play a big and growing role in mainstream applications PROMISE ALMOST SEEN On the other hand The good news is that FPGAs have made great strides in overcoming the basic price and performance hurdles that have been their cross to bear 80 Issue 178 May 2005 AVLX15 4 765 184 XCFO8P Block RAM is something that AVLX25 7 819 520 XCFO8P presumably is or at least could AVLX40 12 259 328 XCF16P be useful in your application AVLX60 17 717 248 XCF32P Rather I m talking about the AVLX80 23 290 624 XCF32P megabits and even megabytes AVLX100 30 711 296 XCF32P of bench sitting RAM that s AVLX160 40 346 624 XCF32P used to configure the FPGA AVLX200 48 722 432 XCF32P XCF16P and otherwise serves no useful AVFX12 4 765 184 XCFO8P purpose see Table 1 AVFX20 7 242 240 XCFO8P The problems go well beyond AVFX40 13 550 336 XCF16P the extra silicon and power wasted by the configuration AVFX60 21 002 496 XCF32P RAM on the FPGA itself 4VFX100 33 065 024 XCF32P Because the configuration RAM 140 47 856 512 XCF32P 16 has to be initialized at power AVSX25 9 147 264 XCF16P AVSX35 13 699 904 XCF16P up that means you need anoth
42. The output enable pulse enables the ADCO0820 s tristate outputs The data from the ADC0820 output pins is read from port D 00 through D7 and stored in the EP8FIFOBUFF array The Issue 178 May 2005 31 5V NC D7 D6 D5 D4 GND 5 V GND 0820 4 700 7805 5 Vour to chip Vin DO D1 D2 D3 BO 5V B1 B2 GND NC not connected Figure 1 The ADC connections run to the 80515 ports D and B 00 through D7 are ADC0820 s data output pins BO starts the data conversion B1 enables the data output pins B2 tells the 8051 that the data is ready routine loops to gather 512 data bytes Finally the buffer is declared full by putting the buffer count 512 bytes in EPSBCH and When the buffer is declared full the routine can t write to the buffer The program simply skips over the EP8FI FOBUFF i 2 DATA command and continues on It then loops through the main whi e loop until the buffers become available again You can use the control panel to make sure the 8051 program works correctly The numbers from the endpoint buffer represent actual voltage levels so you can feed in different DC levels and test the ADC The control panel also enables you to transfer data from the endpoint to the display screen by using the bulk int button Just make sure you replace the string length 64 with the new length 512 Also you need to change the number of bytes to 512 When you re satisfied that the 8051 program
43. USB In this article Robert provides a helpful overview of USB and walks you through the process of choosing the right chip and soft ware development system to build your own circuit board If you re in the market for a USB capable chip you ll appreciate Roberts thorough examination of today s popular options Daniel Cross Cole also realized the pressing need for a USB inter face p 30 Daniel s chief goal was to design an interface to support ana log to digital conversion and measurement applications He accomplished his goal with a National Semiconductor ADC0820 chip and a Cypress EZ USB kit The result is a well designed interface suitable for a variety of practical applications and classroom experiments In USB 2 0 Interface Daniel shares the valuable lessons he learned along the way and outlines how this interface can be used to teach engineering stu dents about signal processing among other things In addition to Robert and Daniel s articles we also have a feature about USB by Stuart Ball p 76 Stuart s particular concern was losing the parallel printer port he had traditionally used to control the various devices he connects to his PC He solved this dilemma with the custom built Atmel ATmega8515 microprocessor based USBLab which plugs directly into a USB port The ATmega8515 is connected to a DLP USB245 USB adapter by DLP Design With eight bidirectional data bits three address bits a read write direction control line a
44. a pseudo image Daniel used more than 100 serial servo controllers with eight PWM channels per controller The same could be achieved with only 26 units SIMPLE SERVO CONTROL Now you know how I built a 32 channel high accuracy high resolu tion RC servo controller with a sim ple serial interface I ensured com patibility with the industry standard Mini SSC II control protocol I even made a few improvements to the pro tocol I also developed Windows based PC control software from the ground up CIRCUIT CELLAR Combining the raw brute force of an FPGA with the intel ligence of an MCU can yield end results that neither could realize easily on its own al Eric Gagnon M A Sc P Eng has been hooked on electronics since the age of 12 He earned two degrees in electrical 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 digitalcreationlabs com PROJECT FILES o download the code go to ftp circuit cellar com pub Circuit Cellar 2005 178 RESOURCE Insect and bipedal walkers Lynxmotion www lynxmotion com SOURCES ATmega8151L Microcontroller Atmel Corp www atmel com AVR C Compiler ImageCraft www imagecraf
45. addElement new Integer 2 params obj ect params Make xml rpc execute gpi b Send Build the Recei ve Vector params new Vector params addEl ement new Integer params params Make addEl ement new 1 1 addEl ement Integer Hashtable xmlrpc execute addEl ement CHI SCALE getBytes the Send remote procedure call params parameters 2 addEl ement new Integer 500 1 the Receive remote procedure cal Hashtable response gpi b Recei ve connected to the server xm rpc new Xm RpcClient http 192 168 1 51 RPC2 parameters list GPIB primary address llString to send in binary format Termination value list GPIB primary address Receive a maxi mum of 500 bytes Termination value and store the response params Receive returns the query response in a hash table with the key buffer Extract te buffer Convert the answer setting of channe ring str new String buffer www circuitcellar com the binary formatted answer response back to an ASCII one in floating point US ASCII and store it buffer This wil 100E 3 for in a byte array be the V di v 100 string CIRCUIT CELLAR Conrad Intel NetSpeed and Cisco Systems on a variety of platforms and processors He is currently a software engineer at Cisco Systems You may
46. array 0x06 www circuitcellar com restoring defaults in the EEPROM that are stored in the flash memory Photo 2a shows the Net Radio per forming an SRAM test Photo 2b shows what happens if there s an SRAM failure In the event of a fail ure the system will display some of the failing addresses what s read and what has been expected This enables you to easily diagnose the problem Because of the AVR architecture you have to be careful when you re programming in C language For example when using an array data is copied from the flash memory to RAM and then initialized even if it doesn t have to be modified see Listing 2 Because of this behavior it isn t possible to store large arrays e g fonts and boot up logos directly The trick is to tell the compiler to store the data in flash memory and not copy it into RAM Then you can use special functions to read the data directly from the flash memory This frees up a lot of RAM Refer to the lcd c file on the Circuit Cellar ftp site for an example Thelcd puts P function puts a string stored in the flash memory on the LCD Now let s focus on the problem of the LCD controller working with 9 bit data packets instead of 8 bit data packets The first bit is O for command and 1 for data so I wrote two different procedures Thelcd command command disables the SPI sends a 0 and then sends the 8 bits of the command using the hard ware SPI Thel cd data co
47. as I wrote the program because the com piler isn t ISO ANSI C compliant and the documentation was rather limited I tried converting an ISO ANSI C pro gram to compile with BOOSTC There were several problems related to com piler errors during program develop ment The SourceBoost on line forum was extremely valuable for reporting compiler errors www sourceboost ipb host com The response time from the developers with a compiler fix or workaround was usually one or two days The on line documentation for CIRCUIT CELLAR GzS 2ktids _ PICISF2455 Ln1329 ColD 20 the IDE was adequate The on line documentation for the compiler is constantly improving and more coding examples are being added PROGRAM THE PROCESSOR The PIC18F2455 uses a different programming algorithm to write and erase the flash memory than previous PICISXXXXX microprocessors Because the 18 2455 chip was brand new when I got it third party programmers had not yet modified their software to support the new algorithm This creat ed a delay while I wrote some soft ware to use the new algorithm By now though I m sure IC PROG and other third party programming soft ware support the new chips TEST SOFTWARE The first program I wrote with the BOOSTC compiler was a small one to blink the LEDs on the circuit board The program was relatively simple to write I also used it to debug the programming software and the ICSP conne
48. bit 2 of the program variable ucfg Secondly I connected a 1 polarized capacitor between 5 V and ground on the USB connector This limits the inrush current when the device is plugged into a USB port CHOOSING SOFTWARE Having chosen a chip the next problem was to deter mine how to program it Assembly language and C language were the two obvious choices After looking at some other USB programs it appeared that the program would be fairly com plex and would probably be a major undertaking in assembly language so I decided to use C language The main challenge to using C was locating a compiler that wouldn t completely deplete the budget for the project I searched the Internet for a good C compiler see Table 2 PICC was by far the most complete and fully devel oped C compiler At 1 900 it was also the most expensive for a compiler that would work with all Microchip Features SourceBoost BOOSTC HI TECH PICC B Knudsen Data CC5X Custom Computer Services PCWH Version 1 8 8 05 3 2 3 212 ISO ANSI C No Partial no recursion No NO IEEE 32 bit floating point No planned for future Yes 32 bits but not IEEE 32 bits but not IEEE Mixed C and assembly Yes Yes Yes Yes PDF User manual No On line help for IDE mini mal on line help for compiler Yes 395 pages Yes 109 pages Yes 257 pages Separate linker LINKER EXE HL
49. board ID command at any time The Ret ur nAck command causes the opcode to be returned to the host The firmware doesn t buffer USB or serial data If the DLP USB245 stops accepting data the firmware will hang and wait for the 78 Issue 178 2005 tant that the timeout is set like it is in the TestUSBLab py code because this allows the code to read from the USBLab without having to wait too long When processing returned data from the USBLab you need to process 1 byte at a time because the opcode data pairs may be broken up into two USB transmissions In gen eral you should read an opcode and wait for another byte if no more data is available You can t guarantee that a single read from the USB COM port will return both bytes of a pair I O timing using the USBLab is a bit different from timing using a parallel port With the parallel port your code can manipulate the data bits in line and know when the actual bit changes occur With the USBLab the USB interface introduces unknown latency in between writing data and the actu al changes on the expansion connector outputs In addition the DLP USB245 has a latency timer for determining how often to transmit stored data to the PC You can synchronize the USBLab with your code with the Ret urnAck command The USBLab processes com mands in the order they re received By executing a series of parallel write commands followed by a Ret urnAck command you can be certa
50. but the vendor written driver and API don t support Microsoft MIDI or HID device drivers Mainly used for converting USB port to serial port 8 KB RAM EZ USB core will enumerate it as a USB device without firmware USB interface can be used to download code to RAM Microsoft C or Windows assembly Microsoft Cypress 2131 8051 deriv ative 8 KB OTP or UV erase 24 KB Microsoft C or Windows assembly Microchip Microsoft PIC16C745 Microchip 40 pin PDIP Interfaces with existing Microsoft drivers and API Limited memory options make software development difficult Microsoft Microsoft C or 28 pin PDIP Has erasable flash memory PIC18F2455 Windows assembly Flash memory Table 1 Take a look at a few of the popular microprocessors with USB capability programming to the device The Microchip PIC16C745 was the third chip I considered This looked extremely promising with a nice 40 PDIP form factor however it s only available in a one time program mable or UV erasable form Because I didn t feel confident programming the chip correctly the first time and because I didn t want to purchase a UV eraser I decided to pass on it The final chip I looked at was the brand new Microchip PIC18F2455 which had everything I wanted a nice 28 PDIP form factor and plenty of electrically erasable flash memory Because the flash memory isn t lost when the chi
51. easy to give you access to both free and subscription based radio stations while letting you configure your Net Radio on an easy to use interface With such a system you could easily add fancy features to your system and modify the screen s colors I couldn t build my ideal system because I didn t have a server on the Net that could host my central server However the Radio would work with such a system if you were to add a few lines of code that would allow it to retrieve its configuration from a 28 Issue 178 2005 Net server a kind of bootloader You re already ahead of the game because the Net Radio can read the station list from its EEPROM Plus I ve already built a tool for creating EEPROM images from a list of radio stations and configuration settings This allowed me to keep the user interface simple You can select radio stations and control the volume Even people who don t like computers and cell phones can use the Net Radio It s extremely easy to operate STATION IDENTIFICATION After your Net Radio identifies the stations it can connect to it will pres ent you with a station list Use the Up and Down keys to scroll through the list see Photo 3 After highlighting the station you want press the Right key This will connect you to the sta tion by sending the correct initialization sequence to the server The system will then receive and play the MP3 stream The main menu will reappe
52. er bunch of megabits or AVSX55 22 144 832 XCF32P megabytes of memory to store Assumes bitstream compression CIRCUIT CELLAR Table 1 The latest SRAM based FPGAs such as the Xilinx Virtex 4 require many megabits of configuration bitstream and a big boot ROM or two to hold them all a copy of the configuration typically in an FPGA boot EEP ROM That s just great Now you get to pay for and power www circuitcellar com twice as much memory that sits around doing pretty much noth ing In an effort to counter the bloat some FPGAs support com pression of the bitstream But now the FPGA needs even more band aids on chip decom pression and decryption circuits that like the configuration mem ory itself consume silicon and power to little useful end as far as your application is concerned It s as though you were producing a Broadway play and decided to spend a bunch of your budget on a fancy way to raise the curtain are already an proposition for low power i e battery driven appli cations and having to shuttle a bunch of configuration bits from here to there every power cycle doesn t help But in fact the configuration process itself isn t the worst of the power woes Consider that when power is first applied the contents of the FPGA configuration RAM are in a random state Imagine taking a bag full of ICs and wiring them up randomly You don t SRAM
53. especially true for applica tions in which other costs design support and distribution outweigh the silicon cost which is after all the inexorable trend as long as costs keep rising for people and falling for silicon The FPGA price barrier may be gone but that s not the end of the story I m reminded of the fall of the Berlin Wall an event that inspired some people to speculate that it was Virtex 4 platform FPGAs Configuration bits ISP PROM Solution the end of history and that we d all live happily ever after Yes it was good news but as we ve seen the fall of the Berlin Wall really just brought the next tier of challenges into view And so it is with FPGAs For many applications the raw chip price and performance are no longer barriers to design in But euphoria over that fact must be tempered with the recogni tion that a number of lesser and maybe not so lesser issues remain SRAM JAM It s getting ludicrous The latest FPGAs from programmable logic lead ers Xilinx and Altera are looking more like memory chips in drag I m not talking about the megabytes of block RAM that are accessible for your design When it comes to silicon I admit I m a hopeless optimist But thanks to Moore s law there s no folly in that After all these years in high tech I ve learned that tomorrow s wunderchips are an ask and ye shall receive proposition It s only a matter of when not if
54. field too much A quick Net search returned free libraries for all of the popular languages including but not limited to C C Java Microsoft NET Perl Python PHP and 68 Issue 178 2005 The second requirement was free and mature development tools including a compiler interpreter and a windowing tool kit Again this didn t shorten the list much because it only excluded NET Finally to exploit one of our device s pri mary value added features we needed it to be able to be embedded in the eZ80F91 microcontroller s HTTP server as a web browser applet Of course this last requirement made Java the clear choice In a nutshell the client applet pres ents the oscilloscope s screen and con trols translating user interactions into GPIB calls and screen updates The oscilloscope s GPIB interface is like a console that accepts ASCII commands and queries Commands and queries are sent from the client to the oscilloscope as RPCs invoking the GPIB Send method Answers to queries are read back with RPCs invoking the GPIB Recei ve method For example to query the vertical scale i e volts per division of channel one the CH1 SCALE string is sent with a GPIB Send RPC To read the response to the query a subse quent GPIB Recei ve is sent Listing 3 shows the steps in Java language Photo 2 shows the complete system running the Java client application The development board is in the fore g
55. files e g design test bitstream etc that go into your design You can mix and match HDL schematics macros and canned IP www circuitcellar com Consumer 2008 Revenue forcast 6 3 billion Mil Aero Auto 3 6 Communications 42 Data processing 1396 After you have a design the next task is functional simulation using ModelSim to confirm the behavior of your design at a source code level The first step is to create a test bench the stimulus for simulation by drawing input waveforms Running the tutorial example a simple AND gate through ModelSim you can confirm that setting both inputs high drives the output high Knowing that your design is correct in principle it s time to proceed to see if it works in fact by synthesizing Synplicity it into an actual netlist Following synthesis you can simulate once again to confirm that the synthe sized design still behaves properly The next step in the implementation is to have Libero place and route the netlist to target specific gates on a spe cific chip Once again you can simulate the design this time taking advantage of actual timing information extracted i e back annotated from the placed and routed implementation Presuming all is well the final step is to create the bit stream file and burn it into the FPGA Like riding a bike crafting a chip is a slow and awkward process at first I probably spent at least half an hour to
56. for roboticists who long to give their creations a voice And thanks to the technological advances in microcontrollers an inexpensive alternative to recorded voice synthesis is now possible Functional details RC1 E7 Event input 7 RCO E6 Event input 6 E5 Event input 5 E4 Event input 4 Ground E3 Event input 3 2 Event input 2 EI Event input 1 NI OD OF E0 Event input 0 i Serial input TTL 0 V to Vec Master reset i no M1 Mode select 1 data rate configure i 0 V Power input 2 to 5 5 VDC i D2 Buffer half full Data out 2 external buffer half full internal D1 speaking Data out 1 external speaking internal D0 Ready Data out 0 external ready internal i VOUT Voice output Figure 3 The 18 pin SpeakJet can produce canned output based on eight event inputs in Stand alone mode The serial input permits dynamic control a microcontroller www circuitcellar com CIRCUIT CELLAR The SpeakJet speech and sound synthesizer uses a mathematical sound architecture MSA to model the human vocal tract Seventy two discrete allophones are used to reproduce speech The mathematical instruc tions used by the MSA to re
57. functions I wanted for the FFT and data displays Obviously the BulkXferDlg cpp file was extensive ly edited which is why it isn t listed completely All the files for the modi fied bulksrc and BulkXfer programs are posted on the Circuit Cellar web site Photo 2a shows a typical data display Photo 2b shows an FFT display The data Extensive interface Product Line Custom Units amp 5mart Units Digital Relay 1 0 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 WWW RS4BH5 COHM 4111 RE Smith Drive Hamilton Ohio 45011 513 874 4796 www circuitcellar com EZ USB Bulk Transfer Example r EZ USB Bulk Transfer Example b Photo 2a The display shows the first 64 bytes of a whistle sound input Use the Index buttons to find additional bytes The frequency scale is used only for the FFT display The sample rate is 50 kHz b Take a look at one frame of the FFT routine The system displays 50 frames per second which enables you to display data in real time The frequency scale shows the main components of the whistle which is slightly lower in tone than the whistle in Photo 2a comes from a single 512 byte block that s loaded after you click the Fetch Data but ton The data is displayed aft
58. get a single AND gate wiggling in the FPGA It didn t help that some of the screens on the PC didn t quite match those shown in the printed tutorial documentation I ll cut Actel some slack because it s practically incon ceivable to expect printed documents to stay in sync with such a complex ever evolving conglomeration of soft ware There s even a typo in the tuto rial VHDL file itself Maybe it s there on purpose so you can practice the edit recompile cycle that you ll ultimately CIRCUIT CELLAR become extremely familiar with Again like riding a bike practice will no doubt make things easier Notably as you get up to speed you can tweak various settings e g default window arrangements and command scripts to streamline things and have it your way PROPOSITION ME I believe Actel is doing right by the flash memory FPGA concept Beyond the chips and tools themselves it s clear they are aggressively targeting high volume mainstream applications the so called value proposition market That s market speak for cut the price and sell a heck of a lot more chips see Figure 3 I can even see these flash memory FPGAs enabling a new generation of entrepreneurial chip designers Just as the emergence of IC foundries allowed so called fables IC companies to flourish I can see garage shops using Actel chips as the basis for their own foundry less startups I do hope for continued progress making the tools e
59. grammer will use a microcontroller s unused outputs as process indicators You can tell what s happening with an oscilloscope or LED Using speech or sound as a debugging tool can be useful but totally offen sive Discretion is a good idea You might want to implement a way to enable and disable a chatty mode The SpeakJet is perfect for adding speech and sound capabilities to a product without having to use an MCU You may download a sample WAV file I made using the Speakjet from the Circuit Cellar ftp site However by tak ing advantage of its serial communica tion path your microcontroller can harness its power amp Say It View Codes _Say Selection View Codes Clear Say y Data for Selection ShutUp Done Jeff Bachiochi pronounced AH key has been writing for Circuit Cellar since 1988 His background includes product design and manu facturing H e may be reached at jeff bachiochi aci rcuitcell ar com PROJECT FILES To download the speakjet wav file go to ftp circuitcellar com pub Circuit Cellar 2005 178 RESOURCE S Lemmetty Phonetics and Theory of Speech Production Helsinki University of Technology 1999 www acoustics hut fi slemmett dippa index html SOURCE SpeakJet sound synthesizer and Phrase A Lator software Magnevation www speakjet com CIRCUIT CELLAR Cont rol ilj Brus 5h Mo oti ion C C New PIC SERVO SC Single
60. in Figure 5 The boards were designed to be daisy chained so that the RS 232 receive line could be shared among several of them Each board can have a unique base address from which all the register addresses are offset PROTOTYPE SETUP In order to prototype the servo control board I used a Spartan IIE development kit coupled with a hand prototyped MCU board with the ATmega8515L The two boards were linked by wire wrap and the resulting prototype was put to the test driving multiple servos Photo 1 shows the prototype setup driving a custom machined multi axis robotic pan tilt unit One of the biggest prototyping chal lenges was keeping the wire lengths reasonably short In the early debug ging phase the ALE line was too long and it generated spurious triggers that corrupted the FPGA registers A com pact PCB layout can solve a lot of these problems The PWM timing res olution and accuracy figures were all verified on an oscilloscope WWw circuitcellar com PC SOFTWARE None of the commercial programs provided 64 parallel sliders to drive the servo controller board and control the 32 coarse fine servo position regis ters Custom set up commands were also required As a result I imple mented a custom PC control software application with Microsoft Visual C 6 0 and MFC see Photo 2 p 48 The blue bars in Photo 2 indicate the programmed servo travel limits for each channel The top row of 32 sliders contro
61. in a wireless environment Demonstration software and an on board USB interface enable connection to a PC A large pro totyping area with breakout headers and a regulated power supply is included The Master Development System costs 249 Linx Technologies Inc www linxtechnologies com MS SERIES MASTER DEVELOPMENT KIT y a 8 Issue178 2005 CIRCUIT CELLAR ETHERNET SBC WITH RESOURCES FOR LINUX The WildFire microcontroller features the resources necessary to run Linux in control and automation applications With abundant RAM and up to 1 GB of removable SD card program and data storage the WildFire is well suited for Linux and massive data acquisition The versatile WildFire s abundance of digital I O analog inputs and numerous highly programmable timers make it suitable for complex industrial control applications Its small form factor enables it to be embedded in actuators and tight enclosures The Wildfire features 66 MHz ColdFire MPU It has three serial ports Ethernet and CAN ports and enough RAM and flash memory to support full featured commu nication stacks and OSs The SDIO card connector can also hold Wi Fi or bluetooth cards A battery backed clock calendar hibernation feature restores power to the board after it has turned itself off This is useful for power rationed applications such as remote data acquisition The WildFire controller costs 199 The development kit costs 399
62. integer type on this platform Again analyze its operation in mathematical terms Wines m result 0 bitis crial Dit a n 7 1 lesia do result Dii n trial 4 result virial obs 2 while bit return result Problem 3 What is the signal format used in a digital telephony T1 type of circuit Problem 4 wWhat is the analog bandwidth of a signal Contributed by David Tweed The answers are posted at www circuitcellar com eq htm You may contact the quizmasters at eq circuitcellar com Y eS The internet s first and best robotics source has been purchased by Jameco Electronics and we re committed to greatly expanding the product line quickly Each month we ll add hundreds more new robotics products Plus we ll continue to supply favorites like Muscle Wire the OctoBot Survivor robot and more Be sure to visit us online at wwWw RobotStore com or call 1 800 374 5764 and see what s changed Issue 178 2005 11 FEATURE ARTICLE by Robert Lang USB Interface Development Need a USB interface for data acquisition Simply choose a chip and software develooment system and then build a circuit board You can test the board with an uncomplicated HID mouse application Wien I finally got around to buy ing a laptop computer I was surprised by its lack of classic serial and para
63. is run ning correctly it will be time to jump into the next phase which involves developing the laptop program BACK AT THE LAPTOP The laptop program is based on the BulkXfer program located in C Cypress USB Examples EzUsb Bulk Xfer Again I copied the entire direc tory into a new directory C adc_app The C dialog file BulkXferDlg cpp was modified to collect the data from the EP8FI FOBUFF array and store it in another array j adcdata Listing 2 shows the routine that requests the data from the buffer and puts it into your array After the data is in this array you can use it for the various functions I discovered the correct pipe number by checking the 8051 software with e 5232 15485 e USB 900 MHz Radio e Converters Repeaters Fiber Optics Isolators Multi Repeaters Hubs Extenders Multidrap e 10 100 Base Ethernet hlicroprocessor Serial VO ode Activated Switches Download our free R amp 232 485 amp Ethernet Terminal Emulators from www rs485 com 32 Issue 178 2005 CIRCUIT CELLAR Photo 1 The EZ USB board is on the bottom The expansion board fits over headers J1 through J6 The ADC board is fastened to the expansion board with 0 375 Spacers so you can easily remove it for your next project the Cypress control panel Using the Get Pipes button I found that end point 8 was attached to pipe 3 I modified the BulkXfer dialog screen to include the
64. it comes to getting a successful FPGA design out the door Actel will soon support the ProASIC3 line with a new starter kit see Photo 1 Fortunately the current ProASIC starter is similar so I decided to check it out as a stand in for the forthcoming ProASIC3 version The bottom line is that the starter kits are a remarkable deal at only 249 including the board PC plug in JTAG downloader and devel opment software Notably you get the Gold version of Actel s Libero IDE that integrates heavy hitter third party packages such as Synplicity Synthesis and Mentor Graphics s ModelSim As far as I can tell the software doesn t expire or otherwise lack criti cal features as is common in other evaluation kits The only gotcha is a limit in the capacity of the particular FPGA chips the package supports The ProASIC kit I evaluated tops out at 300 000 gates APA300 chip I m guessing the cap will be raised even higher for the forthcoming ProASIC3 kit because it s supposed to have a 84 Issue 178 May 2005 ProASIC3E chip installed the smallest of which is 600 000 gates That s a lot of gates certainly plenty enough for evalu ation and even development for a lot of full fledged real world applications I congratulate Actel and other FPGA suppliers too for their continu al efforts to craft better and notably lower cost tools But hold your hors es One thing I ve learned over the years is that FPGA too
65. on routing resources Actel says their seven layer metal process implementing a four level routing hierarchy avoids bottlenecks and achieves high gate utilization ratios 0 x 7 ccc RAM Block 4 608 Bit dual port SRAM or FIFO block VersaTile RAM Block 4 608 Bit dual port SRAM or FIFO Block ASP600 and A3P1000 DOD C000 C000 inaa code ooo ooo bod Bank 2 s Figure 2 Under the hood the Actel ProASICS8 family features an array of VersaTiles surrounded by block RAM multiple I O banks supporting different voltage levels and clock conditioning circuits VersaTiles that can each function as a www circuitcellar com CCC Bitstream decryption not included on the entry level A3P030 user FlashROM FROM and charge pumps for single voltage in system programming round out the chip CIRCUIT CELLAR In case you re wondering what the difference is between the ProASIC3 and ProASIC3E versions the answer appears to be not much beyond some additional I O standards and clock resources Otherwise ProASIC3 ver sus ProASIC3E seems to be a market ing scheme aimed at positioning the parts into low end less than 1 million gates less than 200 pins and high end greater than 1 million gates greater than 200 pins segments with some overlap in the middle In particular the Ac
66. programming interfaces Because parsers based on them are generic they have fairly high run time memory and code space requirements for an embedded applica tion Therefore we implemented a cus tom XML parser that focuses on the XML parsing functionality needed by XML RPC The XML parser is designed to minimize the memory footprint as much as possible by parsing the XML in place inside the request buffer The procedure calls supported by the XML RPC server map almost exactly to the standardized GPIB API defined by IEEE 488 2 This makes it extremely easy for someone familiar with GPIB to write client applica tions The only difference is the mechanics of how procedures are called not the procedure call format itself CLIENT SOFTWARE We developed a client application to demonstrate and test the capabilities of the networked controller Our goal was to provide a familiar user inter face for a GPIB device connected to our controller In our case this was a Tektronix TDS 210 digital oscillo scope application with a simple graphical user interface exposing enough functionality to perform most of the basic operations of an oscillo scope would do the trick We had three basic requirements for the programming language The first was a free and functional XML RPC client library Preferably it would be open source One of the main reasons we chose XML RPC was because of its prevalence so this requirement didn t narrow the
67. the FFT This par ticular application was set up to display frequencies up to 2 5 kHz which is good for showing voice frequencies guitar fre quencies and signals coming from a ham radio code filter I created the scale on the display by feeding in known frequen cies from an audio signal generator and literally writing in the appropriate scale With a sampling frequency of 100 kHz you could have a scale that goes to 50 kHz the Nyquist limit APPROACH THE PROBLEM If you re interested in USB you ve probably spent some time researching the subject By reading books like Jan Axelson s U SB Complete and John Hyde s U SB Design By Example I learned that I needed the bulk transfer data transfer method which transfers a block of data 512 bytes in this case from the 8051 endpoint to the laptop receives the data in an array The standard procedure is to get a known application running by way of pro grams from the EZ USB CD ROM If the gods are kind to you the source code will be there too After you find a program similar to your application you can begin modifying it I focused on a program for the 8051 and a program for the laptop www circuitcellar com In typical and programs there are several files that you must compile and link to make the exe cutable file You should use programs from the EZ USB CD ROM that have source code files Typically there s a subdirectory for each example that includes all t
68. three wire handshake to acknowledge each data byte The bus is organized in a master slave arrangement in which at least one Console RXDIO 3 RSTIN VCC P MII_TXER MII_TXEN MII_TXCLK TXD O0 3 PC O 7 CIRCUIT CELLAR controller is responsible for directing bus communication and a number of talkers that send data and listeners that receive data Every device on the bus can serve any combination of these three roles The bus allows for a total of 15 devices with up to 2 m of separation between them and a maxi mum bus length of 20 m The maxi mum nominal transfer rate of the bus is 1 MBps although there are non standard enhancements that can allow it to oper ate faster GPIB which is support ed on a large percentage of test equipment has proven to be an extremely popular protocol But the rise of the Internet has made network enabled electronics all the rage This reality has also affected the test equip ment industry A lot of test equipment now includes built in Ethernet interfaces with embedded web servers and other network control inter faces in addition to or com pletely replacing the GPIB interface The main advan tages of network enabled control are that the cabling costs are much lower and there aren t inherent dis tance limitations In addition embedding a web server or client application allows you to control the equipment with any PC that has a www circ
69. to the parallel port s I O addresses to make things happen But now most new computers come with either Windows 2000 or XP oper ating systems which don t allow user level programs to access the printer port You can find a driver that will allow such access but it will be expensive complicated to work with and won t always work if the parallel port is configured in EPP mode What can you do with a new computer that doesn t have a parallel printer port I designed the USBLab to solve these problems The USBLab plugs into a USB EXTVCC 3V30UT PORTVCC BDID RSTOUT D TRGIVCC SLEEP RXF oO RESET SND WAKE port and provides eight bidirectional data bits three address bits a read write direction control line and a data strobe Plus it has a serial input and output The former allows you to program the data rate with binary divisor values so you can obtain nonstandard data rates to match your project which may not use a multiple of standard data rates crystal The serial I O is TTL not RS 232 so you don t have to add RS 232 conver sion to your microcontroller project USBLab CIRCUITRY The USBLab uses an Atmel ATmega8515 microprocessor U2 con nected to a DLP USB245 U1 adapter which is a circuit board mounted to a 24 pin header that will fit in a standard J1 9VDC IN OC1B PE2 PEO ICP INT2 Figure 1 An ATmega8515 microcontroller controls the USBLab which requires only three integrated cir
70. was the same medicine that helped me through the tuple hash I issued only the TO NI C macro in the address write latch func tion and left the 16 bit read routines to call out the FROM NI C input macro as they needed it Issue 178 May 2005 37 After modifying the after code in the listing I asked you to download the newly ported Wi Fi code fired up and successfully joined the Florida room s LAN At that point I was really anxious to play with the SRAM but there was still the matter of running the simple web server CODING THE SERVER The first step in getting the Wi Fi web server off the ground is to make sure it s receiving the HTTP request correctly from the client My Easy Ethernet AirDrop A TCP routines are good enough for simple Telnet trans actions but they weren t quite right for processing HTTP requests I don t have enough space here to show you the entire TCP IP function transfor mation but you can download the Wi Fi web server source code posted on the Circuit Cellar ftp site Basically all I had to do was receive the HTTP request parse the incoming HTTP request data send an HTML page and disconnect the TCP IP session I stopped the code in Photo 2a just before testing for the GET string in the HTTP request I initiated from a PC I pulled the first 32 bytes from the incoming HTTP request looking for only the first five characters 1 sized thehttp temp array to allow for parsing things following the
71. 0 phrase control 1 output includes half of the 256 possible Register 239 PortCTL Auto Silence RC TTL Mode paima tad commands are imple Bit7 Always 1 of pen ni mented The rest are Bit6 Bit 2 of SCP node address software drivers mm ua reserved 32427 Also Bit5 Bit 1 of SCP node address note that the reserved Bit4 Bit 0 of SCP node address values include the char Bit3 Always 1 acters used in the 5 Bit2 D2 Buffer half full 0 off 1 on Most of the first 32 MSA Bit1 D1 Speaking 0 off 1 on action commands modi DO Ready 0 off 1 on Supported Architectures fy the way in which the Register 240 2 4 6 8 and 250 2 4 Event inputs E0 E7 rising transition MSA sets up the five Bit7 Say phrase 1 yes 0 channel synthesizer Bit6 Do not clear input buffer before phrase 1 yes 0 no Keil development tools for support a Many of the parameters Bit5 Execute a call phrase 1 yes 0 no wide of devices from the most reference a default Bit 4 Do not clear control buffer before call phrase 1 yes 0 no popular chip vendors value Some action Bit 3 Bit 3 of phrase pointer to say commands alter Bit2 Bit 2 of phrase pointer to say C166 these defaults This has Bit 1 Bit 1 of phrase pointer to say Keil tools for tha AC x Cl x and 5710 support over 50 devices the effect of changing the Bit0 Bit 0 of phr
72. 1 controller spec ification The hardware work is fairly obvious turn the prototype into a circuit board and put it into an enclosure We achieved a high level of integration by choosing an eZ80F91 microcontroller with a built in Ethernet MAC and incorporating a firmware only GPIB con troller Using the freely available ZTP TCP IP stack and open source software components enabled us to cut development time and costs By choosing XML RPC as the messaging layer we almost have off the shelf sup port for clients in all of the popular programming languages any of which can be easily client enabled with a minimal amount of glue logic k Editor s note Ron Patrick and Scott won First Prize in the Zilog 2004 Flash Nets Cash Design Contest for their Network GPIB Controller Visit www circuitcellar com magazine contests htm for more information Ron Battles has been involved with networking since installing Novell net works more than 14 years ago while attending the U niversity of Texas at Austin He has written network drivers and embedded code for Thomas Listing 3 n this GPIB RPC query sequence the client sends a query asking the oscilloscope for its channel one vertical scale settings with an XML RPC gpi b Send call Following this the output is retrieved with agpi b Recei ve calland then parsed Create a client Xml RpcCli ent Build the gpib Send Vector params new Vector params
73. 7503 500 or visit our website www protoexpress com Because to be the best Sierra Proto Express 1108 West Evelyn Avenue Sunnyvale California 94086 U S A The RoHS Restriction of Hazardous Substances and WEEE Waste from Electrical and Electronic Equipment initiatives require a complete elimination of lead Pb and a reduction of other heavy metals such as mercury Hg cadmium Cd and chromium Cr 1 V in all printed circuit boards and electronic assemblies Testing Services courtesy IRTS manufacturer of the HATS Tester Information about the Highly Accelerated Thermal Shock ie HATS Tester can be found at www HATS Tester com ss May 2005 Communications 12 USB Interface Development Robert Lang 22 Radio Build an Internet Radio Receiver Bertrand Achard Atmel AVR 2004 Design Contest Winner 30 USB 2 0 Interface Daniel Cross Cole 43 Digital RC Servo Controller Part 2 Circuitry Details Eric Gagnon MT 51 Three Axis Stepper Motor Controller Part 2 E Radio gt b Software Implementation Prajakta Deshpande amp Praveen Deshpande 62 Network GPIB Controller Ron Battles Patrick Jackson amp Scott Shumate 76 Connect with USBLab Stuart Ball 34 APPLIED PCs Build a Wi Fi Web Server Fred Eady FROM THE BENCH Speech Synthesis with SpeakJet Jeff Bachiochi lA t F SILICON UPDATE Wi Fi Web 84 eee M Low Cost Speech Synt
74. CTIVITY WAKEUP 4 24 1876 256 256 Hifdef DEBUG S i if DONE bTOK DONE E 77 WAS IT A TOKEN DONE d XUSB deu req SET fiDDRESS Finish Set Address USB deu req ix while 15 lt bIMRGI F 6 gs ServicelUSBO enable just the reset interrupt B if 2 99 po 4 CFD8Faa4 MOUFF 6 05 ur ETE miata leds STATUS IntiContext MOUWF IntiContext D 4 CFEGFOH6 MOUFF BSR IntiContext D CFERF88 7 MOUFF FS RGH IntiContext CFE9F888 MOUFF FSR L IntiContext 68081 CLRF gbl portb if CbUSBIE amp amp bUSBIF5 lt 1D28 ARAL Dar BT TPSS gbl bUSBIF 5 12C04272f4c Waring argument of delay 10us calls must have a value of 1 or ma Building CASM file Memory Usage Report RAM available 2048 bytes used 350 bytes 17 1 free 1598 bytes ROM 24576 bytes used 7585 bytes 30 9 free 16991 by Successful mm m mmm mm 3 a THIN Fad Terminal 7 i 18 9 msec timer overf lc RIAL hile C BINROLE ad 7 7 wait until timer expire message means timer is we 7 7 clear che timer flag 77 send same data 18 Ys X188 msec tij 3 8 gt of table ari 47 buffer 1 tablexI j1 buffer 2 if Spon E Mait until device is corm TMROL 1 EE Endpoints E or 2 are gt TMROH Em S buffer 1 TMR1H buffer 2 RCON WDTCON HLVDCON OSCCON t timer w TMROON
75. 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 USB ETHERNET DAQ LabJack Available now y lor only 399 qty 1 LU SB Ethernet Data Acquisition amp Cantrol 2 091 1 and Elie 14 analog inputs 12 io r meam ing dans upto 50 AM cunis xmi Mino alc Up in g iaaa ciuem DAI actuny E pr Apo Y aT Ops kim in 4S thag 7 1 22 dgtal NO LabJack Corporation Colorado USA infoizdabjack com 303 942 0228 www labjack com 4HORE rore Myr 220 He CT mais e bie BSS Micro Edetian Lini Compiese Deselanment Took Drm S Libo g amp Book on Designing G5 Sep incu WWW XGAMESTATION COM a2 5 Fa6 2098 SLPPORT nau Rw HET Issue 178 2005 75 Connect with USBLab No parallel printer port Stuart s USBLab plugs into a USB port and provides you with eight bidirectional data bits three address bits a read write direction control line and a data strobe It also has a serial input and output Problem solved in the good old days of com puting around 1997 you could con nect a new widget to a PC s parallel printer port and control it All you had to do was write
76. DATAO 37 0 0 00 000000000000 o pm Ie m Gami han r sr e ejej CIRCUIT CELLAR power it from a clean power source separate from the servo power If you don t have a separate supply for the electronics you should add an appro priately sized electrolytic filter capaci TXD PD1 RXD PDO SCK PB7 MISO PBS MOSI PBS SS PB4 HESET 5 XCK PD4 INT1 PD3 INTO PD2 DEFAULTS UPDATE REQ OC1B PE2 ICP INT2 PEO HEARTBEAT AIN1 PB3 AINO PB2 T1 PB1 OCO TO PBO Figure 1 The heart of the system includes an Atmel microcontroller with an external memory bus interfaced to a Xilinx FPGA The FPGA s 32 PWM generation units have control registers that are memory mapped in the external address space A flash memory based program memory automatically loads the FPGA code at power up Issue 178 May 2005 43 05 LM1086CS 3 3 Bank 1 Bank 2 20 Bank 4 PWR WIRE PWR WIRE J U6 3 3V MIC39100 1 8BS 1 8V 1 1 6 8 9 16 18 19 24 Popo 11111 Eco fead B 52 _ pe 52 0 2 Q Q Q Q 2 2 O TSW 108 08 T T RA
77. Dmaker 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 C Hi Tech C MPASM PC VB6 Delphi C Builder Single chip solution PIC with built in USE SYSTEMS ina www can 232 com The original Controller Area Network to R5232 serial converter Powered with an AVR RISC mieraeenireller and a PhgpsSIATODU CAN makes unique compinabon of high speed transfers pas sible aven at higher bus speeds GANZ 32 has also a Guilt in receive FIFO of 32 messages whech makes il paasible t receive small bursis of massages wilhmul any frames pas sound interesting Read more al www com Free sample programs in Delphi Linux C amp C E 1EVTW supply via CAN comanador CLA DES 1025 Emal size BE by Hmm 2 7 Ej 1 2 in ens on CAN Iram sysiim 11 5 2B wi ID support ASO or Binan ponon d a Fines wogradable Custom design DE arene eed oder of hikes Pri Abe and eo epee ed ki 0 Aher Cee CIRCUIT CELLAR HIDmaker Test Suite 149 USBWatch shows your device s USB traffic even during enumera tion without expensive equipment AnyHID Test USB HID device See what data it sends even what the data is used for 301 252 0300 WWW IraceSystemsI
78. DnSTAT BDnCNT BDnADRL and BDnADRH The num ber of endpoints using dual ping pong buffering locations defines the loca tions BDnSTAT is the status register for the n endpoint Bit 7 determines who owns the buffer CPU or SIE and who can write to it BDnCNT is the number of bytes the buffer can hold BDnADRL and BDnADRH are the low and high order bytes of the address where the buffer starts in the 400h 7FFh range The PIC18F2455 supports a dual buffering scheme in which each end point has two buffers defined Up to a total of 64 buffers can be defined Optional RS 232 driver receiver for debugging T1OUT RS 232 Output BUILD THE HARDWARE The circuit for the USB interface is fairly simple see Figure 1 There are few enough con nections that it can MAX233 To program in circuit 1 Unplug USB and MIDI 2 Unplug crystal 3 Plug in programming connector f the optional Maxim 233 is added to the circuit it can t be powered from the USB Figure 1 The schematic for the USB interface includes the optional MIDI and debugging components www circuitcellar com CIRCUIT CELLAR Issue 178 May 2005 13 built on a 2 x 4 5 proto type board with hole spac ings at 0 1 The heart of the system is the PIC18F2455 that handles the USB proto col Because I planned to eventually develop the device into a USB MIDI interface some MIDI plugs and a 6N139 high speed high gain Darlington optoi
79. I ground the PEN line the program ming connector does this and reboot the Net Radio The AVR then waits for programming instructions There is one nasty trap with AVR devices they use the external clock source for the programming sequence If it s set incorrectly during the previ ous programming cycle the device Issue 178 May 2005 23 Ethernet XPort Figure 2 The heart of the Net Radio is a microcontroller but it cannot work alone It is aided by several circuits The XPort top left enables communication with the Ethernet network The switching power supply bottom left generates the stabilized 3 3 V required to power the project And last but not least the VS1002 right handles the MP3 decoding tasks will not boot I made this mistake once and I had to connect a signal generator to the clock pins to simulate an exter nal clock This problem doesn t exist with Microchip Technology s PIC microcontrollers which don t need an external clock source when program ming apart from the data clock because the communication is synchronous Oh I didn t tell you why I used the L version of the ATmega64 The 1 stands for low power I didn t really need low power consumption However I needed low voltage because of the XPort which can work only at 3 3 V a voltage that can be supplied by a 120 or 240 V outlet through a trans former or preferably a switching power supply But I needed a micro controller that
80. IDE FOO RTC AME RAM 3 77 X 354 142 00 Supported OS amp Davelopment Environment troller also incorporates an embedded Ethernet MAC which helped reduce both the cost and complexity The server software in the con troller was built on top of ZTP the free TCP IP protocol stack provided by Zilog We selected the XML remote procedure call XML RPC protocol to be the main means of control between the remote client applications and the controller XML RPC is a simple pro tocol based on XML It s transported via HTTP The XML RPC s main advantages are that it s lightweight and well supported under a number of programming environments To demonstrate the ability to embed a client application in the controller and use it to control GPIB equipment we also implemented a GUI applica tion in Java for the Tektronix TDS 210 oscilloscope The application has the ability to graphically display waveforms as well as set and control operation all via the oscilloscope s GPIB connec tion The Java application uses the XML RPC protocol to control the oper ation of the GPIB bus via the controller Eg DR 54 x86 Embedded Processor Module NS 355 Embedded gysson 222 HRS 21200 16 GPIO Etat IDE V AME 2 14 X 156 100 00 Cry 100 prie Embedded Linux The primary hardware design crite rion for the network GPIB controller was that it must be inexpens
81. INK EXE MPLINK EXE Constants in program memory Yes strings only Yes Yes Yes Environment Yes Yes No Yes User defined variable location Yes Yes Yes Yes Array size definition Yes Yes Yes Yes Delete unused functions Yes Yes Yes Yes Structure union Yes Yes Yes Yes Project support Yes Yes No Yes Trial 15 day trial of full version Time unlimited trial of limited version 21 day trial of full version Time unlimited trial of limit ed version Time unlimited trial of limited version 30 day trial of limited version Download size 7 7 Mb in seven files 6 8 Mb in one file 0 4 Mb in one file 5 2 Mb in one file ANSI standard libraries Minimal Most Math Some Platforms Windows DOS DOS Windows Supported processors Scenix PIC10 PIC18 PIC10 PIC17 PIC18 requires separate PICC 18 compiler additional 950 Microchip PIC10 PIC16 PIC18 requires separate CC8E com piler additional 250 PIC10 PIC18 70 full 950 Table 2 These popular C compilers are for Microchip PIC microprocessors 14 Issue 178 2005 CIRCUIT CELLAR 250 425 www circuitcellar com PROGRAMMER o WISH LIST OF BUILT IN FEATURES 1000 SHOW AND TELL series M ws GU 7008 SERIES re
82. Instruments and Silicon Systems were some of the first players using analog formant tech nologies Various prerecorded content techniques were also manufactured by National Semiconductor Digitalker Texas Instruments LPC and OKI Semiconductor ADPCM LINGUISTICS You can create intelligible speech if you keep in mind a few basic linguis tic concepts concerning the relation ship between text and speech the same letter in different words can often sound completely different so think in terms of sounds not letters when converting words into speech even an allophone s sound may be influenced by its neighbor and finally to avoid monotonic speech use textu al punctuation to indicate where to alter the default parameters pitch rate bend and volume Phonemes can be broken down into consonants and vowels The English alphabet has six vowels including Y and 20 consonants Obstructing your vocal tract with your tongue or lips to create a discontinuous noise source as with the consonants t and duces the latter Consonants also may have a continuous sound source from the vibrations of vocal cords as with the fricatives f h s sh th v and z On the other hand all vowel sounds have a relatively unrestricted path through the resonant cavities of the vocal tract throat nose and mouth www circuitcellar com The continuous sound source from vibrating vocal cords is altered by your tongu
83. NTTEDOOFKP CSA UL Made in 1 Tas abegi 2 2 Te undies ife 1M 33 TF Egan 32 pie DIF EJEPROM 2125 MG nana 31 pin PLCC adacter for EPROM and kow price Programs over 4200 dawites EPROM FLASH Mersony Mecrocoreraiens PIC EPROM SAL Pn Soke Mace nA year warranty Lett 110 orc 280 Adapter 01 413 gang pdapigr iP 5115 U EPROF Esh High speedy merece Plu amp es uowricad par second Lawer Voir a 854 1556 and 320 data spit kh Spaai aom B Hn xd erii nose SR EMIT G 005 a i sandar Hex tomua ikan ban ties s dipai less Enua size 110 Last 11 wi ERASER for Personal user and eflent Motiad Pasit Case Hold of 28 047 ci aden 5115 BSCILIST PLOCHE 70 44 208 115 QUUM Se maleto 222 e yes DPA PLC Custom Printed Circuit Boards Nobody beats our PROTOTYPE PCBs We are the 5 PCBs 5days specialist AMAZING VALUE 2 layer Get J PCBs for 13 each in 9 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 availa
84. OM area After it s programmed the SpeakJet can interact with the real world all on its own The inputs are triggers that can initiate one or more of the canned areas Remember that in addi tion to the programmed speech and sounds the embedded codes can also operate any of the three output lines Combined with delays you can create sophisticated output cycling You might want to create a security system that monitors an electrical closed loop and responds when the loop is opened A response might be an audio message or an output that takes your phone system off the hook External phone line circuitry can route the audio into the phone to dial your phone using its DTMF capability and repeat a mes sage say 10 times before hanging up At this point neither logic nor deci sion making has been implemented so branching based on various input states isn t permitted Any project that requires a higher level of deci sion making would take additional circuitry and might have to include a microcontroller Although you can t overlook the power of adding a micro controller as a stand alone sound unit the SpeakJet is extremely power ful for its size and price Use the SpeakJet to bring a little life to your speechless robots Even some thing as simple as your system saying Ready can instill a level of comfort and confidence For a doctor there is nothing like having a patient be able www circuitcellar com
85. PIO port B Both devices have control signals that are interfaced via four pins on GPIO port ES The integrated 10 100 Ethernet MAC on the eZ80F91 microcontroller reduces the cost and parts count An MII bus connection interfaces the MAC to an external PHY in this case the Advanced Micro Devices Am79C874 PHY which we chose mie ies m mid imd mc dia TEREE because it s commonly avail able and Zilog already pro duces a driver for the ZTP protocol stack An RJ 45 jack with integrated magnetics and LEDs rounds out the Ethernet interface see Figure 2 The eZ80F91 microcon troller includes 256 KB of integrated flash memory that provides you with more than sufficient room to store the software image The soft ware boots out of this flash memory and copies itself to external SRAM for execution This is done to provide maximum run time performance and to give the network stack and server plenty of heap and stack space in which to run see Figure 3 To accelerate the development schedule and to minimize initial costs we prototyped the design with the eZ80F91 development kit because it contains the same processor and 10 100 Ethernet PHY as this design We constructed an external circuit on a small prototype board for the GPIB Tha USBea Z and 5 capture and generate millions af digital samples per traca letting you caich your bugs in act
86. 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 Bootloader ren h for C SPI Dall 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 fo
87. Service USB TOSBIT TOCS TOSE TOPS3 ncrement infin 52 R vector 75 vector 51 50 WPM Build Find Terminal PICs I eliminated the 500 CC5X because it didn t have an integrated development environment IDE The IPIC18F2455 1270 Col 20 Boostc MHz NUM Photo 3a This view of the BOOSTC integrated development environment shows the project window files window assembly code window and build output window b After compiling the program can be executed in Debug mode The green highlighted line shows the position in the source and code windows that corresponds to the current pro gram counter PC Other windows show the contents of the processor registers and program variables PCWH on the other hand had a Windows based IDE but I eliminated it because of its price I ended up choosing the most economical option BOOSTC When I downloaded SourceBoost BOOSTC it was in active ALPHA testing and available for free But even now the compiler is the most eco nomical The downloading process for the BOOSTC compiler IDE was nice because I had a 56k modem and had trouble downloading some of the other large compilers SourceBoost thoughtfully broke up their 7 7 Mb system into seven 1 Mb files which were easy to download using even the slowest modem COMPILER IDE 16 After cranking up the BOOSTC compiler in Windows I was pleasantly surprised by the easy to use user inter fa
88. W MotorEvents motor EvRunCCW 0 MotorEvents motor EvStop ep MotorEvents motor EvRunCW 0 MotorEvents motor EvLi ml MotorEvents motor EvLi m2 MOTORSM S1 MotorSM State motor break case MOTORSM 51 MotorEvents motor EvStop 0 if MotorlsRunning motor i Motor is stopped Reset the event StopMotor motor if MotorEvents motor EvRunCW MotorEvents motor EvRunCW 0 MotorSM State motor Set MotorDirection motor RunMotor motor Reset event MOTORSM 52 DIR CW if MotorEvents motor EvRunCCW MotorEvents motor EvRunCCW 0 MotorSM State motor Set MotorDirection motor RunMotor motor break case MOTORSM S2 Reset event MOTORSM 53 DIR CW Motor is running in CW direction if MotorEvents motor EvLi ml StopMotor motor MotorSM State motor break case MOTORSM 54 MotorEvents motor 0 MOTORSM 54 Motor is at homel Reset event if MotorEvents motor EvRunCCW MotorSM State motor Set MotorDirection motor RunMotor motor www circuitcellar com MOTORSM_ 3 DIR CCW CIRCUIT CELLAR Figure 1 The code controls all three motor axes The appropriate state variable and events are selected by the mot or variable which is passed to the state machine as an argument You must periodically call the state mach
89. Y OF OUAR FREIE Pees Lh eC Si dm T rud BALES 320 s Fak 262 542 659 ENT K rr INCLUDES EVERYTHING HEE al E E un INCLUDING IN Ci RRS 1 i Serial PRO GA CC COMA CARLES AND MOR Furi DEMO BOARD WITH w EXERCISE BODE OF READY E XN PLE i E xampus PRoword UL Ic A Hip MOUSE E MORE HU FOR LIMITED TIRE FREE MOUSE Pa amp GROURD SAIPFING Dozens of assorted adapters on cach variety of PCB s patterns on both sides Eliminate tha cost and dalay of layout SOIC PLCC 580 TSSOP 50723 MSOP GSOP SCEI DZPAK SOTS SOTT43 TSOP 5070 0326 BELLIN OFYNamic BYSTENMS INC www beldynsys com 714 630 8024 aed Chalon Soles Aor mie Tachowca Peaks 48 Issue 178 2005 gt Untitled Dsvc100 Servo Control Panel Edit View Setup Command Help The entire process gt 612 Channel Setting 8 bit ety ill riil par ee sr 8r 6 R F re er rr RF 8r 7r ur res fr prr Ee TUE 4 20 5 amp wx 3 NO t 12 3 M 15 I5 I 19 220 2 2 23 320 25 5 27 28 29 0 32 went smoothly and the controller tested well The ATmega8515L microcontroller proved to be an excel lent fit Firmware m F
90. ach motor axis inde pendently we made it easier to write the firmware We needed to be able to handle multiple independent parallel tasks e g controlling the user interface from a keypad or remote PC system configuration management tasks and individual motor axis control tasks We also needed to be able to synchronize them if required A real time operating system RTOS enables you to create synchronize assign and prioritize various tasks Another alternative is to use a state chart or state machine event driven programming technique to accomplish these objectives in a timely manner Both approaches enable multitasking An RTOS framework provides tight timing and deterministic perform ance You need to select an RTOS to suit your development tools and microcontroller If you re new to real time programming you must first learn the RTOS and programming techniques Keep in mind that when Issue 178 May 2005 53 Command Arguments Description MOVR Motor number of steps Move specified motor relative to current position by specified number of steps MORA Motor absolute position Move specified motor absolute position IDN Identify yourself query command RST Perform a warm reset LERR Optional motor Get error status of last command HOME Motor Get motor to its home position HOME Motor Is motor at home position PICH Motor value Set the pitch for the
91. adio I knew a problem would arise Unlike conventional radios the Net Radio needed a complex Save months of development time by using our ready to run single board computers with your choice of operating system MERCURY single board computer e Oodle Aber cammuricalu ns processor TOGbaselx Enhernet ports BM Accelerated encryption hardware xd USE 2 0 and x4 serial ports DRAM 32Mbytes Flash amd PETOS bus 4 F Embedded Linux Development Kit Based on 2 6 kemel Uses Flash File System JFFS2 OpenSSH for improved communication security Windows Development Kil Uses Microsoft Transaction Sale FAT File System Comprehensive set of Windows CE components Includes Embedded Visual Tools C Tools lt MP3 binary data start from here gt Figure 3 n a typical exchange between a network radio server and the Net Radio the latter sends a request with some parameters The server responds with a header followed by the data VIPER single board computer 400A Inter PXAZSS processor Lifra dow power 7 typical P IFISTN graphics controller 8 b54Mbytes DRAM 32Mbyres Flash NE Effemel USB and serial ports CF VxWorks Development Kit Support Tor VxWarks 5 5 real time 05 WindML 3 0 multimedia library Automatic Tomado installations Combining the
92. akJet The SpeakJet sound synthesizer is an affordable alternative to recorded voice synthesis This month Jeff shows you how to add voice and sound features to your embedded project sound extremely natural especially if you have the money to spend and the computing and storage capabilities of a PC to work with But sometimes don t you just want to be able to add speech output to an embedded design without having to deal with the high costs and loss of resources In most cases you probably don t need your system s voice to be as soothing as HAL s in 2001 A Space O dyssey so long as it s easily under standable In this column I ll show you how to bring a little life to your designs with the affordable Magnevation SpeakJet sound synthesizer SPEECH SYNTHESIS Most speech synthesis models can be broken down into two parts front end and back end components The front end takes raw text and performs the tokenization task This is a 64 Byte gt ff SCP buffer Preprocessor User 2 gt EEPROM MSA sound component Event input RC database Figure 1 The mathematical sound architecture MSA module is the main outputs SpeakJet process whereby the text is analyzed at the syllabic level and a phonetic translation is assigned It may also involve designating points of inflec tion based on punctuation The back end of a speech synthesis system takes the phoneme stream from
93. al Ports a Accepts DiskOnChip 2 16 bit Timers 512 DRAM amp 512K Flash Watchdog Timer a Expansion options with Peripheral Boards a 186 controlar Borland G ver 4 52 FREE Tech Support Denis 1 346 No adapter universal programmers 13 Serial Driver library required for DIL devices B HILO er LAE TOUL AS CADAVAMTECH AC Adapter and cabla aperalin on AC charger virtually mat hirig perfor ied s WIN 96 NTME ne mi only 173 14 Cal 530 297 6073 Email salesejkmicro com Mr 2000 a Fuse Edis Into peders sofiw 19 4420 On tha web al www jkmicro com i inn doanius weseveconibec net CONTE DATASYSTEM 1563 47H AVE SUITE 301 DIEGO TEL 610 202 4420 FAX 610 202 03 The Pocket Programmer 149 95 The portable programmer Complete SDK Online M a that uses the at wyna ontran I b printer instead of a ull internal card Easy to use software that programs E E prom Flash amp Dallas Ham 2e5e7 2B amp 29 senes from 16K to B if data is received by Megabit Adapters available for 874 1 00 Tere rrr rs 875X MCU s Pic Serial Eprom s 40 EASTERN FEATURES Pin X 16 Proms and Mora PROTOTYPE CIRCUIT BOARDS 8 5 for two 5 x 6 S 2 layer boards Shipped NEXT BUSINESS DAY A rela TT CORPER 8
94. and CIRCUIT CELLAR SRAM and glue logic Figure 1 The ATmega64L microcontroller is connected to various devices in fact nearly all of its numerous I O ports and integrat ed devices are used in this project You can clearly see the external SRAM connection through some glue logic a latch here The external SRAM allows the Net Radio to buffer enough MP3 data for glitch free playback The process of pagination driving one of the address bytes in software would have been hard because I didn t know how the compiler uses the RAM Even though I had hooked up the SRAM so I could still use the XMEM interface I decided to drive the SRAM with a software driver I didn t lose any space but I used up some process ing power I then had 132 KB of RAM for my project which was enough to buffer the MP3 data A 128 kbps stream is 16 KBps so I can buffer 4 s of music with the 128 KB buffer that I keep half filled And I didn t have to worry about how the compiler uses the internal SRAM The compiler takes care of it and I take care of the external memory divide to lead You must carefully program a high end AVR microcontroller In many cases programming involves the same pins as those for the SPI interface With an ATmega64 microcontroller however the program data in PDI and program data out pins are separate An external resistor pulls up the program enable PEN line When I want to enter Programming mode
95. ar on the screen if the connection fails You can stop playing an MP3 stream at any time Press any key other than the volume controls to return to the main menu STAY TUNED I think you ll like the Net Radio I really enjoyed building it I m actually thinking about design ing a second version that would be easier and cheaper to build I also want to rewrite the firmware to include more features Imagine using the Net Radio as an streaming server Stay tuned In the meantime start surfing the Net for radio stations that you like This way you ll be ready to go when you finally have your own Net Radio al Author s note would like to thank my friend Christophe Riehl for his help with this project Bertrand Archard is an engineering student at the Ecole Sup rieure d Ing nieurs en Electronique et Electrotechnique ESIEE near Paris When he isn t studying Bertrand enjoys working on microcontroller based electronics projects You may contact him at ba acykian net CIRCUIT CELLAR PROJECT FILES To download the code and additional schematics go to ftp circuitcellar com pub Circuit Cellar 2005 178 RESOURCES AMIC Technology Corp LP62S1024B T Series 128K x 8 Bit Low Voltage CMOS SRAM 7 1 2 2004 www amictechnology com pdt LP62S1024B T pdf Atmel Corp Atmega64 64L 8 bit AVR Microntroller with 64K Bytes In System Programmable Flash 24901 2001 www atme
96. are wave which can be used to drive the motor along with the L297 sequencer struct intbytes r1 unsigned char hb unsigned char 15 m typedef union unsigned int i Struct intbytes b jul nt Bytes unsigned Mtermi nal Count 3 ulntBytes temp unsigned MPCAReload 3 void PCASqrWave void interrup if CCF0 CCFO 0 MICI k temp b lb CCAPOL rj temp b hb CCAPOH temp CCAPOL temp b lb temp b hb Mt er mi nal Count XMOTOR if Mtermi nal Count XMOTOR MotorEvents XMOTOR EvStop StopMotor XMOTOR voi d initial counter module 0 0x48 CL s LH Temp i CCAPOL CMOD Chel EG qs EAS I I ni tPCA void Clear temp b lb temp b hb 0x01 void RunMotor char motor Switch motor case XMOTOR Enabl eMot or XMOTOR 0x49 void StopMotor char motor switch motor case XMOTOR Di sabl eMotor XMOTOR 0x48 CIRCUIT CELLAR MPCARel oad XMOTOR Software timer the free running counter MPCARel oad XMOTOR Data structure to convert a 16 bit integer value to 2 bytes for frequent data manipulation Declare a new data type Terminal count for motors Temporary 16 bit variable PCA reload value corresponding to RPM 6 using 0 PCA interrupt
97. ariable to keep track of the number of steps taken see Listing 4 The ECCFn bit of the CCAPMn Compare Capture mode reg ister enables an interrupt when a mod ule s event flag is set The bit clears after a motor s terminal count is reached The RunMotor StopMotor rou tines illustrate this The PCA ISR also generates an EvSt event which sig nifies that the motor has stopped after reaching its desired position You can call these routines from other code modules to stop or run a correspon ding motor The Keil C compiler toolchain has an extremely powerful built in simula tor for each device supported in the device s database You can write a pro gram in interpreted C language to con trol the simulated device s various external inputs and timing Moreover the environment simulates the aspects of all of the on chip peripherals This will help you develop your code dur ing the software development phase without the actual hardware and asso 60 Issue 178 2005 ciated laboratory instruments e g CRO and function generator CONTROL PROGRAM We developed a control program LabVIEW to control the driver from a PC see Photo 1 Although the appli cation controls laser lab instruments you can use it as a guide for your own in project The application was developed Listing 4 The motor control PCA routine enables background motor driving In PCA Software Timer mode you can generate a squ
98. ase pointer to say from Infineon and STMicroelectronics volume speed pitch Register 241 3 5 7 9 and 251 3 5 Event inputs E0 E7 falling transition and bend parameters used Bit7 Say phrase 1 yes 0 no Cx 51 with the five channel Bit 6 Do not clear input buffer before phrase 1 yes 0 Keil development tools for the 5 synthesizer on an allo Bit5 Execute call phrase 1 yes 0 no support over 600 different derivatives phone by allophone or Bit 4 Do not clear control buffer before call phrase 1 yes 0 no including devices with extended address sound by sound basis Bit3 Bit 3 of phrase pointer to say space and enhanced instruction sets Additional action Bit2 Bit 2 of phrase pointer to say commands can act on Bit1 Bit 1 of phrase pointer to say Contact us today for a Free Demo CD the output port repeat a BitO Bit O of phrase pointer to say sound a certain number Table 2 The chip control registers create a powerful Stand alone mode Events of times and call any of rising falling or both can generate prestored phrases or control output bits 800 348 8051 www keil com www circuitcellar com CIRCUIT CELLAR Issue 178 2005 73 pole low pass filter is sufficient to remove this carrier and let the modu lation through However if a passive filter is used to remove the 32 kHz an amplifier will be necessary to get the signal back up to a useable level Each oscillator is ca
99. asier to use and more accessible to blue collar designers not just chip design gurus I expect that will happen The sands of time and cries for tech support will inexorably wear down the rough edges If flash FPGAs are the answer how Xilinx and Altera will respond is an interesting question Don t you just love this business al Tom Cantrell has been working on chip board and systems design and marketing for several years You may reach him by email at tom cantrell circuitcellar com REFERENCES 1 Actel Corp Understanding FPGA and Total System Power April 2003 www actel com products rescenter power docs System_Power pdf Flash FPGAs in the Value based Market January 2005 www actel com documents ValueF PGA_WP pdf SOURCE ProASIC Flash memory based FPGAs Actel Corp www actel com Issue 178 May 2005 85 THE DIRECTORY OF PRODUCTS 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 vari
100. ation including RCM3100 RabbitCore Bluetooth 99 Radio Module prototyping hardware and development software In addition Bluetooth Add On Kits provide Bluetooth capability for a number of different RabbitCore models Wi Fi Application and Add On Kits The Wi Fi Application Kit includes everything required to develop a Wi Fi Application including RCM3100 RabbitCore LinkSys Wi Fi card prototyping hardware and development software The Wi Fi Add On Kits provide Wi Fi capability for a number of different RabbitCore Modules Both the Application Kit and Add On Kits allow placement i of the Wi Fi up to 12 from the RabbitCore 599 Wi Fi Add On Kit Wi Fi Application Kit GPRS M2M Application Kits These kits provide all of the tools needed to create a GPRS enabled embedded application including a Module prototyping board GSM modem Integrated Development Environment and royalty free TCP IP stack with sample programs and libraries to simplify development The M2M kit provides additional tools to facilitate machine to machine communication I 2d cdm 29 2 Spafford Street Davis 95816 lel 530 753 8400 the devices being addressed Bit 7 Bit6 5 Bit4 Bit2 Bit 1 Bit 0 board level interface API to The eZ80 has more than 0 enough speed to keep up with the real time demands of the GPIB bus Each GPIB bus has one controlle
101. backplates assemblies Nickel amp Gold Plating 10 PCS Sdays 4 layers 695 m E fo Routing or scoring io 3083 includes tooling artwork 1 mask amp legend Electronic assemblies graphic overlays i Electrical Testing Electronic file transfer capabitifie Artwork or CAD data Picofa b Inc Fast Quotes 47808 Blvd Heni Beurassa Flex Circuits cohen hor etic dde 9901 W Pacific Ave Franklin Park IL 60131 Phone 847 233 0012 4 52 18 622 999 ua Bia esis cola is cid Fax 847 233 0013 Modem 847 233 0014 www pulsar inc com yogn zflash net ee d er DATA Technologies 3 1710 B Brighton gic Walton Beach FL 32547 650 863 5723 Digital 170 Analog Input Analog Output Solid State Relays Stepper Motor Controllers Pulse Counters DOS Stamp Pulse Timers Frequency Measurement RPM Easy Sofware Development lise your or Basit com Measurement Duty Cycle Measurement Period plier in producn DOS Downinar EXE tn fests wa serial Measurement Projectile Velocity Measurement perl rens onm power up Third Party Peripheral Interface Data Loggir Standard Fagturag AUS amp DOSHRUM 1289 372k y ph ng SRAM Miz CPU 16 digital apta rack inierface E s 2 R5 732 2 makuma ampie irs minare a Chock Data Options B ch 17 hk ADC Bash dedy op in 238 1 85 1 cati 465 Acquisi
102. ble See website for details Order Online www PCBFabExpress com PCB Phone 408 857 0039 email support pcbfabexpress com Hagh Quality PCBs 02 Low Impact Prices NanoCorei2 for best price amp performance 9512C microcontroller modules from 45 127 Features an baard RE232C intarface up ta 33 MO fines with multi up to key wake up interrupt inputs with digital Filbering 501 SPI CAN E channal 10 bit ADCs PWM channels 4 channal timers supporting input X2H mult aecbar Flesh TX operates up to AMHA via PLL 23Waor5 V operation edvanced CISC archiectum on chip Sertal Monitor supports BOM debugging 1 877 963 8996 www technologicalarts com Toll free in USA and Canada orei trademark of Arts www circuitcellar com CIRCUIT CELLAR 8051 IDE Camprlers ICD Programmers E B0196 PIC MSP 430 censony 718 259 3191 1 Www phyton com Connect t computer via USB or Serial Port Free Software and Updates Windows 9 NUZU0O XP Compatible ICSP In Circuit Serial Programming Quality and Silkscreen Sor complete details at www Electronick its com USB and USE Flash Pic Programmers Available Carl s Electronics Ense Offering hundreds of Educational Hobby Kits Get the most out of the Rabbit s powerful feature set with the firs
103. ble USE Adapter Direct Access to intemal Registers 539 supports LNE Assembly Language s sob AM docs Die Prototyping Boards Interrupts in PicBasic and Assembly or u pir Doubie 5iged wh Plale Tiu Holes Balen LSB I2C Ha 232 and More Software for Windows BE Me NT ZK XP Circuitry for Power Supply and Clock Source Level Debugging Large Ares EPIC Parallel Port Boards Available for mast PIC MCLis our full range of products including Programmer mee Documentation amd Schematic Books Accessories and Components al starting at 59 95 Pricing from 8 95 to 19 95 www melabs corn 92 Issue 178 May 2005 CIRCUIT CELLAR www circuitcellar com Front Panels lt RS232 i gt TCP IP e TCP com v2 0 RS232 to TCP IP software Plus TCP IP to 85232 WinWedge RS232 or TCP IP data direct inta VVindows app Excel Access etc Order fro ls onli ii XI E Ins Free 30 day evals at www frontpanelexpress com vias taltect coim CUSTOM MEMBRANE KEYBOARDS SWITCHES QUALI PRODUCT FAST DELIVERY COMPETITIVE PRICING BENE UL approved a TO 2 WEEKS TURNAROUND Single amp Double sided VERY COMPETITIVE PRICING SMOBC T e Ex 5 4 swilch keyboards for 395 00 LPI mask SPECIAL OFFER backed swilches Through hole or SMT 10 PCS Aadays 1 or 2 layers 249 Custom metal
104. ble to point to the next state as per the state chart diagram In addition it calls data manipulation routines such as RunMotor andStopMotor to generate the appropriate signals for physical actions EvLim2 EvRunCCw EvRunCCw EvLim1 EvRunCw EvRunCCw Figure 1 We used this state machine chart model for stepper motor control The arrows indicate the transi tions between the states that result after events Sometimes actions are taken after a transition www circuitcellar com picc enterprise edition 300 supported chips 3 reliable compilers 1 simple solution HI TECH Software now brings you three award winning compilers in one with the new PICC Enterprise Edition PGrade Offers available HI TECH Software 5 PICC Enterprise Edition is the only compiler package available with comprehensive support for al 10 12 14 156 17 18 series Pils and also the new dsPIC processors PICC Enterprise Edition is the complete package that unites our successful PICC PICC 18 and dsPICC compilers With the choice of over 300 different PIC processors deciding which one to use is a challenge Even when you do decide changing project requirements during development often call larger or more sophisticated chip change in processor can also mean buying anew compiler until now With HI TECH Softwares FICC Enterprise Edition there is finally single product that supports all of Microchip s PilCm
105. can do a prius of concept using off the shelf product and later amp migrate all your knowledge and 98 of your code to a fully customized SPLat controller for quantities down to a few hundred Check out our website today Example SPLat MS120EM216 e 12 digital LOs pus 2x16 LCD blue backlight S e e 5 push buttons e 4 programmable LEDs Ot Expandable CONTROT Ph 781 729 3005 Line fhe exact URL brice fora www splatco com cc www circuitcellar com QRU T CHLAR Problem 1 What does the following C code compute Assume that ui nt16 is an unsigned 16 bit integer type on this platform Analyze its operation in mathematical terms amp define Precision 16 gt gt 1 uintl16 Function uintl6 Number or Res wilt Lint os Result uint16 Mask uint16 Mask2 Tests uint16 Power Result 0 ES 0 Wask 1 lt lt Precision Mask s Tk lt lt ECESO 1 lt lt for Power Precision Power gt 0 Power Test Result2 Mask2 uintl6 Result lt lt Power if Test lt Number Result2 Test Result Mask Maske Mass return Result Problem 2 Similarly what does the following code compute Assume that ui nt 32 is an unsigned Robotic Arm Kit 4 523 JA Twin Motor Gearbox Kit No 3 709 For All Your Robotic Needs www circuitcellar com CIRCUIT CELLAR Edited by David Tweed 32 bit
106. ce see Photo 3a The file pane shows the C coding as it s edited or compiled The code pane shows the original C coding and the generated machine code assembly language equivalent One quirk that I noticed while com piling code for a 16 877 was in the machine code listing The order of the bytes was reversed from what had been produced by the Microchip assembler The assembler produced a machine code of 0E03 for SWAPF STA TUS W while the BOOSTC produced 030E which was the same order as Issue 178 May 2005 the data in the hex file Microchip reverses the order of the bytes when it writes the hex file It s something to be aware of but the end result the hex file is identical in both cases The documentation for the BOOSTC compiler is being developed It s current ly available as an on line HTML file If you are new to C check out Ernest Ackermann s book The Essentials of the C Programming Language Photo 3b shows the IDE in Debug mode The file pane shows the C pro gram The instruction being executed is highlighted The LED bar displays a port s output Note that the Register bar shows the content of the processor registers and bits As you can see the TMROON bit is set in the TOCON processor register The definitions of bits and registers are controlled in a processor TDF file that can be cus tomized The Watch window allows you to display any of the program variables I encountered several problems
107. ces described herein under the relevant patent or other intellectual property law of the reader s jurisdiction s The reader assumes any risk of infringement liability for constructing or operating such devices jen n ife r h u ber circu itcel lar com sn Entire contents copyright 2004 by Circuit Cellar Incorporated All rights reserved Circuit Cellar and Circuit Cellar INK are registered trademarks of Circuit Cellar Inc Reproduction of this publication in whole or in part without written consent from Circuit Cellar Inc is prohibited Issue 178 2005 CIRCUIT CELLAR www circuitcellar com Let us make your transition to a lead free world a risk free process In 2003 the European Union passed legislation stipulating that all printed circuit boards and electronic assemblies In the same year the State of California adopted regulations restricting the import manufacture or sale of lead containing electronics especially PCBs And with Japan Korea and China all considering similar initiatives this means a dramatic risk for designers fabricators and OEMs Sierra Proto Express High Reliability Lead Free PCBs RoHS and WEEE compliant Made using Pb free laminate with a Td of 364 Capable of withstanding 2000 thermal shocks Guaranteed reliability e Quick turn and or volume order Custom made to fit your needs a Proto E e s For orders amp information call 1 800 763
108. ch one it is check the device manager before and after you plug in the USB cable After you identify the COM port number right click the TestUSBLab py file select Edit with Idle and find the line that opens COM port 7 ch OpenCommPort 7 Change the 7 to whatever COM port CIRCUIT CELLAR my system because I have a com6 device Refer to the USB Enumeration sidebar p 78 for more information Next save the file and then select the Edit Run or Run Run module depending on your version of Idle to run the script You can run the pro gram by double clicking it but the results would be displayed in a DOS box that disappears after the program is finished The Idle window should display the results shown in Figure 2 The data line starting with Read addr may vary but it should be 20 xx 21 xx 22 xx The time to complete the tests will vary as well however if you get these results back you ll know the basic hardware is working To verify that the expansion port is wired correctly copy the walking one s code from TestUSBLab py into a new Python program keep the imports and port set up code and modify it to delay a couple of seconds with ti me sl eep 2 after each write This will allow you to use a logic probe or DVM to verify that the bits are walking through the pins Or if you have one you can use a logic analyzer like I did FIRMWARE The firmware in the ATmega8515 microcontroller lo
109. conoROM and QuickWriter are trademarks of TechTools PiCmicro is a registered trademark of Microchip Technology Inc d uidi J W tz L ZLG B88 12 aug jm g a annaas sdgiua E 51 7 anpas jo siguen B SHES ED S SAM A SES odor exp pue 2u WERE sxieuraper paaga ae A s pue ME MIN au uuaer zu ZHOOL ZHOL 2 asd suomoauups DL A 20 9HM L 10j E dn paynd 2 dn pejnd 2 uod LLITH J818AU02 janaj Z 2 5H 510403 40 Lod ees eirg amp 1 222 4201 BLU Pe 0250 lanun anjon pue JO Jaxgads uying asn i smowopusod gr 2 Japeay SUM JIaUUGo gy aangeduwd da OW BZXS SZ FF H 20 Jajawoquapod m 1genuoo Lod 4 037 pug uas Ajddns Jawad s071 aniq c ULM i m ABW dures 19179 8087 ang masip gn pepioddns are sagnpoul AWS 71510 0 pug pg iE 158 5 adAjpojoid yo Ayuajd pue
110. control lines don t have any rivals in the before snip pet of code Adding the SRAM duplicated some of the I O signal names like OE and www circuitcellar com WE Thus all of the I O control labels that include the letters CF belong to the CompactFlash card In addition the before code always left a func tion with the data bus which was separate from the address bus in the AirDrop A scheme in Input mode The old data bus state logic no longer applied after I added the 573 latch and combined what had been the data bus into a combination address data bus After additional debugging runs I deter mined that the combined address data bus I O pins at the inputs of the address latch were actually in Input mode when the ATmegal28L was attempting to write and latch the lower 8 bits of the target address Listing 1 the SRAM and address latch forced me to rethink my address and data bus logic XCKOK CK OK OK OE CK EO OE OK ECKE CE OK OK OEC EK ECKE CE CO ECKE CE OE OK ECKE CE OK OK ECKE COE OK KKKKKKKKKK KK KK E X Before CK OK CK OK OK OE CK E OE OK ECKE CE COK OK OEC KKK ECKE ECKE CE CO ECKE CE OE OK OECK CE OK OK ECKE KK OK ECKE CK EXE XE EG EG X void wr cf addr unsigned int addr addr hi addr lo make8 addr 1 addr amp OXOOFF void wr cf reg unsigned int TO NIC wr cf addr reg addr data out reg data cir WE delay ms 2 set WE FROM NI C char
111. could work at 3 3 V which is the only voltage at which the XPort can work I found that running the system at 3 3 V was cleaner than running the microcontroller at 5 V and using a level converter to talk with the rest of the components ETHERNET CONNECTION XPort The XPort has seven pins two for the power supply two for the serial UART TX RX and three GPIO pins that can be configured for flow con trol The XPort is connected to the ATmega64L microcontroller through the second serial port and through three GPIO pins see Figure 2 You can configure the XPort through the Ethernet network with a 24 Issue 178 2005 51002 85 Lantronix utility that enables you to set the serial port s settings e g data rate and parity along with the func tion of the three GPIO pins The max imum data rate that my version sup ports is 230 kbps which is enough to receive a 224 kbps stream Note that 224 kbps is a standard MP3 bit rate The highest bit rate I ve seen for radios is 160 kbps I think it s enough The Net Radio doesn t need the faster version of the XPort DECODING VS1002 The VS1002 MP3 decoder chip is connected to the ATmega64L micro controller through the SPI interface see Figure 2 An SPI interface is a synchronous communication bus The master the MCU provides the clock There are two data lines one coming from the slaves e g the VS1002 and one coming from the master Th
112. ction The next piece of software was based on a USB HID example program from Microchip The example program set up the microprocessor as a mouse device and it supplied mouse coordi nate data to the PC It basically caused the mouse pointer to move around in a figure eight pattern The Microchip example was written for a different microprocessor and a different C com piler You may download the source code for the Irritating Mouse test from www circuitcellar com MI ui Iri s i E E m iue MAT imi L memo n cm EA ion and creativity Lm 22 4 lt gn 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 Everywhere you imagine www circuitcellar com renesas2005m l 6c Deadli
113. cuits Connector 42 enables you to in circuit program the ATmega8515 microcontroller You may replace J2 with a standard 10 pin connector 76 Issue 178 2005 CIRCUIT CELLAR 24 pin DIP socket see Figure 1 The DLP USB245 which has a USB connec tor connects to a USB port on your PC The module looks like a standard serial communication device to the PC but it stores the incoming data and presents it to an external microcontroller the ATmega8515 via an 8 bit data bus The DLP USB245 has read and write input signals so the external microcontroller can send and receive data The DLP USB245 handles the USB protocol so you don t have to write any of the messy USB protocol software It also provides low signals on pin 13 when there is incoming USB data to read and on pin 14 TXE when the transmit FIFO is ready to accept data The MCU writes to the FIFO just as it would write to a memory device or register by placing data on the eight data lines pins 17 through 24 and strobing the WR signal pin 15 low Similarly data is read by strobing RD pin 16 low The DLP USB245 uses an FT245BM IC which is one of a series of the Future Technology Devices International parts that provides modular functional blocks such as serial I O and parallel FIFO based interfaces The DLP USB245 combines the FT245BM with a crystal a USB connector and EEPROM to store USB enumeration values The ATmega8515 microcontrolle
114. cult to handle because of fragmentation for example and writing and debugging a TCP IP stack takes a lot of time Furthermore net work radio is broadcast over the TCP IP protocol Actually it s broadcast over the HTTP proto col which is encapsulated in the TCP IP protocol TCP IP stacks aren t free If they were you might run into code licensing problems Fortunately the XPort solves this problem it s royalty free It also speeds things up and doesn t take up much more space than an average RJ 45 connector The user interface enables you to choose what you want to listen to set the volume start and stop playing and so on I thought it www circuitcellar com would be fun and interest ing technically speaking to use a graphic color LCD instead of a plain HD44780 like character matrix LCD My color LCD is designed for Nokia mobile phones It has 131 x 131 pixel reso lution and can handle 4 096 true colors It can handle 65 000 colors with dithering but dithering is cheating because the inter nal RAM can store only 12 bits per pixel The LCD has an SPI like interface which makes it easy to connect to the ATmega64L microcontroller Last but not least the module has a Philips PCF8833 integrated controller which has enough RAM to store an entire frame So I just have to send to the screen what I want to update on the display It s extremely easy to do and doesn t require a lot of com puting pow
115. d Jameco 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 The motor state machine code doesn t include code for managing the PCA Management is carried out by data manipulation functions such as Set MotorSpeed Listing 3 shows how cases for the S S S and 5 states are handled The code for S and S is identical to the code for the S and 5 state handlers the only differ ences are the events handled see Listing 3 The reusable state machine represents a motor Placing a call to this state machine with the motor axis as an argument invokes the state machine to control that motor axis You must generate various events to trigger the state transitions The motor can have one of define MOTORSM 50 define MOTORSM 51 define MOTORSM 52 define MOTORSM 3 define MOTORSM 54 define MOTORSM 5 struct _motevents char EvRunCW EvRunCCW MotorEvents 3 char MotorSM State 3 void MotorSM char motor EvStop switch MotorSM State motor case MOTORSM 50 EvLi ml the following states Initiate the motor 51 50 Stopped MOVING CW MOVING CCW HOME LI MSWI HOME LI MSW EvLi m2 MotorEvents motor EvRunC
116. d at address OxFE all unused addresses must be written with 0x00 To send a command sim ply fill in all the required command data values by sending a sequence of servo position commands with servo addresses ranging from OxFO to OxFD As the last step send the checksum character at address OxFE This will trigger the execution of the command Because all the boards in the optional OxF5 0 2 3 4 5 CMD FORCE REBOOT Command dest addr 0x00 0x11 0x22 0x33 Reply none none none none none CMD PING Command dest addr 0x00 0x00 0x00 0x00 Reply board addr 0x01 0x00 0x00 0x00 CMD GET INFO Command dest addr 0x00 0x00 0x00 0x00 Reply board addr BOARD TYPE FIRMWARE REV FPGA REV CONFIG BYTE CMD READ MEM Command dest addr ADDRO ADDR1 0x00 0x00 Reply board addr ADDRO ADDR1 DATAO DATA1 CMD WRITE MEM Command dest addr ADDRO ADDR1 DATAO DATA1 Reply board addr ADDRO ADDR1 0x00 0x00 CMD_GET_POS Command dest addr BANK 0 7 0 00 0x00 0x00 Reply board addr BANK 0 7 POSO POS1 POS2 14 CMD FORCE REBOOT Command checksum Reply none CMD PING Command checksum Reply CMD GET INFO Command checksum Reply checksum CMD READ MEM Command checksum R
117. dResponse gt lt params gt lt param gt value struct me gt name i bsta name val ue i nt gt 0 lt int gt lt value gt member member name i berr lt name val ue i nt gt 0 lt int gt lt value gt member me mber gt name i bcnt name val ue i nt gt 0 lt int gt lt value gt member lt struct gt val ue lt param params gt met hodResponse CIRCUIT CELLAR www circuitcellar com Photo 2 The functioning prototype was built around the eZ80 Acclaim development kit Note that the waveform displayed on the oscilloscope matches the waveform on the client application All of the eZ80F91 micro controllers GPIO lines were conveniently available at headers The ZPAK made downloading and debugging code across the network a snap well and with excellent data through put performance in all cases The eZ80F91 microcontroller is well suit ed to an embedded network control interface such as this one It will save us board space and additional cost with its integrated flash memory and Ethernet MAC devices as well We ve passed some significant mile stones in the development of the net work GPIB controller Although we now have an extremely functional prototype we d still like to complete several tasks As for the software we need to finish the GPIB driver because it doesn t imple ment the full IEEE 488
118. data strobe and serial input and output the USBLab has everything you need to over come the loss of a printer port The USBLab provides useful debugging capability for devices connected to a PC In addition to step by step instructions on how to design your own USBLab Stuart includes a help ful sidebar about attaching USB devices to PCs running Windows As you contemplate how you ll adjust to the push toward USB these articles will serve as a guide to help you choose the right course of action and avoid certain pitfalls Good luck CIRCUIT CELLAR 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 PUBLISHER Dan Rodrigues E mail dan Q circuitcellar com ASSOCIATE PUBLISHER DIRECTOR OF SALES Sean Donnelly Fax 860 871 0411 860 872 3064 E mail sean circuitcellar com Cell phone 860 930 4326 ADVERTISING REPRESENTATIVE Shannon Barraclough Fax 860 871 0411 860
119. datasheet you ll see that there are masking methods that you can use to fake out the SRAM s address lines to get the full use of the 64 KB bank of SRAM if your project requires it Using the A16 banking I O line is easier and safer Plus using the banking I O pin gives you 120 KB of usable external SRAM first inclination was to use the leftover SRAM from the ATA hard drive controller project However the wireless module s electronics and the Wi Fi card all run at 3 3 VDC My roll of ATA SRAM contained 5 VDC parts so I had to hit the datasheets and select a suitable SRAM IC and address latch I finally settled on the Cypress CY7C1019CV33 SRAM IC which is the slowest part of the bunch But it s plenty fast even with its 15 ns access time I chose the 12 ns part which has an access time that s well below my calculated AVR read low to data valid value of 76 ns I came up with 76 ns using an algorithm that I gleaned from the ATmegal28L datasheet Copy t 60ns 6ns where the Wi Fi module AVR oscilla tor frequency um 7 3728 MHz and Loo 73798 MHz 136 ns With the CY7C1019CV33 s 12 ns access time it s obvious that wait states will be unnecessary when accessing the external SRAM The ATmegal28L s datasheet also voices a concern about the address latch The ATmegal28L s external memory interface was designed for use with a 74AHC series latch My latch decision was based on 3 3 VDC opera tion versus t
120. dow should show the results of running the TestUSBLab py program Timing may vary from these values can of course change that to match a power supply you already have C5 is located near the ATmega8515 s Vcc pin pin 44 is located near the DLP USB245 V pin pin 11 LED D1 should blink when power is applied and the ATmega8515 is pro grammed If it doesn t check your con nections make sure that the 5 V sup ply voltage is correct and that the crystal is connected correctly I wrote the TestUSBLab py checkout program in Python It uses a commu nication module called commport py that I wrote for a previous project You must have Python and the Python win32 extensions installed on your computer to use TestUSBLab py After installing Python and the Win32 extensions turn on power to the board and plug it into the USB port Windows should detect the device If you re using Windows SPI the DLP communication port driver will proba bly load automatically If it doesn t you can get the driver from the DLP Design s web site Use the VCP driver Connect the expansion connector s pins 18 and 19 Tx and Rx with a jumper Before running TestUSBLab you must set the COM port to match your system You can find the COM port by opening the control panel and selecting System Hardware and then Device Manager You should see a COM port in the Ports window that isn t part of your system If you aren t sure whi
121. downloaded it via the control panel application which was also on the CD ROM The 8051 program takes the data from the ADC0820 and puts it into endpoint 8 When the endpoint 8 buffer is full the EZ USB board s USB software sends the data in the buffer to the laptop The 8051 program then loops back to gather more data and fill the buffer The program in the laptop uses Visual C It incorporates a modified routine on the EZ USB CD ROM to request the data from the 8051 When I tried to slow down the 8051 program to take fewer samples per sec ond the system appeared to suffer an interrupt This occurred when the sam ple time was greater than about 28 ms There s a way to get around this Take the samples at a high rate and discard the unwanted samples I chose a 20 ms sam ple time which gave me 50 000 samples per second That s 50 samples per mil lisecond so it took roughly 10 ms to fill the 512 byte buffer CIRCUIT CELLAR The 8051 endpoints use double buffering which means you have to send the data to the endpoint twice so the data is sent to the laptop approximately every 20 ms in a 1 ms time frame This results in a display rate of 50 times per second The display screen enables you to take a block of 512 data points and dis play data or step through each value using the index of the data array The other mode is used for entering the number of cycles each cycle is a block of 512 data points and displaying
122. e I received a message stating that the include file devioctl h couldn t be opened This is a Windows device I O control header file that wasn t included Cleat Graph Display FFT Device Numbes 0 v P NM o Data Index Fetch Data Indexe Graph Data Index Enter Number of Cycles Listing 2 used this routine to get data from the 80515 endpoint 8 Endpoint 8 data was transferred via pipe 3 The bulk transfer put the data into adcdata lthen transferred it to a buffer named array btc pipeNum 3 Read data in from EZUSB device bResult DeviceloControl EZUSB BULK READ amp btc sizeof BULK TRANSFER CONTROL adcdata 512 unsigned long amp nBytes NULL 1 lt 513 i adcdatali for www circuitcellar com hDevice CIRCUIT CELLAR in the EZ USB software You can find it in the Windows device developer s kit WINDDK The free DDK is included with the other files for this project APPLICABILITY Setting up the USB port for A D con version enables a host of experiments I use the system to acquaint my students with the basics of digital signal process ing and digital filters They can see the results of digitizing an analog signal as well as an immediate application in the FFT Watching the frequencies change as they apply various inputs signal genera tors whistles voices students develop an intuitive under
123. e amp Wob hasad adrninis ICOP Technology Inc Tel 626 444 6666 Email info icoptech com URL www icoptech com www circuitcellar com CIRCUIT CELLAR Issue 178 May 2005 63 TXDIO 3 TXD3 TXD2 TXDO 10TD 5 TX PBO 13 14 PB3 19 PB4 18 56 7 D V PBS 17 PET 18 NDAC NDAC NRFD NRFD Lic LM1117 5 0 5V REG IN 07 LM1117 3 3 bi p TX CLKAOTCLK SYM TX ER TXDA RXD3 RXD2 RXD1 RXDO RX DV CLKAORCLK SYM RCLK RX ER RXD4 MDIO Ud MDC Am79C874 g9 RST PWRDN PHYADA TP RD PHYAD3 TP_RD PHYAD2 TP_TD PHYAD1 TP_TD PHYADO TP_TD GPO TP TD 7W GP1 TP125 PCSBP ISODEF ISO CKIN NC FX SEL TEST BURNIN XTLP XTLN 6 R5 49 9 5499 TESTO RXIN FX TEST1 RXIP FX NC TXOP FX NC TXON FX RIBB TEST2 SDCM TEST3 SDP RPTR LEDFDX LEDTXB LEDBT LEDTXA ANEGA ACTIVITY TECHO LINK BT TECH1 SPDSEL TECH2 DUPLEX LEDLAOLSTA SD LEDTX LEDBTB LEDRX LEDSEL LEDCOL SCRAM EN LEDX LEDBTA INTR CRS AO0CRS COLAOCOL VCC C33 C41 Figure 2 The Am79C874 is an Ethernet 10 100 PHY device that connects directly to the eZ80F91 s media independent interface MII on one side and an 45 jack with integrated magnetics and LEDs on the other The SN75160 and SN75161 provide some state decoding logic as well as line drivers that are electrically compliant with GPIB The 5 and 3 8 V power s
124. e commanded pulse width regis ter pwm val is logically defined as a 2 byte register MSB LSB only the top 12 bits are used This greatly PWR PWR WIRE 2 PWM EN PWM ZERO ENABLE COUNT DATA OUT OUT DATA IN SEL1 SELO Figure 3 Each of the 32 PWM generation modules in the FPGA has a memory mapped 16 bit register 2 bytes used to set the pulse width General configuration register ctrl reg is used to set system options such as bank enable and zero value turn off At the top is the 16 bit master counter to which all the modules are synchronized www circuitcellar com Listing 1 n this VHDL code snippet of a single channel PWM generation module c o unt is an external 16 bit master counter operating at 4 MHz Each module has 2 byte p wm val register for storing the pulse width count To simplify the logic and reduce the FPGAS size the lower 4 bits of the LSB register are ignored to give an overall 12 bit effective resolution 12 011 process wrn begin register sel 0 logic sell data in if wrn event and wrnz 1 then On rising edge of wrn 1 then 1 downto 4 3 if sell pwm_val 1 elsif sel0 pwm vali end if end if end process Data out values 1 then If downto 0 sell high lt data_in sel0 high lt data_in 7 downto 4 hen latch data then MSB has priority LSB ignore low nibble data out lt pwm val 11 downto 4
125. e how the eight inputs will use the canned user phrases SpeakJet PROJECTS Take full advantage of the SpeakJet s Photo 1 Even though you can use Magnevation s activity board as a stand alone device it has a serial port so you can connect it to a PC The free Phrase A Lator software complements the activity board s hard ware for a total development environment www circuitcellar com 5 et Phrase E ditor CECI ne TR Controls Speed 105 Diphthongs R s iE E AWAR E PELE Voiceless Apply Controls Before eid dud Sound Fast Stress to tell you where it hurts As a program mer it s easy to assume you know which code is being executed when in fact the program flow may be in an entirely unexpected area A good pro AWRR C T zm Cal eps Ei ds a Es 2 _ DO 01 Ed 08 fp _ p Modifiers Repeat Dictionary Load Overwrite Loadinset Load amp Say Next Word Photo 2 You can call allophones and sound effects with a simple click of your mouse You can experiment to determine which allophones should be used for a particular word phrase or sentence You can also tweak the program to make it sound more natural canned user phrase EEPR
126. e low port 1 bits we needed to reserve port 1 PCA bits for driving the L297 s clock pin The stepper motors wouldn t respond at higher speeds the maximum clock frequency required wouldn t exceed 1 kHz or even less So instead of using the HSO mode we used the PCA s Software Timer Issue 178 2005 59 mode and toggled the clock pin inside the PCA interrupt This enabled us to use the PCA module to drive a motor without requiring us to use the mod ule s dedicated hardware pin to drive the motor clock signal The only dif ference between HSO mode and Software Timer mode is that the lat ter doesn t automatically toggle the module s pin Listing 4 is the module0 s hardware initialization code The module is programmed to drive the X motor in Software Timer mode The CCFO flag indicates that the interrupt has been caused by PCA modules share a single interrupt vector location at 0033H which is the physi cal code memory address You must declare a jump instruction at this loca tion to hook up the ISR You can do so using a special interrupt keyword for the Keil C compiler Inside the PCA ISR you must toggle the corresponding clock pin to generate the square wave You also must reload the module s com pare and capture registers a pair of two 8 bit registers CCAPOH and CCAPOL to get another interrupt corresponding to the motor speed The ISR also maintains one Mtermi nal Count v
127. e s placement and the shape of your lips Although short and long vowels can have a single vowel sound some combina tions use a transition between two vowel sounds These diph thongs combine to cre ate a single allophone such as the a sound in the word make Although generic rules for pronunciation can cover most situa tions you must pay attention to more than just the letters An exception dic tionary will help you fix mispronunci ations But automatic text to speech conversion is a complex process that s beyond the scope of this arti cle For more information on the topic refer to my column Next Generation Text to Speech in which I describe the Winbond WTS701 one of the most complete external text to speech processors on the market Circuit Cellar 158 September 2003 Now let s focus on the SpeakJet synthesizer Description Address 11 Address 12 Address 13 Address 0 Envelope Address 15 Figure 2 The synthesizer is composed of a number of oscillators The oscillator outputs can be mixed in a number of ways to reproduce the required speech or sound output SpeakJet SYNTHESIZER Have you ever heard of Magnevation No I haven t switched subjects here It has nothing to do with bullet trains or superconductors Magnevation began designing peripherals in support of the OOPic and other microcontrollers A robot builder at heart Magnevation s owner Jeff Richeson developed the SpeakJet
128. ed and we quickly manufacture it Development Kits include a powerful software development platform and extensive libraries Network and Internet Support Your embedded device 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 premium software modules are available at a nominal cost With the implementation of optional software modules such as RabbitWeb 551 PPP and AES you can securely and conveniently communicate with your embedded device from anywhere in the world Development Kit Includes Aloaded PowerCore FLEX with all options or non Ethernet low end version Prototyping board with development area Documentation on CD Dynamic integrated development environment Serial cable power supply and more Fro m 51 29 imma Seema dware development tog 5 dded System h purchase Buy A Development Kit includes Dynamic IDE and har Far a limited time get free copy i em Design Using the Rabbit 3000 Microprocessor wii www PowerCoreFLEX com 49 Value Fram SOW Configurable Features Microprocessor Speed On Board Power Supply SRAM Flash Serial Data Flash Ethernet Option A D Converter System Battery Backed SRAM Standard Features 39 General Purpose 1 0 5 Serial Por
129. em This is how all the different USB flash memory based drives can operate without driver software It s also why those flash memory drives need a driver for Windows 98 which didn t have a predefined mass storage class With the right firmware one device can make use of more than one driver by issuing different VID PID pairs during enumeration You could make a device appear as a COM port Then by flipping a switch you could re enumerate it as a memory storage device In fact so called Soft USB devices do exactly that soft USB device doesn t contain any per manent storage The operating code which is contained in RAM is lost when you unplug the device or turn off the power soft USB device uses a driver that loads the operating code before the device reenumerates as whatever type of device it s supposed to be Writing your own USB driver can be a problem because you have to obtain a VID PID from the USB organization If you don t you risk a conflict with a commercial product USB is intended for products that are produced to the tune of thousands not one time experimenter projects The simplest solution is to use a product such as the DLP USB245 which comes with drivers and adapt it to your needs www circuitcellar com project The USBLab writes received serial data to the DLP USB245 as it s received so you can correlate the received serial data with the commands you re sending
130. eply checksum CMD WRITE MEM Command checksum Reply checksum CMD GET POS Command checksum Reply checksum Table 1 The command set added to the Mini SSC II protocol allows you to send commands and read back configuration data from the target board The process simply involves sending a sequence of conventional position commands at the specific servo addresses shown with the data values indicated Sending the last checksum character triggers the command execution and the reply 46 Issue 178 2005 CIRCUIT CELLAR www circuitcellar com address Servo position 0x00 PWMO position LSB 0x01 PWMO position MSB 0x02 PWM1 position LSB 0x03 PWM1 position MSB PWM31 position LSB PWMS1 position MSB Figure 5 The PWM register address layout assumes that the board is configured with a base address offset of 0 Simply write the desired servo position value at the listed address to control the servo position Note how the MSB and LSB registers are laid out If 8 bit Control mode is adequate then set the LSB to 0 and use only the MSB registers daisy chain configuration will receive the broadcast message it s necessary to specify at address OxFO the destina tion base address of the board for which the message was intended The selected board will then reply to these commands with the requested data The layout of the PWM registers is shown
131. er Fortunately Internet radio broad casts are sent as compressed audio Some lucky people have 100 Mbps Internet connections but not The most common format is the well known MPEG I layer III MP3 Of course the ATmega64L microcontroller isn t powerful enough to perform the decompression It s a microcontroller not a DSP That s why I had to find a suitable dedicated MP3 decoder chip I used VLSI Solution s new VS1002 which performs all of the decompression and converts the uncompressed numeric audio signal to an analog audio signal through an on board DAC Now that you re familiar with the project let s take a closer look at the parts I used I ll describe the software after I cover the hardware VCC ATmega64L MCU The ATmega64L microcontroller has 64 of flash memory see Figure 1 The current code requires far less code space but having a lot of code space made testing easy For example I had some problems initializing the VS1002 I encoded a small 5 s 32 kbps MP3 file to an h file so the MP3 data was stored in the ATmega64L microcon www circuitcellar com 10k CPU ATmega 4L 56 55 57 54 PEN 1 x uU RXDO PDI PEO PE1 XCKO AINO 2 OC3A AIN1 PES OC3B INT4 4 OC3C INTS PES T3 INT6 IC3 INT7 7 SS SCK PBI MOSI PB2 MISO PB3 2 0 UJ
132. er you click the Graph Data button It s a good idea to click the Clear Graph button before tak ing the data because it ll give you a solid black background Use the index buttons to inspect the data values one by one The FFT resolution was approxi mately 100 Hz which was adequate for my work I took the FFT routine which uses the BASIC language from Hal Chamberlin s book Musical Applications of Microprocessors I converted it to C for this applica tion The screen is updated 50 times per second so I get a l min count by entering 3000 in the Cycles box OH YE PITFALLS Make backups of the working directo ries Doing so will keep you from weeping if Visual C does some thing to your files Be careful about erasing portions of an EZ USB file you re modifying for your applica tion It s easy to erase too much code It s much better to use forward slashes to turn the line into a remark You also should be extremely care ful when loading a program into the EEPROM Because the USB software depends on the vari ous identification bytes to choose the correct driver changing the EEPROM could change the bytes If you re lucky the CD ROM will contain another driv er that will connect with your board when the first driver stops working This happened to me Now I have to load the monitor program manually It used to load automatically at start up When I attempted to compile the BulkXfer fil
133. ere are also chip select CS lines for the slaves When a CS line is active the slaves listen for data on the bus and eventually respond to it The VS1002 has two CS lines one for a control bus XCS and another for a data bus XDCS The former enables it to send control commands to the VS1002 initialization digital volume control and so on The latter enables it to send and receive MP3 data The Net Radio is used only as an MP3 decoder so only MP3 data is sent to the VS1002 The VS1002 operates in Normal mode and Streaming mode which I CIRCUIT CELLAR found especially useful I wasn t able to find another coder decoder that I could configure to work in Streaming mode In Normal mode which is common to most if not all MP3 codec chips there s a DREQ sig nal that the decoder sets to 1 when it wants data The only thing to do is to read the MP3 file from a flash memory card or a hard drive and send it to the decoder when the line is a 1 When it goes to 0 you must stop sending data to the decoder and wait for it to go to 1 again Then you can resend data There s a problem with Normal mode that makes it inappropriate for the Net Radio In Normal mode the playback rate is controlled by the MP3 decoder s clock Perhaps a 128 kbps MP3 will be played at 129 kbps instead of the nominal 128 kbps because of a clock drift It isn t a problem when you can stop reading the data and restart whenever you want But when a
134. es 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 5650 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 devi
135. es there really is a Circuit Cellar or in the garages It s just that there is a lot of it Call it a personality defect or an excessive case of planning ahead but if get interested in an idea start collecting the means to accom plish it If start thinking about adding a few web cams start picking up cameras more wire wireless transmitters Wi Fi antenna extenders etc But of course don t know exactly what kinds of problems I ll run into when finally start installing so need to stock both color and black and white cameras both regular and low light You get the picture lm one of those guys who doesn t like just talking about doing things When am ready want to do it right then don t want to wait six weeks for a back ordered part because the odds are that I ll probably be onto something else by the time it shows up generate lots of ideas and don t want to miss executing one when the time is opportune Of course this runs completely counter to the rules The typical engineering process involves iterative steps and lots of planning And then finally you start your project In my mind this is for wimps prefer burst mode project execution When get an idea just keep it on the back burner while collect every conceivable item to complete the task in the shortest possible time don t like putting a project aside to collect parts after start working on it Only when have accumulated all of the potential ing
136. ety of engineering products and services phyCORE nyir nard E ppi L 55 qa mr E maiii deng puge bbe t amp g inin ae reki B 11 BG EAE E CAN 25 200 405 oe Ae DAL fees Sepa carn Aree So LI B avadabia in wr darem and cor es ray var Hrzugn poziriyrrg ip asdermdatenn accurate piu ind nadie rmi tor Bn ee ae Ble ao E anisi ma ed ein n Add USB to your next project it 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 Design services available DLP Design Issue 178 May 2005 Turn serial data into video text BOB 3 XBOB 4 ww w decadenet com T DECADE ENGINEERING 503 743 3194 Tumer OR USA Put Your Devices on the Internet and in local networks too Networking isn t just for PCs Leam Embedded how to design RNET and program m An small devices INTE R NET that exchange COMPLETE data via TCP IP host Web pages communicate using e mail p and FTP and much more Embedded Ethernet and Internet Complete by Jan Axelson ISBN 1 931448 00 0 549 95 Lakeview Research www Lvr com From the author of USB Complete
137. f my paper ration The basics of serving web pages from a wireless 802 11b station are in place You now have the tools Internet Photo 3 n my opinion building good looking embedded web pages 15 more difficult than writing Wi Fi web server code www circuitcellar com necessary to build your own Wi Fi web server application So remember to keep it sim CIRCUIT CELLAR ple It doesn t have to be complicated to be embedded kl 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 15 embedded systems design and com munications Fred may be reached at fred edtp com PROJECT FILES To download the code go to ftp circuit cellar com pub Circuit_Cellar 2005 178 RESOURCE Atmel Corp 8 bit Microcontroller with 128K Bytes In System Programmable Flash ATmegal28 L rev 2467MA AVR 2004 SOURCES mkII and ATmega128L MCU Atmel Corp www atmel com TRENDnet TEW 222CF TRENDware www trendnet com CY7C1019CV33 SRAM Cypress Semiconductor www cypress com ICCAVR C Compiler ImageCraft www imagecraft com Issue 178 May 2005 39 200 MHz ARM 104 49 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
138. fth buffer transfer of the HID report descriptor The first 2 bytes of the sixth buffer were transmitted as C5Ah instead of the correct 257Fh Universal Serial Bus Revision The faulty report descriptor trans 2 0 Specification www usb org mission caused the PC to change the compiler was fixed in version 1 9 3 The mouse data transmission starts after the host receives the good report descriptor DS39622D 2005 USB Implementer s Forum Device Class Definition for HID Version 1 11 SOURCES www usb org developers hidpage HID Descriptor Tool www usb org developers hidpage Microsoft PIC18F2455 Microcontroller Microchip Technology developers docs www microchip com 20 Issue 178 2005 CIRCUIT CELLAR www circuitcellar com ARMTTOMLS APE nrerin Power Management RTC WOT 3 Chane bi Fre a LPC MN RU ER esI 2 Uan AD or PP HEhasnn piar n ERA om LPICTI BM We ve squeezed more in how much can you squeeze out The gauntlet has been laid down Take part in the Philips ARM Design Contest 2005 anc pit your degen skills against your peers Not only wall vou have the opportunity t win share of 15 000 in przes but you can bask in the knowledge that your design pushes the industry s fastest ARMI family of microcontrollers to its limit First Prize 3000 Second Prize 7000
139. g routines running successfully Although the tuples can tell you important things about the CompactFlash card I was only inter ested in making sure I got the correct I O portal address so I could issue commands to the Wi Fi card The cor addr variable holds the valid CompactFlash card s I O portal address which is OxO3EO in this case The address is supposedly stan dard but I still would rather determine the correct address on my own My troubles weren t over at that point The Wi Fi card enabled just fine but that s where it ended Using my wireless sniffer I captured what I thought would be the Wi Fi card s probe session with the access point AP However I didn t see any radio activity from the TEW 222CF which could have only meant that my CompactFlash card Wi Fi regis ter read and write routines were still in the ditch After some additional debug ging I found that my Wi Fi card wasn t receiving an initialization command Therd cf iol6 andwr cf 1016 func tions in Listing 2 p 38 weren t working as designed Before reading on please download a copy of the 16 bit Wi Fi card register read and write routines from the Circuit Cellar ftp site so you can follow along I was only issuing the TO NI C macro cf addr function so the before rd cf 1016 function wouldn t work The combination address data bus was always in Output mode following the address write and latch operation The cure here
140. h memory to applications covering the spectrum from 30 000 to million gates and from 100 to nearly 1 000 pins and Denverasn t bright Wasted configuration memory strike 1 Power up surge and delay strike 2 Cosmic corruption strike 3 SRAM based FPGAs you re outta there FLASH O MATIC Although it s a tiny company com pared to FPGA heavyweights Altera and Xilinx I ve got to say I really think Actel is onto something with their ProASIC flash based FPGAs This isn t news Actually the story began five years ago when Actel acquired flash memory based FPGA technology from a company called Gatefield sup plementing their anti fuse based lineup I was optimistic about their flash memory FPGA foray when I first covered it back in 2002 FPGA News Flash 145 August 2002 With Actel s latest announcements of new chips tools and even a new marketing philos ophy I m actually more fired up now see Table 2 Like the earlier ProASIC and ProASIC parts the third genera tion ProASIC3 and ProASIC3E family relies on a sea of three input look up table or a D flip flop see Figure 2 Such relatively simple logic elements form the basis for Actel s claim that as the name implies ProASIC is the most gate array like FPGA and thus a good fit with existing ASIC design tools and methodology But as competitors are quick to note simple logic elements require more interconnections and thus put pressure
141. h more www allelectronics com Free 96 page catalog 1 800 826 5432 Got Dial Tone Telecom Hardware Software Developers STOP izsang your phone links to test and damanstrale your devices Our afferdsabis telephonms line almulatars offer auihentic USA dial tans busy signals and ringing E amp uppariz high speed analcg medinm tag Riwc Ir Teco LED dispiny Jack Real Z Hz Fang Solo Pasty LIME Teaco Bie Caler iD Diatinetiun CPC Disconnect HS Xa 598 Digital Products ep Ap wp v 1243 Windstar Circle Me Folsom 935530 USA Tel 915 985 7219 Fux 976 596 9460 http www digitalproductsco com pe asd Tfl Ww INTRO T ROBORIS you want to get started robotics but don t know where 15 begin then this OYO is you the programmable the world the Hae Hot we show ou low ams iE ba about robotics WATCH THE TRAILER AND Buy copy Issue 178 May 2005 91 BET 333 GALEP 4 Pa LUM YEReAL COMPLETE KIT ee 188 processor 33 MHz w Flash File system 44 Digital O fines wi CPLO Console Debug Serial Port 17 341 DC 5V DC power 2 Seri
142. has a set of descrip ual But Mighty compact at 3 a 7 Kit IT J Complete ACM 2300 Development System RCM2300 RabbitCore 256K Flash 128K SRAM 29 general purpose via pluggable pin headers Complete development software not a trial version Hundreds of sample programs and libraries Development board with prototyping area AC adapter and complete documentation O1 se M dig Stamp VB Compatible DISPLAY FEATURES 1MB Onboard Flash Bitmap Memory _ Graphic Text Commands Downloadable TTF Fonts Battery Pack Option Sony 24U0x 1 27 Color LCD BD 1 6 VGA Transflective with LED Frontlighe Sunlight Readable OEM pricing starting at 789 EA R M zl ke 18 1 178 2005 Lies Work CIRCUIT CELLAR Buy Development Kit Online Add the RCM2 200 Ethernet RabbitCore ta your kit order only 27 50 reg 555 www tinyrcm com 2592 Spafford Street Davis 555 18 210 757 8406 www circuitcellar com tors that are used to give information to the PC about the USB device Some of the types of descriptors include device configuration string inter face endpoint HID and report The device descriptor for this proj ect is shown in Listing 1 The first 2 bytes are pretty standard for all descriptors The first byte contains the length The second byte gi
143. he Menu key invokes the con define LOC POS 0 long define LOC SPEEDLOC POS sizeof long i nt figuration menu The parameters for each axis are separate but identical define LOC MOVEMENT LOC SPEED sizeof int char LOC COARSE STEPS LOC MOVEMENT sizeof char unsi gned therefore you can use the same string of menu items to set identical param LOC FINE STEPSLOC COARSE STEPS sizeof unsi gned char eters provided you can change the E m LOC STEPMODE LOC FINE STEPS sizeof char char define LOC MOVEMODE LOC STEPMODE sizeof char char l axis while the menu is displayed The Mot or Dat a structure declara define LOC MAX TRVEL LOC MOVEMODE sizeof char long define LOC SCREWPITCH LOC MAX TRVEL sizeof long float define LOC CHECKLI M T LOC SCREWPI TCH sizeof float char tion comes to the rescue You need to provide only the array index to match the currently selected axis This LOC HOMESWLOC CHECKLI MIT sizeof char char define MOTORDATA SIZE 2 sizeof long 6 sizeof char 2 sizeof int sizeof float void GetMotorDataE2P char motor enables you to reuse the menu item handler functions for all of the axes Each menu item string is limited to a maximum of 20 characters The parameter values are displayed or the new values are entered on another struct motor long Pos int Speed char Movement unsigned CoarseStep
144. he address latch guidelines in the datasheet I m partial to 573 latch layouts so I eliminated latches with a 373 designation I ended up selecting the Texas Instruments 3 3 VDC www circuitcellar com SN74LVTH573PWR in the 20 TSSOP package Compared to the address latch the CY7C1019CV33 is a relative ly large part it s packaged as a 32 lead 400 mil molded SOJ I would ve preferred the SRAM in the smaller TSOP II form but I couldn t obtain that pack age scheme from my SRAM distributor Mick Jagger is right You can t always get what you want The ATmegal28L guarantees a mini mum address hold time of 5 ns after the ALE signal falls low The datasheet warns that you must choose the address latch accordingly As it turns out the SN74LVTH573PWR needs only a 1 5 ns window to capture the address data You re covered Another critical factor concerning the selection of the address latch is the address valid set up time t yc before the ALE signal drops low The mini mum t value with a 7 3728 Hz AVLLC clock and 3 3 DC operating voltage is 10 58 ns Cavite 0 5tcrcr any TM i E BRING YOUR WIRELESS PRODUCT QUICKLY AND LEGALLY TU MARRET gt TECHNOLOGIES FIELE AWW limcdechnalagies com CIRCUIT CELLAR Add INSTANT wireless analog digital capabi
145. he associated programs HACK THE CODE Let s start with the program for the 8051 You can test your program with the Cypress control panel which you can install with the EZ USB CD ROM Mind you this isn t the control panel furnished by Windows XP The CD ROM installs the control panel under the Cypress entry that appears when you click the Programs bar in the Windows Start box The 8051 program is written in C and uses the Keil compiler on the EZ USB CD ROM Install the compiler during the set up process After the program is compiled download the executable file to the 8051 using the control panel You Listing 1 used this C code for the 8051 The routine was inserted in the fw c program to load data from the ADC0820 to the 8051 endpoint 8 buffer The system is double buffered and the data must be entered twice TD Poll REVCTL 0x03 SYNCDELAY FI FORESET This command is already in the main while loop code starts here 5 is a time delay 0x80 Reset buffer SYNCDELAY FI FORESET SYNCDELAY FI FORESET SYNCDELAY EP8CFG 0 0 OED 0x00 OEB 0x03 0x08 0x00 Enable endpoint 8 Make al Make two lowest of port bits of port D as input bits B the output bits remaining 6 bits are input bits for pede lt 512 1 0x03 08 0x03 ReadyLoop STATUS 108 while JSTATUS amp 0x04 goto ReadyLoop LOB
146. he files needed to form the exe cutable file The file became ADCDATAS after approximately 30 iterations The EZ USB kit also includes EZ USB FX2 CY7C68013 Technical Reference Manual Cypress 2001 which explains how to use output enable port B OEB output enable port D OED and send data to port B IOB I used port B for con trol signals to and from the ADC0820 I used port D to get the data from the ADC0820 The EZ USB board is double buffered so you must send the ADC data 512 bytes to endpoint 8 twice I placed the code right after the TD poll command within the main program built into the fw c program Figure 1 p 32 is the wiring diagram I used to connect the ADC0820 to the 8051 A 7805 voltage regulator sup plies 5 V for the chip The large value electrolytics help remove noise from the power supply You should also put 0 1 uF capacitors at all the 5 V inputs to the chip The EZ USB kit comes with an expansion board that connects to the main board via headers J1 through J6 I used only J1 because it contains both ports A 34 pin connector often used to connect floppy and hard drives to a motherboard connects with J1 Photo 1 p 32 shows the ADC circuit and its connections to the EZ USB board Port B bits are used for the start pulse BO output enable B1 and INT B2 for the ADC0820 The start pulse initiates the conversion process The INT pulse lets the 8051 know that the conversion is complete
147. hesis p 70 More Flash Less Cash Tom Cantrell USB Bonanza June Preview Jennifer Huber 96 PRIORITY INTERRUPT 8 NEW PRODUCT NEWS edited by John Gorsky 11 TEST YOUR EQ edited by David Tweed 6 Issue 178 2005 CIRCUIT CELLAR www circuitcellar com Are You Driven by the Means of the End Steve microcontrollers The perfect combination of performance and power on E Specifically designed for the latest battery operated portable RY 1 applications Atmel s new Low Power AVR microcontrollers W provide six low power operation modes These devices MENU work down to 1 8 volts providing maximum battery hn low power modes such as standby AVR tums off all intemal peripherals and the core Standby mode leaves only the external crystal running to deliver start up times as low as 6 clock cycles AVR is RISC CPU that executes instructions in a single clock cycle with a rich instruction set and 32 working registers microcontrollers have a very high code density and extremely fasi execution speeds up 10 24 MIPS The Flash program memory and on chip EEPROM will help you slash months off your development efforts save thousands of dollars m project costs and save YOUR energy as well Check out AVR today at AVR comes in a full selection of package and performance options and 5 supported by a full compliment of integrated tools to make your developmen process fast
148. htm Incredibly Easy to T Our software is used by many colleges far teaching PLCs Tel 1 477 674 7527 PLC spectalist since 1993 QScreen Low Cost Versatile Instrument Controller e Touchscreen Operated GUI a 128x240 CCFL Backlit Graphic Display a Programmable in C or Forth s Hundreds of Screens Buttons amp Menus A D and Two RS232 485 ports a B Timer FH EE E Up to 1 MB Flash 512KB RAM Selection o o www circuitcellar com Exc mm 6 DEVELOPMENT BOARDS NEW use Development Board AT8BCR131 Microcontroller 32kBytes Flash Real Time Clock Extemal EEPROM Easy USB Interface and Control In Circuit USB Programmmg Also Ayailable Opta Isalated Relay Guiput Board Web Contral Board and Heeps More www futurlec com ValueCAN The High e se to can Simple software analyzer included e DLL with examples Value Tool For for custom applications PC isolated from CAN Area a 100 bandwidth at 500 www ntrepidcs com vcan CIRCUIT CELLAR C T Electronic and Electro mechanical Devices Parts and Supplies Wall Transformers Alarms Fuses Relays Opto Electronics Knobs Video Accessories Sirens Solder Accessories Motors Heat Sinks Terminal Strips L E D S Displays Fans Solar Cells Buzzers Batteries Magnets Cameras Panel Meters Switches Speakers Peltier Devices and muc
149. icro processors Not only does this simplify which compiler to choose it also eases migration between processors by having a familiar tool set i HF 1 1 TE FI TAI lal 15 E EL I i 15 ne nc i I 1 H T de ji i A Yt mili vitl Y Recognized HI TECH Soltwara proudly Microchip Supports the Microchip brand with industrial strength HI TECH Software LLC 5500 Silacci Way Gilroy CA 85020 USA Tool Provider ry d C Ph 800 735 5775 Web comi Three Full Day Symposia Conference Tracks Automotive Sensing Medical Sensing Intelligent Systems Technology amp Design Wireless Sensing Industry Applications Business Perspectives A comprehensive conference program featuring Leading exhibitors featuring sensors instrumentation high visibility keynotes and over 100 speakers and controls and integrated technologies Jeanne Duval companies A M 603 924 5409 jduval advanstar com Cathy Walters companies N Z 516 771 6868 cwalters advanstar com T T h T E i i E 1 E mi Fs IT Lt PIC Programming Made Easy Proton t PICBASIC Development Suite Next Generation IDE
150. igned cl 0 1085 SRAM Signed OxlOB6 SRAM while temp gt 0 signed cl 0 10 7 SRAM signed cl 0 10 8 SRAM temp strncmp GET http temp 5 signed cl Ox10B9 switch temp Signed cl OxlOBA EE i signed 0 10 signed OxlOBC signed cl OxlOBD signed cl OxlOBE signed cl OxlOBF SRAM Signed cl 0 10 0 SRAM signed OxlOCl SRAM signed cl OxlOCZ SRAM signed cl 0 10 3 SRAM if signed 0 10 4 SRAM signed cl 0 10 5 SRAM signed cl 0 10 6 SRAM Hr unsigned Ox10C7 SRAM signed Oxl0C8 SRAM z unsigned 0x10C9 SRAM ck for the number of byte x unsigned cl 0 SRAM ermine how many bytes are ou if ini ng_ack lt ack unsigned OxlOCB ny expected unsigned ir 0x028C 1 siz ect Chee it tepdatalen out 0 20 Eus E sa 1 set finfla ackni pen tor packet PE e a http temp i LOW BYTE packet TCP data j http temp i 1 HIGH BYTE packet TCP data j 1 222 http temp i LOW BYTE packet TCP data j temp dot packet TCP http 1 1 lt lt 8 http ok i 2 packet TCP datat k http_ok i fl packet enetpa cketLen11 00000 clear 802 11 length ssemble incoming Pss Em meet LICE gee cket TCP acknum nd adjust the expected incoming ack my expe wledgenent expe pate d ack
151. iguration 01C Configuration is set to 1 00 ff00 Mouse data is transmitted from EP1 once HID HID request BufferCopy bmRequestType amp 0x20 H gt HID Host to HID Sldle Set idle stall Stop EP1 transmissions I gt H Interface to host HID RD Report descriptor 050108 50 bytes of report descriptor are sent 1 00 08 15 00 08 81 02 08 05 01 08 7c 5a 08 f5 0a 02 H gt D Host to device SC Set configuration 00 Configuration is set to 0 which forces device back into address state and pre vents mouse data from being sent Table 3 n this debug output from a run with a compiler error the HID report descriptor was transmitted incor rectly which caused the host to take the device out of Configured mode cuit board but that provided inade quate information Because the com piler prevented me from using the same subroutine in two different threads I used LEDs to report infor mation about the interrupt routine I hooked up an optional Maxim 233 RS 232 driver receiver to the micro processor UART to send debugging data via a serial port to the HyperTerminal communication pro gram running on the PC The first LED lights up when there s a reset interrupt The fifth LED lights up when there s an error interrupt Table 3 is part of the commented debugging output from one of the configuration from 1 back to 0 With the latter
152. in that all the parallel data is written when the ReturnAck command is received You can do something similar with the send serial command by placing a ReturnAck command at the end of the last serial transmit command pair In this case the Ret urnAck command will indicate that the last serial byte was written to the output UART not necessarily that it was transmitted Matching the timing of the serial data with the timing of control inputs is often a problem when you re using a serial port to debug a CIRCUIT CELLAR USB Enumeration After a Windows based PC detects that a USB device has been inserted it queries the device to see what it is The query process involves passing several descrip tors back and forth but the result is that Windows obtains a vendor ID VID and product ID PID These values are used to select the driver that will communi cate with the device Enumeration is the process of obtaining the VID PID and other information If Windows can t find a driver it will ask you for one The default VID and PID for the DLP USB245 are 0403 and 6001 A USB device can use its own driver or it can enumerate itself as a standard Windows recognized device class These classes include USB mice keyboards and mass storage devices Devices using pre defined USB classes are expected to oper ate according to the protocols for that class so no driver is needed or more pre cisely Windows has built in drivers for th
153. ine If an entire packet is received with a valid check sum the command is executed The next step involves checking to see if the refresh fpga flag is set Only the INTO ISR can set this flag The FPGA generates the signal externally After the flag is set it s time to compute the next positions for all 32 channels When velocity loops are enabled the intermediate interpolated positions are computed until the target position is reached This generates smooth interpolated motion and reduces servo twitching Some positions may have been changed by external requests received through the serial port Servo bounds checking is performed on each chan nel and finally the entire array of cur rent servo position values is trans ferred to the memory mapped FPGA registers as a simple array to array memory transfer The final step involves housekeep ing tasks such as kicking the watch dog Also as a special touch instead of the traditional blinking heartbeat LED I decided to control this LED through one of the MCU s internal PWM pins OC1B Changing the PWM value can modulate the LED s INTO interrupt update req Raise Read data refresh fpga byte and place in serial receive buffer UART RXD interrupt Return from interrupt Return from interrupt Complete Process valid packet Y packet and execute CMD Transfer computed array of 32 servo positions to FPGA registers Perform housekeeping Figure
154. ine Channel Setting 16 bit sr par s OE 89 8 RTO is rr rr per FOP a a Tes 3 87 oe aT Ju T d amp 4 5 8s 5 10 Ho 2 14 155 Atlee 18 T9 0205 221 2 23 0245 525 5 2 028 29 5 STE 532 development was extremely easy with the ImageCraft com piler The on chip debugger proved extremely useful too Photo 2 The blue bars show the programmed travel limits of each axis The top sliders are the coarse position control and the bottom sliders are the cor responding fine position control Other menus allow you to adjust the speed start position and other configurable parameters walking motion Several university research labs cur rently specialize in nonholonomic robotic manipulators that have many degrees of freedom An articulated snake with servo driven sections is a good example of such a manipulator Again there s a requirement for con trolling numerous servo channels The popular field of special effects can also benefit from multichannel servo control Even the simplest full featured animatronics creations typi cally require a large number of servos to bring them to life Daniel Rozin s wooden mirror proj ect is another interesting application http fargo itp tsoa nyu edu danny mirror html The artificial mirror consists of a large array of small wooden blocks actuated by 830 dis crete servos It can generate
155. ine from an endless loop for each motor to properly control each axis You can reuse the code to implement identical state machines You can generate events for the motor state machine from a number of sources For instance a keypad handling code may trigger the EvRunCW event for an x axis motor when you press a key on the front panel The PCA ISR may trigger the EvStop event for a y axis motor after reaching the terminal count requested by a MOVR Y 200 remote command You must identify different tasks that need to run concurrently and model them as the state machines state machine can call another state machine as well This way you can create mutually exclusive access to the shared resources As for the motor driver if you want to disable the keypad while you re operating the driver in Remote mode you need to declare the keypad han dler and remote command handler as two different states of a single state machine A single state machine obviously can t execute two states simultaneously MOTOR CONTROL ROUTINES Now let s focus on programming the PCA hardware to control the motor You can use the High Speed Output HSO mode of this hardware resource to move the motor by toggling the port pin in the hardware that pro vides the clock signal to the motor sequencer IC L297 While we were designing the driver hardware we decided to allocate one 8 bit I O port per motor Because all five PCA modules were located on th
156. installation But where was the installer The dialog box seemed to have disappeared in the interim Poking around at some point I closed the Explorer window I d been using to regis ter at the Actel web site Suddenly the installer dialog reappeared and I was able to complete the installation successfully Although most tools have moved on to USB notably including the forth coming ProASIC3 kit the FlashPro Lite downloader programmer that came with the ProASIC starter kit relied on a parallel port connection Actually because nobody uses parallel ports anymore that means most of them like mine are gathering dust so nothing needs to get unplugged I gave the lash up a 50 50 chance of working without fiddling around with a BIOS set ting e g EPP and ECP or some such but I was relieved to find I was able to connect and download successfully GATE DATE I expect or at least hope few of you will encounter the upgrade installation and licensing hassles I went through On the other hand fair warning that such are not uncommon when it comes to the latest and greatest chip design software Anyway with everything up and running I was able to proceed through the tutorial which walks you through the process of getting your ideas down on silicon The Libero opening screen served as a good road map by showing each step along the way see Photo 2 First you create a project that serves as a central repository for the many
157. ion rud bo worry if the sample buffer ig boo small or the campressicn used ts good enough on your Tha USBaa ZX and 5 5X steam data cer the High Speed USB 20 bus and use your RAM for ihe gample buffer This gres you many times more samples than other equipment Visit our web site BE com ba dawnload ihe USE software far free which mire in demonsiration mede wilh alached 512 KB SRAM A D Bus AMD AM79C874 Ethernet PHY Zilog eZ80F91 GPIO GPIB Line drivers Acclaim Figure 3 We satisfied our hardware design goal of having a highly integrated low cost system The eZ80F91 microcontroller performs all of the important functions in the system The other devices serve only to interface it to the outside world line drivers Because the development kit exposes the eZ80F91 GPIO pins on a set of 0 1 headers it was easy to interface the circuit to the develop ment kit via a standard ribbon cable To connect the GPIB bus to the line drivers we sacrificed a GPIB cable by cutting the connector off on one end to expose the wires inside SOFTWARE DESIGN The GPIB bus consists of eight sig nals for data and eight for handshak ing The maximum data transfer rate is specified to be 1 MBps but because each data byte on the bus is acknowl edged the speed of the bus transac tions actually depends on the speed of With Millions of Samples Find Bugs Fas
158. ion E in a hardware building sort of mood this month I ve been reading nonstop since January I figure it s now time to move from concept to design and realization I thought I had it bad for Ethernet projects but it seems that I m eat up to use a southern term with interest for wireless LAN stuff as well If you re a veteran Circuit Cellar reader you know that I started the 2005 season with a column about what I thought microcontroller enabled 802 11b should look like For the past few months I ve been concentrating on getting some additional scoop on 802 11b that I could turn into yet another working embedded wireless hardware device Well I m now ready to share with you some of the wisdom I gained while studying in the faint light of the burning midnight oil This month I ll describe a finished piece of 802 11b hardware coupled with a working set of 802 11b firmware routines As always my goal for getting on a wireless LAN was to keep it all as simple as possible NEW WI FI HARDWARE As you can see in Photo 1 I stuck with the TRENDnet TEW 222CF CompactFlash 802 11b interface I matched it up with an Atmel ATmegal28L which is the ATmegal28 s low powered first cousin The ATmegal28L has an extremely straightforward I O interface In this version of the 34 Issue 178 2005 hardware I simply used whatever I O pins I needed for interfacing to the CompactFlash NIC and left the rest for the outside world
159. ion and limit switches The MCS 51 architecture enables you to CIRCUIT CELLAR store 128 bit variables The Keil C compiler makes it easy to assign bit variables to the bit space Because of the limited amount of space Listing 1 shows only the definitions for the X motor There are similar definitions for the other motors Each motor s configuration informa tion is saved in the 128 byte EEP ROM This enables you to load the parameters at power on reset and ini tialize the Mot or Dat a structure Relocatable definitions were made for each motor axis see Listing 1 If you make a change in the MOTOR data structure you must make the same change in the definitions We used the Get MotorDataE2P data structure to load the data from the EEPROM Because the elements inside an array occupy adjacent bytes we had to load a block of data equal to the size of thestructure data struc ture The MOTOR data type was defined as the union of structure _ motor and a byte array of the same size so data transferred from the EEPROM to the Mot or Dat a variable was greatly simplified Moreover we didn t need to bother with the data type of the indi vidual structure elements because it was already taken care of by the union You can change few parameters when you re operating the driver If you need to store parameters immedi ately after the change to the EEPROM you can use another definition with overlapping storage un
160. ion declaration for the specific data type e g a float variable with the byte array size of sizeof float You can then insert the float value into the float variable Issue 178 May2005 51 You ll get individual data bytes by accessing the byte array You can declare a similar data structure for other intrinsic data types This relieves you from having to manage the bytes while moving individual parameters between the EEPROM and line on the LCD You must write the menu handler function corresponding to each menu item We developed a library menu for our users You may download the code for our menu from the Circuit Cellar ftp site We prepared a comprehensive com mand set to remotely operate the driver see Table 1 p 54 This enabled our users to automate the experiments that included our stepper motor driv ers The Standard Commands for Programmable Instrumentation SCPI defines a standard set of commands data RAM You also save on code even though the P89C51RD2 provides plen ty of code memory Listing 1 Using a data structure greatly simplifies feature implementation The configuration management code fragment effectively uses this data structure to access the configuration motor parameters USER INTERFACE You can control the motors either locally via a keypad or remotely via an RS 232 serial interface The driver s status is updated periodically on the local 4 x 20 LCD Additional code is req
161. iria conmmegrcig Si CIRCUIT CELLAR powerful sound designer that enables you to build and test phrases sounds and control sequences The SpeakJet can interface serially with your PC if you add an RS 232 to TTL translation driver MAX232 or use the SpeakJet activity center PCB see Photo 1 The Phrase A Lator software also allows you to program the internal EEPROM with your newly built phrases and sound effect and control codes You can customize sounds through the internal five channel syn thesizer The user interface offers six minia ture applications Phrase Editor Synthesizer Control EEPROM Editor Dictionary Editor Event Control and Data Rate Detuning The Phrase A Lator uses a text based dictionary to recall the phonetic equivalent of com mon words The text file is easily edit ed with any text editor You can add new words designed with the Phrase Editor to the diction ary with a single click see Photo 2 Use the EEPROM Editor application to create the 16 canned user phrases and program them to the SpeakJet s EEPROM You can also insert sound effects and control code into user phrases intermixed with allophones This is where the first 32 MSA com mands can create powerful operations You can make your own sound effects with the Synthesizer Control applica tion which gives you access to the internal five channel sound synthesiz er The Event Control application helps you determin
162. itializes all the peripherals and performs basic tests like an EEPROM checksum test and an SRAM test If there s a prob lem the firmware will inform you and even try to repair the data e g by Listing 1 A little trick allows you to send a 9 bit word to the LCD controller through the 8 bit SPI You can send the first bit by deactivating the 8 bit SPI The remaining bits are sent with the SPI void spi sync transmit unsigned char SPDR cData while Wait 1 SPSR unti void Icd command unsigned char cData CDI SPCR SPE Cbi PORTB PB2 D sbi PORTB PB1 ry EIE SIS Cbi PORTB PB1 sbi SPCR SPE hl 5 1 cData 1 lt lt 5PIF the byte is sent isable SPI et MOSI low et SCK high et SCK low nable SPI spi sync transmit cData void Icd data unsigned char cData CbI SPCR SPE D 50 PORTB PB2 50 PORTB PB1 chi PORTB 1 DIIS SPE 1 E spi sync transmit cD Set Set Set H isable SPI MOSI high SCK high SCK low nable SPI ata Listing 2 An array like this is difficult to handle if you want to save memory because it s always located in RAM You have to use a special function if you want to read the data directly from the flash memory static 0x01 const 0x00 unsigned char 0x02 0x03 0x04 0x05 CIRCUIT CELLAR example
163. itiates direct control of the SpeakJet s internals Using the escape character along with a single decimal digit 0 7 will request Command mode Because a SpeakJet module can be assigned an address 0 7 if it matches the received command it will enter Command mode and redirect any data following it into the 16 byte command buffer The recognized commands in Table 1 are used to store data in a control register start and stop execution of the data in the 64 byte input buffer and exit Command mode Data can be stored in direct registers synthesizer registers 0 15 and nonvolatile regis ters 0 255 The SpeakJet has 256 nonvolatile control registers composed of phrase Fisni for duda pointers phrase storage and chip con trol areas Up to 16 user programmed phrases can be stored on the Speak Jet Phrases are stored consecutively in registers 16 through 236 which form the total character storage for all phrases and may limit the number of phrases you can store Registers through 15 hold pointers that indicate the beginning of each phrase up to 16 This means each phrase can be as small or as large as necessary as long as no phrase extends beyond register 236 The top 19 registers control power up reset phrase mode node and event registers you can see in Table 2 the bits in register 237 indi cate which canned phrases 045 should be played at reset The bits in register 238 define the function of sev e
164. ive To accomplish this goal we focused on a design that integrated as many func tions as possible in a minimum num ber of devices The eZ80F91 microcontroller is the heart of the system because of its high level of integration It includes the pri mary flash memory storage for the software an integrated 10 100 Ethernet MAC address and data buses for external run time memory and ample GPIO pins Although dedicated GPIB con trollers such as the industry standard Texas Instruments TMS9914A and NEC Electronics uPD7210 are easy to use they re expensive and require additional real estate on the board The eZ80F91 microcontroller is the perfect solution because it can imple ment the GPIB controller function in software The GPIO pins on the eZ80F91 microcontroller make it easy to interface to the GPIB bus signals Cutting out the dedicated GPIB con Using Cic DOS applicaton can ba in nsn on ad of our priceessor moduli Disce forc DOS ia provided m appsicatien with Inga comes ample implementation for BOCITPIOHCP FTP STP TELNET 4 TALK me for Gowniinad from our V ob sip eem 506 icor us for cusiem desigs amp OE HDA senices Linux application can run on of our processor modules Vie proie f Lan kema beed o Le p enchudes Linux Kamel 2 4 11 Silas LM FTPAALL thop WN HTTP gib
165. l com dyn resources prod documents doc2490 pdf AVR libc information www nongnu org avr libc user manual J Bachiochi Global XPortation Circuit Cellar 162 January 2004 Lantronix Xport User Guide 900 270 E 2004 www lantronix com pdf XPort UG pdf Philips Semiconductors PCF8833 STN RGB 482 x 132 x 3 Driver 9397 750 10059 2003 www semi conductors philips com acrobat_ download datasheets PCF8833_1 pdf VLSI Solution VS1002d MP3 Audio Codec v 0 71 2004 www vlsi fi datasheets vs1002 pdf NS10XX Application Notes v 0 72 2004 www vlsi fi datasheets vsl10XXan pdf SOURCES LP62S1024B SRAM AMIC Technology Corp www amictechnology com ATmega64L Microcontroller Atmel Corp www atmel com XPort Lantronix Inc www lantronix com PCF8833 Driver Philips Semiconductors www semiconductors philips com VS1002 MP3 Audio decoder IC VLSI Solution www vlsi fi www circuitcellar com Need Device Connectivity To The Pervasive Internet Based on experience can tell you that Rabbit stuff works before you can get it all out of the box 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 ne
166. lash connector U5 I used an ATmegal28L microcontroller for this project The Wi Fi base code was ported from the Easy Ethernet AVR device firmware I wrote the orig inal Easy Ethernet AVR code with ImageCraft s ICCAVR To keep things simple I stuck with the ImageCraft C compiler for this project as well The Easy Ethernet AVR firmware is also the basis for the AirDrop A 802 11b firmware which is currently in operation I pulled heavily from the AirDrop A firmware which had to be modified to accommodate the addi tional SRAM circuitry I m dying to use my new JTAGICE mkII Let s get started ON AIR The purpose of this project was to put a minimal web server on the air with my new SRAM equipped AVR based Wi Fi module The first obstacle was rethinking and rewriting all of the basic Wi Fi I O routines to support the additional SRAM and address latch I then reworked all of my I O port definitions to match the new SRAM equipped hardware Honestly that s all I figured I d really have to do because I was using the working AirDrop A firmware s port However after staring at a dead Wi Fi web server module I per formed some quick sin gle step debugging and determined that the basic CompactFlash card reads and writes from the original 802 11b code didn t work Listing 1 is a before and after compilation of the code needed to read and write the CompactFlash card s attribute registers The CompactFlash card I O
167. ler Philips Semiconductors www semiconductors philips com L297 Stepper motor controller STMicroelectronics www st com Issue 178 2005 61 FEATURE ARTICLE by Ron Battles Patrick Jackson amp Scott Shumate Network GPIB Controller The GPIB protocol enables you to connect various pieces of test equipment This team built low cost eZ80F91 based network GPIB controller for controlling equipment over Ethernet T equipment such as oscillo scopes power supplies and signal gen erators is often used in manufacturing and compliance applications that require you to control and automate its behavior Back in the 1960s Hewlett Packard recognized this requirement and invented a generic bus protocol that allows you to con 23 1 gt gt 1 1 gt 1 gt oOo gt 60 E c4 p E C1 U1 EZ80F91 7 PB O 7 0 7 Figure 1 The brains behind the network GPIB controller is an eZ80F91 microcontroller running at 50 MHz MAX6309 programmable reset device monitors the supply voltage and provides a stable reset Run time memory for the software is provided by 512 KB of SRAM 62 Issue 178 May 2005 nect and control test equipment Today the protocol is called the gener al purpose interface bus GPIB although it s also known as IEEE 488 1 GPIB is a multipoint 8 bit parallel bus that uses a
168. lity to your product FOC PRECERTIFIED amp ready customize for your application li www digikey com 1 800 DiGI KE Y From ceramic chips gain d keyless entry fo IIF 4 WIRELESS ww com 1 818 541 7622 Issue 178 2005 35 You re covered here too because the SN74LVTH573PWR needs only 0 7 ns of set up time You also have the ALE pulse width The minimum ALE pulse width of the ATmegal28L configuration with a 7 3728 MHz clock is 121 ns The SN74LVTH573PWR needs only 3 ns of the ALE pulse width The timings assume that the capaci tance on the bus lines isn t excessive So I checked the capacitance loading figures as best I could I couldn t get a handle on the Wi Fi card because the CompactFlash card datasheet didn t have any in depth electrical specifica tions However according to the SRAM datasheet the CY7C1019CV33 comes in at only 8 pF There really aren t enough devices on the address bus or data bus to throw the capacitance load ing into high gear So I felt pretty safe with the designated address latch SRAM combination The SRAM system design is flexible because you can choose to use the ATmegal28L s external SRAM control scheme or turn off the AVR automatic SRAM control subsystem You can also bit bang data into the SRAM by manu ADO PAO ADO PAO ADO PAO ADO PAO ADO PAO ADO PAO ADO PAO ADO PAO 2 7 ca rm a EE A8 PCO A8 PCO A8 PCO A8 PCO A8
169. llel ports The general trend for new PCs is the replacement of classic serial and parallel ports with Universal Serial Bus USB ports Previously I d used the classic ports for controlling equip ment and data acquisition But with their elimination I d lost my interface capability Thus was born this USB interface project A LOOK AT USB Several hardware manufacturers got together and developed the USB 2 0 specification which has a high data transfer rate of 480 Mbps USB 2 0 which is backward compatible with the previous USB 1 1 standard uses the same cables connectors and software interfaces USB 1 1 supports data rates of 1 5 Mbps low and 12 Mbps full USB enables you to plug in and unplug peripherals without having to power down your comput er This process called enu meration initiates commu nication with the peripheral and identifies the device driver that should be loaded Each peripheral is assigned a unique address during enu meration that s used for run time transfers During run time the host PC initiates transactions to specific peripherals and each periph eral accepts its transactions and responds accordingly A USB peripheral is a slave that obeys a defined protocol It must react to USB View 12 Issue 178 2005 File Help Computer Eie Intel 823714B EB PCI ta USB Bo 8 2 RootHub s Parti DeviceConnect a Port2 DeviceConnect request transaction
170. look at an explicit exam ple The serial protocol is the follow ing sync OxFF servo address 0x00 OxFE servo position Ox0O OxFF First the serial parser state machine must look for the sync token OxFF Then it must wait for the servo address and servo position Now let s assume the worst case scenario in which the commanded servo position is actually equal to the sync value OxFF Let s also assume that the parser state machine has gone out of sync and has taken the OxFF servo position value to be the sync byte of a new message In this sort of scenario the next logical character to be read will be OxFF which is the legitimate header of the next message At that point the parser state machine would expect a servo address and would read OxFF which is defined as an invalid address It would simply ignore it and wait for the next byte to OxF2 4 be the address thereby resynchroniz ing with the datastream Another change to the protocol involved devising a backwards compati ble technique to transfer board configu ration data as well as commands to and from the target board A simple solu tion involved reserving the absolute servo address range OxFO to OxFE as rep resenting the 15 bytes of a broadcast command packet A full command set was developed as shown in Table 1 The commands can take as few as 2 bytes and as many as 12 bytes of the 15 reserved bytes A checksum charac ter is always require
171. ls tend to be demanding finicky beasts that must be coaxed into cooperation In fact as I recall just about every time I want to experiment with FPGAs I have to upgrade my PC hardware and software This time around I hoped my rather muscular PC would be up to the task Not quite The Actel installation guide noted that the latest versions of the tools are only happy with Windows NT 2000 or XP Professional but my PC had Windows XP Home Normally I would have attempted installation any way but I figured an XP Home to XP Pro upgrade would be relatively pain less so why not go for it At first I thought the installation was going well The XP installer said it would take 51 minutes and proceed ed to churn away so I took a break Checking in about 15 min later I noticed the system rebooting followed by a Restarting Installer message Hmm that seemed a bit odd but so did taking 51 minutes The Microsoft doc umentation said little about what was supposed to be happening at this point so I hoped it was just a quirky installation procedure But alas Process ption Libero IDE C MctelprjYexamp File Edit rac Q ns Imp example prj mentations Wind Next time you re talking to an FPGA supplier tech support person ask them if they ve ever gotten any com plaints about licensing Chances are they ll take a well deserved opportunity to vent I ve probably installed FPGA tools a dozen times
172. ls the MSB or coarse position of the associated servo channel The bot tom sliders control the respective LSB or fine position control Several other menus enable you to set the speed start positions and other board config uration parameters All these values can be sent to the target board and saved in the on board EEPROM The settings also can be read back from the board and displayed on the GUI APPLICATIONS There are many interesting appli cations for the 32 channel RC servo DATA ACQUISITION MODEMS _ R 232 o E a GOING WIRELESS IS EASY 900 MHz WIRELESS RF MODULES Transmitters Receivers Transceivers High Speed Long Range Modems ra Ping Call Toll Free 866 345 3667 LEMOS INTERNATIONAL Photo 1 32 channel digital RC servo controller cir cuit board prototype features a Spartan IIE development board along with a hand prototyped MCU board This circuit is driving a multi axis robotic camera pan tilt unit controller For example insect and bipedal walker robots require a large number of servos to generate their INVENTORY CONTROL SNOILWDITdd TWINLSNONI Long Range Class amp 11 305 Post Road Suite 305 Fairfield CT 06430 Tel 203 254 153 Fax 203 254 7442 Ernail salesiplemosint com TELL REAL www femosint com CIRCUIT CELLAR Issue 178 2005 47 FOR MORC COP
173. mmand does the same thing but it sends a 1 before the data instead of a 0 The code in Listing 1 sends a 9 bit word to the LCD controller Figure 3 is the transcript of a typ ical communication between the Net Radio and a network radio station Wow this stuff looks complex Fortunately the Net Radio is easy to use Let s take a look at the user interface address to connect to at least an IP address made with four numbers it will become more complicated when the Internet switches to the IPv6 pro tocol er a host name The latter is harder to enter because it must con tain at least one letter so you can t use a numbers only keyboard I didn t want to add a full keyboard to the Net Radio because I wanted to keep Legend gt To the network radio station lt From the network radio station GET path of the stream HTTP 1 0 gt Host hostname or ip of the server gt User Agent NetRadio 1 0 gt Accept Connection close gt lt ICY 200 OK lt icy notice1 some text from the server lt icy notice 2 more text from the server icy name common name of the radio station lt icy genre genre of the radio station e g classical or techno lt icy url http www url of the radio com lt content type audio mpeg lt icy pub 1 or 0 whether or not the stream is public lt icy br bit rate of the radio in kilobits per second USER INTERFACE As I was working on the Net R
174. motor GEAR Motor value Set the gear ratio for the motor n5 STAT Motor Get status of the motor i CURR Motor Set the winding current for the motor MODE Motor value Set the operating mode linear rotational or half full step for the motor SYST Mode status Set the system to remote or local mode of operation or request the current mode CONF Motor parameter Set the configuration information for the motor CONF Motor parameter Get the configuration information for the motor SPED Motor value in RPM Set the motor speed in RPM STOP Motor Stop the specified motor UNIT Motor value Set the operational unit mm cm or steps for the motor POSI Motor Get the current position of the motor in the current motion unit Command Description MOVR X 100 Move X motor relative to current position by 100 steps clockwise SPED Y 100 Set Y motor speed to 100 RPM UNIT X MM Set X motor motion unit in mm CONF X SPED 150 Set X motor speed to 150 RPM and save to EEPROM CONF Y SPED Get Y motor speed value in RPM from EEPROM MODE Y HALF Set the Y motor in half step operation SYST MODE Get current operating mode for the drive IDN Report identification string for the system Table 1 We implemented a comprehensive command set for remote motor control It s based
175. ms for the way in which I imple mented the 64K x 16 SRAM IC on the ATA hard drive controller Instead of using the ATA hard drive controller ATmegal28 s built in external memory management scheme I tied the con troller s big SRAM directly to the 16 bit bus on the IDE hard drive The idea was to capture the outgoing IDE data in the fast SRAM without too much interven tion by the ATA hard drive controller s ATmegal28 microcontroller The downside to doing things my way was that I destroyed the programmer s abili ty to use the AVR s external memory management system My proprietary SRAM connec tions didn t deter many of the hardcore AVR coders They went around my one of a kind SRAM riggings and turned their ATA hard drive controllers into a mul titude of other SRAM equipped devices I m pretty sure that the BASCOM AVR guys had the ATA hard drive controller serving web pages and running an AVR ver sion of Bill Gates s FAT 16 I didn t use the 128 x 8 SRAM device my way on the new AVR based 802 11b wireless module Instead I wired the big SRAM as two 64 KB banks of external www circuitcellar com SRAM The SRAM s A16 address line which is connected to I O pin PD6 on the ATmegal28L controls SRAM bank selection Because the ATmegal28L contains an internal 4 KB block of SRAM normal addressing methods will allow only 60 KB of the 64 KB bank of SRAM to be accessed If you take a close look at the ATmegal28L
176. n Bus Monitors Protocols to your Device Fast a Protocol A Analyzers aM A Hoz m 9 Host Ww SM y gt Adapters E Mulliplexers 4 Applications j Sotware P jp p Ensure connectivity using interchangeable low cost OEM Modules with a common PCB fogt print and software interface Development kit with C source code available Micro Computer Control M fof ramii V Media Stream VP cus Technologies Inc Technology Inc eee lC m m irasereark kp C raperraiam Kwelectronics s com Radio Modules AM amp FM Off the shelf solutions Low cost AM amp FM transmitters and receivers High performance FM modules a Narra hand FH modules a Transceivers and Antennas 315MHz 418MHz amp 433 97MH Range to 1900 feet More qu ue com BEN LEG NI e Ego T m m E st rd INC Tel 530 758 0180 Fax 530 758 0181 www lern com e soles tern com rene www circuitcellar com CIRCUIT CELLAR Issue 178 May 2005 89 Tiny yet Linux capable BUB tae MEU 1 4 MB fleah SD card 106 EfPemat 3 porte 45232 CAN part LCIXKPD pert Ecipsa CDT des any canal debugger ind 10 Off amp Free Shipping Takes the reader thro
177. n tioned in previous columns most recently Hot Enough For You 174 January 2005 it s becom ing increasingly clear that ever finer geometry SRAM cells are susceptible to corruption from the cosmos This is a blue sky problem that isn t blue sky The concern already has risen to a level that affects airborne and space based applications And the future for SRAM in this regard a future where designers might have to worry about the altitude difference between Dallas gt DYNON INSTRUMENTS A Complete Electronics Lab for 495 Includes 5 Instruments 2 Channel 80 MHz Digital Storage Oscilloscope 16 Channel Logic Analyzer Synchronous with DSO Arbitrary Waveform Generator 2 Programmable Power Supplies an aA een D EE rU Tri x Fi iii a x d WWw circuitcellar com acum 2 Programmable Clocks Plus Powerful PC User Interface Program Probes www dynoninstruments com Moodnvile 9807 2 425 402 0499 CIRCUIT CELLAR Issue 178 2005 81 BUE AOI POMPA ATMEL AVR Based Controller Micro64 wwWww micromint com Small size 15 2 1 x 0 52 Dual powered operates on 5V or 6 5 20V at 55 mA typical e Program and Data Memories 64k or 128k Bytes of In System Reprogrammable Flash with 10 000 Write Erase Cycles E 2or4KBytes EEPROM with 100 000 Write Erase Cycles B 36K Bytes SRAM Programming lock for Soft
178. n iewDra File Edit view Insert Format Tools Window hx x Root andgate Pre Synthesis t Synthesis 4 an infinite restart reboot loop Help It wasn t long after that I was on the phone at least on hold to Microsoft When I finally got to a person they were actual ly helpful and I was able to solve the problem With XP Pro up and run ning I turned my atten tion to the software that came with the Actel kit gram and repeat CIRCUIT CELLAR Post Layout dgate vhd andgate vhd 02 LIBRARY ieee USE ieee std logic 1164 ALL Q5 ENTITY andgate is 06 port B in std logic data inputs 7 OUTPUT out std logic output a AND 08 end andgate 10 architecture behaviour of andgate is egin 12 OUTPUT lt A AND B 13 end behaviour 13 Col1 FAM DIE 208 PQFP 2 Photo 2 The Libero IDE opens with a roadmap showing you the route to your own chip enter the design synthesize and simulate it download pro www circuitcellar com 2002 Revenue 2 3 billion Mil Aero 696 Auto 096 Comsumer 6 Communications Industrial 58 14 Data processing 16 Figure 3 So called value proposition FPGAs i e low price and system cost will play a big role in boosting FPGA sales especially in consumer and industrial applications the
179. nal compatible BIOS DOS ATC amp memory map TS Linux 3 0 is open source GNU Linux Glibe 2 2 5 Power 5y amp 830mA 43 x55 s MB flash 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 ports jumper configurable TS DIO24 39 24 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 supports 1805 3 15 compliant standard AT commands caller ID 56K baud optional EMIT DiskOnChip Power 5y 500 mA LE el ii Fe n i 37 Digital I O 2 Serial Pons 35 MHz Intel 3BGEX with 8 MB RAM 76 ME 005 TS Linux pre installed a PC compatible BIOS DOS VOS memory mapi D with onli Technologic SYSTEMS PC 104 Computer Boards Enclosures 4 Peripherals Custom Designs g Exceptional Support TS Linux v3 0
180. nc com Your source for Design amp Mfg Services v Schematic Capture PCB Design Y Embedded Microcontroller Design Hardware Firmware Design Y Rapid Prototypes Fab and Assembly Y RT OS e C ASM s Basic Y PowerPCB e OrCAD Allegro Reliable Fast Work Free Quotes Guarantee VNISOURCE DESIGN www vnisource com Tel 469 675 0267 Fax 469 675 0346 www circuitcellar com PC KEYBOARD EMULATION Interface Keypads Switches or R 232 to your PG Keyboard Input MODEL KE24 ONLY a5 12 12 matrix Programmatie AS 232 Part Macro Capability The KE24 is the ultimate in flexibility Inputs or serial data can emulate any of the 101 keys from a standard keyboard prag 9 matrix 25 x 3 The KE18 combinas a ONLY 2 4195 Ur Size PC Keyboard Port POAT AT Compatible a multitude of features with small size al an economical price Custom units available Toll Free 888 690 9080 Phone 607 533 4441 Fax 607 533 4444 vean hagstrametiecirenics com HAGSTROM ELECTRONICS 11 Fiddlers Green Lansing 14882 PLCs for 5 Program like a PLC Ladder BASIC Low Cost amp Flexible like a Micro n Ethernet XServer Web HMI a Wos 24W Digital iios 5 LCD Port PMs RTC Stepper Interrupts Hi Speed Counter Modem Internet New Option Ethemet Wi Fi wi Free Web HMI Get Froo Ladder Logic Simulator AN www tri plc com cci
181. ne June 30 2005 Ji PLATFORM See the web site for complete details RENESAS CIRCUIT CELLAR the Circuit Cellar ftp site The program uses minimal inter rupts The interrupt routine handles only USB reset interrupts activity wake up and token done interrupts Most of the processing is done on an approximately 10 9 ms timer routine in the main program The main pro gram begins by flashing the five LEDs on the board This is just to give feedback that the microprocessor is running Next the main program calls the UART Init routine to initialize the serial port to 38 400 bps for debugging output This may be confusing so let me explain I was using 20 MHz crystal as the clock for the micro processor and I supplied a value to the UART nit routine that sets a data rate of 38 400 for a 24 MHz crystal This is because a constraint for using the USB at full speed requires the CPU clock to run at 24 MHz The configuration bits in CONFIGIL are used to convert the 20 MHz provided by the crystal to 24 MHz for the CPU After ni t USB is called to initialize the USB port the TOCON register is Announcing the Next P at able Display ac LI T eris USB Parallel Interface Listing 1 7 device descriptor is the first USB descriptor sent to the host The device descriptor begins to define the USB device to the host const char 0x01 0x10 0x00 0x00 0x00 0x08 0xD8 0x04 0x09 0x00
182. ng innovative turn key solutions to the OEM market for 24 years from design through production as well as packaging and Visit our website www micromint com to see our complete line of OEM Solutions he final product Our broad line of embedded controllers and tum key solutions can turn your Micromint 115 Timberlachen Cirde Lake Mary FL 32746 800 635 3355 407 262 0066 Fax 407 262 0069 A3P030 A3P060 A3P125 A3P250 A3P400 A3P600 A3P1000 A3PE600 A3PE1500 A3PE3000 System gates 30 000 60 000 125 000 250 000 400 000 600 000 1 million 600 000 1 5 million 3 million VersaTiles D flip flops 1 536 3 072 6 144 9 216 13 824 24 576 13 824 38 400 75 264 RAM 18 Kb 36 Kb 36 Kb 54 Kb 108 Kb 144 Kb 108 Kb 270 Kb 504 Kb 4 608 Bit blocks 4 8 8 12 24 32 24 60 112 FROM bits 1 Kb 1 Kb 1 Kb 1 Kb 1 Kb 1 Kb 1 Kb 1 Kb 1 Kb Secure AES ISP Yes Yes Yes Integrated PLL in CCCs 1 6 VersaNet Globals 18 18 18 I O Banks 2 4 8 Maximum user I O 96 227 616 Package pins QFN VQFP TQFP PQFP FBGA VQ100T Q144 FG144 PQ208 FG144 FG256 26484 PQ208 FG144 FG256 26484 PQ208 FG144 FG256 26484 Table 2 The new Actel ProASICS SE lineup brings the benefits of flas
183. njunction with some kind of self powered project To avoid USB power management issues I made the USBLab self powered as well Power is applied to the USBLab via a coaxial jack J1 and regulated by a 7805 regulator U3 A 9 VDC 500 mA wall wart transformer supplies power LED D2 indicates when power is applied Input output connector J3 connects to your external project You can read and write up to eight external registers by decoding the three address lines AO through A2 Signal PEO is an extra output signal Separate commands allow you to set and clear PEO without affecting the state of DO through D7 and AO through A2 Connector J2 is an eight pin header that allows the ATmega8515 micro controller to be programmed in circuit This is an in line header that matches my programmer You could also use the standard Atmel 10 pin ISP header CIRCUIT CONSTRUCTION I used the PLCC version of the ATmega8515 so the part could be placed in a standard through hole PLCC socket The DLP USB245 was placed in a standard 24 pin machined pin IC sock et I don t recommend a leaf type socket because the DLP 245BM has round pins You can of course wire to the DLP 245BM without using a socket at all The expansion connector J3 is a 20 pin 10 x 2 header the type of header into which you d plug a ribbon cable Jack J1 is wired with the center termi nal as the positive connection You www circuitcellar com Figure 2 The Idle win
184. nner an LM317 can generate from 1 25 to 35 V provided its input voltage is high enough I used it to generate 7 5 V I used a resistor to limit the current you can see in Figure 2 I used a switch also modify the XPort s firmware if necessary I used Programmers Notepad for a development editor You may download the code from the Circuit Cellar ftp site The source code consists of approxi mately 20 files and roughly 400 000 characters including the fonts etc There are numerous filesan fact there is one per hardware function MP3 decoder LCD etc AVR GCC can compile the files using the make file Programmers Notepad can open the project with the netradio pnproj proj Photo 2a When the Net Radio boots it checks the integrity of 15 exter nal SRAM to be sure that the buffering will be done correctly b If there s a problem with the external SRAM the failing addresses are displayed along with what s actually been read and what should have been read increase the data rate until the buffer returns to 50 full At that point the VS1002 will return to a nominal data rate If the buffer becomes a little too empty it will slow the data rate until the buffer is 5096 full again The 51002 decoder was perfect for my Net Radio project although it has some features that I didn t use It can encode data in ADPCM and read VLSI s MP3 V format which is a modified MP3 format with higher quality for
185. o exist that untalk or anlisten all devices on the bus Any number of command bytes can be sent while ATN is low All devices on the bus Talk Listen Ab A4 A3 A2 Table 1 A simple byte command byte format can address a device in a sin gle byte Address 31 is reserved for the and unlisten commands devices into a listen state After that you can send commands to anlis ten and untalk the devices so that the bus is in a known state The con troller then addresses itself as a talker by sending its talk address followed by the listener address Handshaking transmission data is the same for command and data bytes First the driver makes sure that NRFD isn t asserted indicating that all of the addressees are ready for data The driver then places the data on the bus and asserts DAV When all of the devices have accepted the data NDAC will go high and the driver can de assert DAV This cycle is repeated for each byte sent There are three different ways to terminate the transmission assert EOI on the last byte send a line feed OxOA or do both see Photo 1 In order to receive data the driver must first address another device as a talker Again the driver begins by asserting ATN and it then untalks and unlistens all devices on the bus The driver then addresses itself as the listener and addresses the new talker Following this the driver can de assert and begin to receive data
186. odel transition by transition and see how it reacts to events Project man agement prototyping and product integration are a cinch Prajakta Deshpande holds a B S from Sagar U niversity India and an M C A from Barkatullah Vishwa Vidyalaya Bhopal India Sheis a lecturer in computer science Prajakta can be reached at ppd nettaxi com CIRCUIT CELLAR Praveen Deshpande holds a bachelor s degree in electronics engineering from the Regional Engineering College REC Nagpur India He 15 currently working as a senior scientific officer in the field of distributed data acqui sition and control His interests include real time operating systems and distributed control You may con tact him at ppd cat ernet in PROJECT FILES To download the code go to ftp circuit cellar com pub Circuit_Cellar 2005 178 RESOURCES Systems visualSTATE Concept Guide ver 4 1999 Intel Corp MCS 51 Microcontroller Family User s Manual 272383 002 1994 Keil CX51 compiler information www keil com support man docs c51 f SCPI Information SCPI Consortium www scpiconsortium org Philips Semiconductors Comprehensive Product Catalog 9397 750 11146 vol 5 April 2003 SOURCES AT89C2051 Microcontroller Atmel Corp www atmel com VisualSTATE IAR System www lar com CX51 Compiler Keil Software www keil com Lab VIEW National Instruments WWW ni com P89C51RD2 Microcontrol
187. on P89C51RD2 PCA module 0 ISR handler Clear PCA overflow flag We need to toggle CLK pin ourselves Read current counter value and advance it by time Required by current speed Reload newly computed 16 bit value tain the current Terminal count reached Trigger STOP event Stop X motor Main position 0 1 71 for square wave generation with interrupt for square wave to begin with DEF X SPEED Osc 6 enable interrupt Run the counter Enable PCA interrupt Enable the global interrupt flag Enable module 0 interrupt flag Switch on winding current Enable software timer interrupt Disable module 0 interrupt flag Switch off winding current Disable interrupt and stop clock www circuitcellar com the current posi tion while moving EASY INTEGRA TION Try implementing a stepper motor driver the way we did Using a motor state machine should help you design state machines for your future applications Start Be LabVIEW E Step3x vi Front Panel File Edit Operate Tools Browse Window Help Say 2 S If you have the PISA money consider IAR System s VisualSTATE which will auto matically generate code based on the state machine This UML based tool enables you to develop state machines in the user friendly man ner It could also generate ANSI C J start gt LabVIEW Photo 1 We created the application so lab technicians could remotel
188. on SCPI com mands A few commands have subcommands with a colon character acting as a separator using an RTOS you ll sometimes have to pay a per unit royalty fee Coding a well defined state machine however is relatively simple The stepper motor driver doesn t demand critical timing Moreover the pro grammable counter array PCA chan nels that we used to time the motors took care of the required timing in the background ISR We assigned one PCA channel to each motor control Because PCA hardware can do its job without CPU intervention our motors ran in the background while the CPU was serv ing the RS 232 keypad EEPROM and other entities You can easily convert a linear C program into well behaved state machine code STATE MACHINE A state machine has a finite set of 54 1 178 2005 states and a collection of transitions The states represent the distinct stages of computation and the transi tions represent the way in which the computation process moves from one stage to another In terms of developing embedded software state machines are primarily used to capture the flow of the com putation Data manipulation such as arithmetic and data structure is handled separately You need to model your embedded application as a sequence of transitions between states In each state events inputs will change the state and possibly generate an action output The state machine code is thus a purel
189. one or more data bytes bytes One byte is expected for SendSerial and WriteParallel Two bytes are expected for SetBaudRate The firmware checks the opcodes for validity see Table 1 If an invalid opcode is encountered a value of 7F is returned to the host The USBLab won t hang in that case but if the invalid opcode is caused by a synchronization prob lem when sending data to the USBLab you may get some strange results The WriteParallel opcode can range from 0x10 to Ox17 ReadParallel opcode can range from 0x20 to 0x27 The lower 3 bits specify which address on the expansion connector are to be written and read The SetBaud opcode is fol lowed by the high byte of the data rate and then the low byte of the data rate These values are written directly to the ATmega8515 s data rate registers The Get Board D command will cause the USBLab to return the text USBLab and the board s revision The string all ASCII characters is terminated with a zero byte Generally you shouldn t issue the board ID command while the USBLab is receiving serial data because serial data may be inserted ahead of the board ID string The board ID is intended to identify the USBLab if you have multiple COM devices connected Note that the board ID string won t be interrupted with serial or parallel data Therefore if your code looks for the text USBLab in the returned USB data and then reads until it finds a zero you can issue and handle the
190. ops continuously and monitors the serial port for incoming data and the DLP USB245 for incoming USB data The ATmega8515 micro controller s data bus is configured to access external memory Because the DLP USB245 has no address inputs the ATmega8515 microcontroller s upper eight address outputs are configured to function as general purpose I O lines If incoming data is found on the serial port the firmware will write the SendSerial opcode to the DLP 245 then write the received serial byte If the DLP USB245 indicates that USB data has been received the firmware will read the data and process it The firmware always expects an opcode to be first If the opcode is SendSerial WriteParallel or SetBaudRate the firmware expects additional data Issue 178 May 2005 77 Opcode value Meaning transmit ready signal to acti 0x00 NOP vate The firmware object code 0x10 WriteParallel bits 0 2 are address to write is contained in the USBLab hex 0x20 ReadParallel bits 0 2 are address to read file It s an Intel hex format file 0x30 SendSerial 0x40 SetBaud SYSTEM AT WORK 0x44 SetPEO The commport py code pro 0x48 CIrPEO vides simple communication 0x4C TransmitNow functions that can be used 0x4D GetBoardID with the USBLab It s impor Ox4E ReturnAck Table 1 The USBLab interprets the opcodes to perform specified actions Some opcodes are followed by
191. ou can add an easy USB connection to your next design 4 Stuart Ball is an engineer at Seagate Technologies with more than 20 years of experience in embedded systems He has a B S E E from the U niversity of Missouri Columbia and an M B A from Regis University in Denver Stuart has authored three books about embedded systems You may contact him at stuart stuartball com To download the code go to ftp circuit cellar com pub Circuit_Cellar 2005 178 ATmega8515 Microcontroller Atmel Corp www atmel com DLP USB245 USB Adapter DLP Design www dlpdesign com FT245BM USB FIFO IC Future Technology Devices International www itdichip com Win32 Extensions Mark Hammond http starship python net crew mham mond win32 Downloads html Python scripting language Python Software Foundation www python org EMAC Inc has been Designing amp Integrating Single Board Computers since 1985 We offer a comprehensive line of products and services for the Embedded Systems market Phone 618 529 4525 World Wide Web www circuitcellar com Fax 618 2290 Way Carbondale Illinois 62902 http vwwvw emacinc com uU SERVICING No Sire Limit No Pin Limit a EAC Analysis 457 0110 CIRCUIT CELLAR Prototypes af e feectiow of the Industry quedity Tooling amd ratus inclyded Follow ap ron Ary CAM CAD commuting a Frd J
192. over the years and licensing invariably seems to be a hassle No exception this time To be fair the main problem I encountered was because the kit was shipped to me outside normal channels As a result some of the licensing information fell into a crack along the way No matter what I tried I could only get the equivalent of a Libero Silver installa tion working although the kit pur portedly included Gold Thanks to good support from Actel I got past the problem aproblem that shouldn t be an issue for normal purchases Not that there weren t a few head scratchers and potential pitfalls for the unwary The documentation is insis tent that you go to the Actel web site and register for a software license sigh during not before or after installation Then you wait the docu mentation says up to 2 h but it was only 10 min to receive an e mail with the license information install the license and finish the installation Sure enough halfway through the installation I was sent over to Actel s web site to register which I did I got the license dinked with various settings e g environment variables to point to the license file and went back to finish a x SEG wave default ER while monitoring the situation it soon became pretty clear that the installer was stuck in Design Entry Tools BSSOSH BED MAY wa T Current implementation l fta 3 19 88 E m 53 HDL Editor ACTge
193. p is powered down there s no need to reload the program from the PC at each power up PIC18F2455 DETAILS The PIC18F2455 is one of Programming connector Test points Power indicator V Microchip s new USB enabled flash memory microprocessors The 24 KB of flash program memory allows you to store about 12 000 16 bit instructions that can be erased and reprogrammed electrically The flash program memo ry supports 100 000 write erase cycles and has a retention period longer than 40 years The microprocessor has 2048 bytes of RAM The 18 2455 has many of the features you ve come to expect from Microchip serial communication module UART four timers 10 10 bit A D channels and a master synchro nous serial port MSSP which is use ful for communicating with peripheral devices such as serial EEPROMs and supporting SPI and PC protocols The microprocessor has 75 base instruc tions It offers seven different operat ing modes for managing power con sumption The lowest power mode Sleep mode draws approximately 1 uA The USB engine is V 2 0 compliant and operates at low 1 5 Mbps and full 12 Mbps speeds It supports control interrupt isochronous and bulk trans fers and up to 32 endpoints It has 1 KB of RAM starting at 400h that s shared between the CPU and the USB engine You can configure the shared memo ry for optimal use The first few loca tions are used for endpoint buffer descriptors B
194. pable of running at approximately 4 kHz using an 8 kHz sampling rate The oscillator banks are broken into three groups Oscillators 1 2 and 3 are used as voiced sound sources zz Oscillators 4 and 5 can be distorted by white noise and are useful as voiceless sound sources ff The groups can be mixed individually as well as collectively In addition an envelope generator can apply a saw sine triangle or square wave to modulate the vol ume of each group independently PHRASE A LATOR The SpeakJet requires a string of allophones to speak text directly Magnevation offers an application writ ten for the PC to help prepare your allo phone strings The Phrase A Lator is a Fighting against your PCB Design Software Here s something that will spare your time and your budget Boards designed under EAGLE are found in patient monitoring equipment chip cards electric razors hearing aids automobiles and industrial controllers They are as small as a thumbnail as large as a motherboard They are developed in one man businesses or in large industrial companies EAGLE ie being used in many of the top companies The crucial reason for selecting 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 of charge and is available without restriction to every customer These are the real cost killers Ver
195. petitions submit articles and stuff like that but start with a means rather than an end What do most people here do about their brainstorming sessions Do they start with a means or an end Any thoughts LucidGuppy When read this interpreted it as asking whether think about the chicken or the egg first when build a project In truth I m guilty of all of the above If I m on a quest l Il either use the fact that already have everything to a task the means or use my interest in solving a problem the end as justification to collect everything to do the task Half of the products you saw come out of my early articles the Home Control System HCS for example came about because they sounded like fun to design and wanted one for my own use It didn t hurt that had smart guys around here to fill in some of the blanks like software was able to produce these devices in months rather than years because we had a very large and eclectic inventory to satisfy my interests always been bit of a pack rat Having a large house and lots of garage space doesn t help people with this habit Don t get me wrong I m not a junker l m not knee deep in useless piles of electronic parts in place of the bed in the guest room The tablecloth covering my end table isn t hiding a pile of old 8 disk drives and equipment boxes For the most part everything is on shelves and cabinets either out behind the Circuit Cellar and yes newbi
196. produce the sound of each allophone are stored in the database The SpeakjJet isn t a text to speech converter You must provide it with a series of allo phones or it must be stored on board in nonvolatile memo ry Instructions for the allophones are pulled from the database This allows the MSA to calculate the sound com ponents of each allophone and any transitional sounds linking the allo phones together see Figure 1 In addition to providing an unlimit ed vocabulary the MSA can be tweaked to give speech more emotion than Ben Stein Sprinkling control commands anywhere along the allo phone string will modify the rate pitch bend and volume of each allo phone One of the potential phases of a text to speech converter is to look at punctuation and add modifiers to add emphasis where required The SpeakJet reproduces allophones using an array of oscillators so you can produce practically any sound see Figure 2 In fact in addition to the allophones stored in the database a number of useful sounds are also pre programmed such as DTMF telco tones and an array of beeps boops and chirps SERIAL CONTROL PROTOCOL Although you can use the SpeakJet as a stand alone system you must be able to program canned requirements into its nonvolatile user memory The pinout in Figure 3 includes an RCX pin It s a TTL serial input using an 8N1 format from 2 4 to 19 2 kbps serial SCP characters are ASCII p
197. provides enough room to accommo www circuitcellar com date complex firmware code without expanding the chip further and pre serving the precious and powerful I O port pins for motor control This is probably the reason why we could accommodate a third motor axis into our initial conceptual design for two motor axes CONFIGURABLE FIRMWARE Different applications require differ ent parameters After we determined all the possible parameters associated with motor control we assembled it into a data structure see Listing 1 p 52 Choosing the right algorithms is of key importance when you re working with an embedded system characterized by a limited user inter face physical size constraints and strict limits on resources memory power consumption etc We declared a data type MOTOR and a single dimension array variable Motor to statically allocate memory space for three motors Although the Keil 8051 C compiler supports dynamic memory allocation you shouldn t use it for embedded sys tem programming Using an array of structures has another advantage You can easily extend it by increasing the array size if you need four or more stepper motor axes in your application We used the bdat a modifier to declare the Mot or array variable in the bit addressable space in the on chip 8051 data memory The variable stores the current state of each motor control bit e g clock pin motor direct
198. r true mixed mode and interactive simulation 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 PIC12 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 Rd SYSTEMS www rdsystems com Crownhill IAR Keil and others NCE Tel 905 898 0665 info r4systems com Remember when electronics stores were stocked to the rafters with every component imaginable and there was ALVVAYS a knowledgeable person there to help you Think those days are gone ELECTRONICS 15 UL ric S Well they re not Great Products Awesome Prices 1 800 831 4242 You just nee
199. r reads incoming USB data from the DLP USB245 The interface uses a simple command opcode followed in some cases by data The opcode tells the ATmega8515 whether to write the data to the parallel port serial port or data rate registers In some cases the opcode isn t followed by data For example the command to read the www circuitcellar com parallel port doesn t send data gt gt it expects data to be returned The ATmega8515 operates Board ID USBLab v1 0 Walking one return code 4E time 0 0320000648499 Write addr 0 7 return code 4E time 0 0309998989105 the USBLab enumerates as in your system it will typically be port 3 or 4 It was 7 on Read addr 0 7 return code 20 23 21 23 22 23 23 23 24 23 25 23 26 23 27 23 4E time from an 11 059 MHz crystal which provides standard data rates However by program 0 109000205994 PEO return code 4E time 0 140000104904 Serial return data 30 41 30 42 30 43 30 44 30 45 30 46 30 47 30 48 Set baud Return Data 4E Invalid opcode return value 7F ming the data rate divisor gt gt you can get nonstandard rates If you have a specific project for which you want a specific data rate build the project with a crystal that s a multiple of that rate The ATmega8515 will operate with a crystal up to 12 MHz The circuit is powered by an exter nal supply A USB device may be pow ered by the USB bus but current is limited and in most cases the USBLab will be used in co
200. r in charge CIC It s the function of the controller to send commands and specify who may talk on the bus Because our controller acts in place of a PC and runs the client application it acts as the CIC for the bus The handshaking signals pertinent to our design include Interface Clear Attention Service Request SRQ Not Ready for Data NRFD Data Available DAV Not Data Accepted NDAC and End or Identify EOI The controller takes control of the bus by pulling the IFC signal low for at least 100 us upon initialization To keep the bus quies cent during periods of inactivity we keep asserted which forces all of the other devices off the bus A device can assert SRQ if it needs service Addresses in GPIB commands are 5 bits along One bit is unused The other 2 bits specify whether the address is a talk address or a listen address The range is from one to 31 see Table 1 But because primary address PAD 31 is reserved it leaves a total of 31 addresses for use on the bus zero through 30 By convention PAD 0 is reserved for the controller but this isn t mandatory There are two types of data on the GPIB bus commands and data Asserting ATN when you place the command data on the bus identifies the former The CIC is the only device allowed to send commands and assert ATN Commands are indi vidual bytes used to specify which devices should listen and which should talk Command bytes als
201. ral digital input and output bits as well as Auto Silence which turns down the volume after reaching an empty buffer Register 239 defines the SpeakJet s node address 0 7 and can define the polarity of the three output bits The last 16 registers define the use of the eight event inputs two reg 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 www FaabMedia com www FaabMedia com CIRCUIT CELLAR www circuitcellar com isters for each event input The even 16 canned phrases Keep in mind numbered registers act on rising tran that the phrases may contain any of the sitions The odd numbered registers MSA commands and so extremely act on the falling transitions of each powerful nested routines may exist up EE Keil Professional Embedded Development event input These registers define to three deep i Solutions provide the tools you need for which phrase will be spoken They your 8051 251 Cl x and ARM projects also determine whether or not the 5 CHANNEL SYNTHESIZER Tools from Keil help you efficiently create buffer is cleared before speaking the It s hard to imagine that all of the test amp complete your embedded projects phrase blows a
202. re devices such as temperature probes The unit features three low power GPOs and three high power advanced featuring PWM frequency control and a tach sensor Edited by John Gorsky The PK202 24 USB operates at 0 to 50 C with a supply current of less than 50 mA Because of its low power con sumption and high efficiency this unit is an excellent choice for LCD or VFD replacement applications The display costs 59 in 1 000 piece quantities Matrix Orbital www matrixorbital com MASTER DEVELOPMENT SYSTEM The MDEV LICAL MS Master Development System contains all of the tools necessary to fully explore the capa bilities of Linx s new MS Series encoders and decoders The MS Series is ideal for remote control and command security keyless entry and status monitoring applications These devices allow the status of up to eight buttons or contacts to be securely transferred via an RF or infrared link The MS Series devices have several unique features including the ability to define user groups and relationships and latched or momentary outputs They can also assign secure addresses without DIP switches In addition the decoder can identify the originating transmitter Housed in tiny 20 pin SSOP packages MS Series parts feature low supply voltage and current consumption The Master Development System features preassembled evaluation boards complete with Linx RF modules which allow the encoder and decoder to be quickly tested
203. redients do really start examining the exact design solution The downside to this method is that when have a dozen different ideas running in parallel or don t use all of the hardware l ve collected for each project the means start piling up big time lve gotten better in recent years after all how much junk can you really collect but still have a lot of stuff and too many projects like to build Old timers who have been following Circuit Cellar since BYTE probably remember the famous tag line associated with my column Someone once asked me what programming language liked best It s no secret that I m a hardware guy so answered My favorite program ming language is solder It stuck and lots of people still laugh when they hear it Well there s another tag line for Steve Ciarcia if you know me personally or have ever been to my house Someplace have everything steve ciarcia circuitcellar com See 96 Issue 178 2005 CIRCUIT CELLAR www circuitcellar com MAZ 18 Channel Porcable Logic Analyzer 1 x bige __ miris Sipp en A E Auto Hardware Com ression Ca tures from 128K to 30 Billion Samples amp 10ns resolution only 3499 00 UP TOO MAES OF 10057 cage aru Fallen 1 Hea Me Naraware Lom press r Job POWErES TOT S Analysis SSOTLWATE
204. rint able enabling communication via a ter minal program such as HyperTerminal Issue 178 2005 71 Function Description Store memory 0 direct register type 32 nonvolatile control registers 0 15 for direct registers 00 255 for control regis ters Store memory address Decimal data to store Clears both buffers Halts extracting additional buffer data Continues extracting data from buffer Store memory Clear buffer Stop enunci ating Start enunci ating Acknowledge Say power up phrase Hard reset Resets SpeakJet Exit Exits Command mode Table 1 You can use these commands in Command mode to communicate directly with SpeakJet s con trol registers The data directed to the MSA s 64 byte input buffer is a 3 byte string composed of an escape character followed by two hexadecimal characters This directs the MSA to select one of the 256 preprogrammed sound segments About half of the MSA s 256 prepro grammed sound segments 127 254 EN SHAH AUR ESI S ngrayTM 8 acp jury volimg S00kHz scope 72 Issue 178 2005 are reserved for allophone and sound codes Of the remaining codes 95 are reserved for the future while the first 32 0 31 have significant meaning You can use these codes to execute pauses add emphasis to sounds or control output bits The serial control protocol SCP in
205. round with the ZPAK debugger con nected Immediately behind the board is the GPIB driver circuit with a GPIB cable wired to it The other end of the GPIB cable is connected to the back of the TDS 210 oscilloscope on the right The monitor in the back shows the Java client application running on a Windows PC So far the network GPIB controller has been tested against only the TDS 210 a National Instruments PCI GPIB adapter and an older ISA adapter with a TMS9914A GPIB con troller on it However it performed Listing 1 XML RPC requests are defined by a standardized XML schema that contains a series of nested tags defining what procedure call to execute and its parameters The example request demonstrates the gpi b Send 2 SCALE 1 call lt yml versions 1 0 gt lt methodCal gt met hodName gpi b Send lt met hodName gt lt params gt lt param gt lt val ue gt lt i nt gt 2 lt i nt gt lt value gt lt value gt lt string gt CHl SCALE lt string gt lt value gt lt Val ue gt lt int gt 1 lt int gt lt value gt lt param lt params gt methodCal gt Listing 2 The XML RPC example response is also XML It uses a schema similar to that used by the requests The response either returns a single return value or a standardized fault response The example response returns three values bst az0 i 0 andi bcntl 0 lt xml version 1 0 gt lt metho
206. s Motor current position 1 High 2 Medi um 1 coarse 2 fine Number of steps to move mo de Number of steps to move in fine movement 1 half step 2 full step 1 steps 2 linear 3 angular Either in millimeters or angle or steps per milli meter 121000 1 check 0 Ignore Search Home 1 Home at 2 home at Li mSw2 3 Low in coarse movement char FineSteps mo de char StepMode char MoveMode long MaxTravel Length float ScrewPitch intGearRatio char CheckLi mit char HomeSw steps limit switches Li P mot motbytes sizeof struct _motor Declare three variables for X Y and Z liml reached lim reached check limit switch 1 check limit switch 2 full step 0 unsigned char loc int i LOC_MOTORDATA motor 1 MOTORDATA_ SIZE 120 i lt sizeof MOTOR i MotorData motor 1 motbytes i for E2PReadByte loc i union float f unsigned char juFloatBytes typedef b sizeof float 52 Issue 178 2005 CIRCUIT CELLAR www circuitcellar com for controlling programmable meas urement and test devices in instru mentation systems We derived most of the commands from the SCPI Consortium s guidelines Adhering to the standard helped us use the instru mentation effectively It also enables us to reuse the SCPI programs already written for similar instrument
207. s Most standard instruments such as oscillo scopes and multimeters use the SCPI for their remote interfaces The P89C51RD2 microcontroller has an on chip UART for serial com Listing 2 A simple code fragment generates master slave interaction between the host and keypad display slave controller This is a typical command code although more commands are actually implemented include Reg5l h munication Interrupt driven code receives the remote commands in the background while the driver works the motors A circular buffer imple mentation accumulates the command characters The character parser func tion examines each received character transmits an echo announces the detection of query commands handles backspace character for line editing and finally assembles a command string Note that the command parser code separates the command and argu ments after it s validated This is accomplished with a string look up bit fRecvErr1 Recv error on slave extern unsigned char getc voi d extern void putc unsigned char ch define SLAVE STATUS 0 define GET KBSTATUS 1 define GET KEY 2 define CLRLCD 3 define DSPCHR 4 define GOTOXY 5 define DSPSTR 6 unsigned char KB Status Ke unsigned char Slave Status char InOutBuf 20 _ lt _ putc cmd c getc Switch cmd case GET KEY KeyCode break case GOTOXY InOutBuf
208. s sent from the host PC The peripheral responds to control transactions that for example request detailed information about the device and its configuration The peripheral sends and receives data to and from the host using a standard USB data format You can use Microsoft s free USBView utility to display the USB connection tree and show the USB devices connected to it together with their configuration data You ll find this extremely useful for debugging USB enumeration errors USBView runs on Windows 98 ME 2000 and XP USB ports transfer data through end points which are analogous to buffers Photo 1 shows the USBView pro gram s output with my hardware and test software connected USBView tells you that the device has one con figuration and a maximum packet size of 8 bytes It operates at low speed with one open pipe There s an inter rupt type of endpoint that transmits Device Descriptor bDeviceclazs bDeviceSubClass 1 bNumConfigurationsz 01 ConnectionStatus DeviceConnected 01 Open Pipes Endpoint Descriptor 0x81 Interrupt 0003 bInterval E k 4 evices Connected 2 Hubs Connected 0 Photo 1 The output of the USBView program running on Windows 98 shows infor mation about the USB interface CIRCUIT CELLAR 3 bytes of data every 10 ms CHOOSE A PROCESSOR I considered several different microprocessors for this project see Table
209. s to 54 kbps with a Low component count single layout Utilizing Silicon Laboratories integrated silicon DAA Globally compliant technology tha 15 offers programmable isolation interface to Low power consumption meet global telephone line requirements Tha I amp Omoadem is an ideal solution Applications for embedded modem applications where a simple host internace small footprint low power consumption and global compliance are required Set top boxes Digital video recorders 75 5 less board space with integrated DSP data pump controller K Poinkofssle terminals codec and 2 4 wire hybrid eliminating the for relays onto isalators and isolation transtarme SS Industrial medical Quick and easy to use due to serial UART AT commands monitoring devices and an integrated global Highest level of integration Security systems Internet access devices Fully programmable to meet g obal standards with a singe design For more information visit www silabs com ISOmodem WIRELINE WIRELESS OPTICAL MICROCONTROLLERS SILIEBN LABORATORIES www silabs com E2004 SScon Laboratedes Meon Laboratories and the Micon Lebaonatora s logo ane teasdemorks of Silicon Loborowias y under the LCD glass The LEDs required approxi mately 6 5 V at 15 mA so I quickly hooked up and then used an LM317 as a voltage generator Used in this ma
210. scribed our step per motor controller design Now we ll explain how to implement soft ware that will enable you to control the motors locally via a front panel keypad and remotely via an RS 232 serial interface We built a general purpose con troller Different applications have dif ferent motion requirements e g con stant speed motion programmable speed torque step size rotary move ment etc If you want your hardware to satisfy every application it must be flexible and highly configurable A typical example involves driving the motor with and without a gearbox In order to meet both requirements you must specify the gear ratio as a param eter in the firmware and preserve it To control the system remotely the available options must be configurable through the firmware or application software running on a PC The hardware already provides numerous customization options e g motor current speed Half Full Step mode operation independent on off control etc because we used separate hardware for each motor In order to execute the different options at run time the firmware must be flexible too The firmware must be able to handle multiple tasks e g acknowl edging serial commands while driving three motors simultaneously at the same time via one CPU Fortunately the Philips P89C51RD2 microcon troller has 64 KB of downloadable on chip code flash memory This memory along with 1 KB of on chip data RAM
211. sembly options Successfully selling online since 1997 can trust Try us out today at3 www PCBexpress com cc ie Circuit Cellar And for needs beyond For protype amp production More Circuit boards CELA gees circuit 80 options IS Expect the best cams Easy Fast Reliable IER Easiest site to quote amp order times Real time online price matrix Mortuo cde EL Mods Re Quest eris 0 gt Production gt e B Ko PETS Attp www pcbpro com cc Seetron Serial LCDs almost too 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 _ 1 1 LCD gie 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 w switch inputs Easy hookup and mounting We don t iud iine 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 cus
212. sion 4 1 Highlights b Powerful library management move devices between libraries base library for packages gerserate package variis Tram other librames gt Dynamic ratsnest during routing 5 Copy function in schematic Roiate components in D 1 degree steps Blind amp buried vias and pads with off center drill F User defined background color gt Miter Funclson for rounded tracks Smash for groups Measure dislances beblween arbitrary paints Choose alternative raster the fly with Aft key pu Can EAGLE Light tor testing and Sear An a al tap signal layerg and one ghee SAGs features iin rl Praiuzsimnal Lipwninpagd i trom aur Sita ar arder eur free cial applications without charge The Freeware Harsin ip boards up to natif Eurocard format EAGLE 4 1 schematie Caplure Board Lapai Windows Linux Pad Ea ra E i Gn A Lich 1lso ut the rae EIER CH TORIS ference manual and a license for The Standard Wersion amp Eurecard formal with up io 4 signal ayers shemts Tha Pr IDAR 74 1 178 2005 foe boarda Version has mo such iri
213. solator were added but these aren t needed for the mouse demo in this project Five LEDs are used to announce the state of the microprocessor and a power LED A 20 MHz crystal oscilla tor provides the clock for the system A manual push button is used to reset the system There s an ICSP program ming connector used to bring pro gramming signals from the program mer to allow for the programming of the chip without removal from the cir cuit board A USB connector com pletes the hardware The completed circuit board is shown in Photo 2 For the initial debugging I added an optional MAX233 RS 232 driver receiver which allowed me to send Photo 2 The completed USB interface circuit board shows the programming con nection top center the USB connector top right and the Reset button lower left debugging data to be printed by the PC at 38 400 bps Some USB hubs don t have over current protection It s important that you stay under the 100 limit in order to prevent damaging the hub The circuit board draws approximately 30 mA 55 mA with all LEDs illuminated without the MAX233 If you decide to add the MAX233 it can t be powered from the USB or damage may occur Heed this voice of experience I changed two things in the circuit in Figure 1 I added a 470 nF polarized capacitor that connects pin 14 VUSB to ground This change enables the device to operate at the USB s high or low speed by just toggling
214. st USB project I used an ActiveWire USB board to connect an ADC0820 to a 16 bit interface It worked well but because it was a USB 1 0 device only 1 byte per millisecond was sent to the laptop It took 0 512 s to send 512 bytes The EZ USB 2 0 interface howev er can send 512 bytes per millisecond which speeds up the process considerably It uses the bulk transfer method which sends 512 bytes as a block of data Note that it isn t a continuously sampling sys tem but it works well for FFT displays You can use a D Link USB2 0 port CardBus if you don t have a USB 2 0 system installed and you have a CardBus interface for PCMCIA cards The card which comes with a driver works well but it sometimes causes the laptop to stall at start up when the Issue 178 2005 USB board isn t connected You can shut down by disconnecting your lap top s AC power and battery When you restart the computer it will load the drivers successfully Never panic EZ USB The secret is in the 8051 chip on the EZ USB board The EZ USB 8051 architecture has numerous areas of memory called endpoints that you can use as storage buffers Endpoint 8 is for data transfers The key thing about end points is that the 8051 can fill them with the data it collects from your hardware The USB software can access the end points and send the data to the laptop I built my 8051 program by modify ing Cypress s example on the kit s CD ROM I then
215. standing of the process It s also a concrete example of how they can use Visual C for data manip ulation and display But most of all it shows them that it can be done lal Daniel Cross Cole worked for the Department of Navy for 22 5 years as an electronics engineer He retired in 2003 and is now a professor at DeVry U niversity in Arlington Virginia Dan currentl y teaches courses about digital signal processing telecommunications engineering and computer peri pheral devices He enjoys ham radio and using Fast Fourier Transforms to char acterize acoustic guitars You may con tact him at DCrossCole dc devry edu PROJECT FILES To download the code go to ftp circuit cellar com pub Circuit Cellar 2005 178 RESOURCES J Axelson USB Complete Lakeview Research Madison WI 2001 H Chamberlin s Musical Applications of Microprocessors Hayden Book Co Rochelle Park NJ 1985 J Hyde USB Design By Example Intel Press Santa Clara CA 2001 SOURCES EZ USB Kit Cypress Semiconductor Corp www cypress com ADC0820 A D converter chip National Semiconductor www national com Issue 178 May 2005 33 APPLIED PCs by Fred Eady Build a Wi Fi Web Server Fred s hooked on the topic of wireless LANs This month he shows you how to get a wireless web server and running with an SRAM equipped 128 Wi Fi module Now you too can serve web pages from a wireless 802 11b stat
216. t Designed for 5tudents and Hobbyists All in One Logic Analyzer Signal Generator Designed for Professional Engineers Pu mp M eg bytes To Your Embedded Design VES The 5 ZA comes with the 5 Toalhudder Source Cade and gives your own Visual or Visual Basic mum g USBee applicabon direct access to the powerful data moving capabiltes of the USBea 2 Depending on your PC configuration you can mows up io 24M Bytesisac to and from the 5 2 connected to t All in One your embedded design Cannect multiple pode for mare channels and combined features V E Bee Digital Test Pods The USB based Electrical Engineer 951 693 3065 Logic Analyzer Signal Generator Frequency Counter Frequency Generator 12 Monitor Control Remote Controller Async Monitor Data Logger Pulse Counter SPI Monitor Power Supply Toolbuilder API USBee com support usbee com www circuitcellar com CIRCUIT CELLAR Issue 178 May 2005 65 Wireless Solutions For Embedded Control and Connectivity Rabbit Semiconductor the leader in embedded networking has gone wireless Network freely without the restraints of cables Add security with our optional SSL and AES software modules Bluetooth Application and Add On Kit aun Bluetooth Bluetooth The Bluetooth Application Kit includes everything needed to develop Add On Kit Application Kit Bluetooth applic
217. t 12 bit A D inputs Its on board power supply has a wide input range and includes 5 and 12 V outputs at the screw terminals for use by external devices The IC51 features LCD support circuitry that interfaces to a 16 pin 0 1 header connector matching most LCD module connections It also has an on board contrast potentiometer for the LCD module Included in the Tiny Machine Basic language are LCD commands that make it easy to display information on an LCD module The IC51 package is shipped complete with all the items necessary to begin application development immediately a serial port cable for connection to a PC a wall block power supply host computer software and programming examples and hardware and software ref erence manuals The IC51 costs 159 An enclosure costs 30 IndustroLogic Inc www industrologic com It gets no easier than this SPLat is an innovative new set of solutions that s changing how OEMs world wide think about embedded controls With SPLat you can program a quick and dirty sequencer literally in minutes vet the power is there to make sophisticated state machine based multi tasking systems with elegant user menus and floating point arithmetic Our hardware comes with real world MO interfaces ready t wire in straight out of the box We have a wide range of special function add ons for hard to implement tasks like AC current measurement and DC motor control Best of all you
218. t com Spartan ITE development kit Xilinx Inc www xilinx com www circuitcellar com 1 maang 8 d 3 x a s E 4 8 5 B IB m uid NE a it WWW STAR NET PEOPLE MVS Alternate 9g eee Nashua NH 03060 9 MIM S Free Shipping _ Free Shipping 508 792 9507 Mon Fri 10 6 EST Everywhere you imagine iz ES MN MCU Solutions Matched Play rosy 7 Your Design Imagination RENESAS IS THE 1 MCU SUPPLIER IN THE WORLD WWW 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 function compatible eta rting at 549 between families and packages Easy online access to application notes Extensive peripheral integration everythin SRI E HOP UN NOUSUER RON GWEN ADIRE example code software development tools from POR and LVD to CRC counters C Compiler Assembler Get your product to market faster IDE Cost using Henesas Interacti
219. t has 8 KB flash memory 512 bytes of SRAM and a convenient 512 bytes of on board EEPROM It also has an exter nal memory bus that s useful for interfacing with the FPGA In addi tion the ATmega8515L which runs on 3 3 V has external interrupts and a www circuitcellar com UART During development the firmware was downloaded to the ATmega8515L through the on chip debug interface Figure 4 is the ATmega8515L s firmware flowchart At start up the ATmega8515L s internal registers and watchdog are initialized The ATmega8515L then waits for the FPGA to finish programming from its external boot memo ry Following this the ATmega8515L reads and sets all the user configurable set tings from its inter nal EEPROM e g speed settings servo limits and the default start up posi tion of all servos The firmware then proceeds with the main thread of execu tion The first step dd consists of checking if any incoming serial characters are wait ing in the serial buffer which is filled asynchronously by the UART s receive Initialize MCU Wait for FPGA init flag Load settings from EEPROM limits speed base address startup positions and data rate refresh fpga flag high Serial receive N Parse buffer empty byte received yet Compute servo positions with velocity loop and range limits ters are waiting then they re read out one at a time and parsed with the seri al protocol state mach
220. t lon Tiny 5120 Low Power 2 x b 5 5v d 200 m al full speed amp 40 mA at lowest speed Dnwnloaatrd Ved pw Den Com tor info ces and Windows Control 22 lt arg 32 mod Simpie as a laptop Cu d ihe same RS 232 cable H 850 542 7905 phone amp fax www circuitcellar com CIRCUIT CELLAR Issue 178 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 91 All Electronics Corp 72 FaabMedia Inc 64 MaxStream 32 R E Smith 92 Circuits 86 FDI Future Designs Inc 89 MCC Micro Computer Control 18 29 Rabbit Semiconductor 27 Arcom 89 FieldServer Technologies 82 Micromint 66 87 Rabbit Semiconductor 90 ASIX 93 Front Panel Express 92 microEngineering Labs Inc 9 RadioShack 7 Atmel 91 Futurlec 90 MJS Consulting 88 Reach 93 Bagotronix Inc 86 Grid Connect 91 Mosaic Industries Inc 50 Renesas 48 Bellin Dynamic Systems Inc 91 Hagstrom Electronics 42 Mouser Electronics 72 89 Saelig Company Inc 79 Layout Ltd 55 HI TECH Software LLC 49 MVS 3 Scott Edwards Electronics Inc 74 CadSoft Computer Inc 63 89 COP Technology Inc 90 Inc 88 Sealevel Systems 87 Electronics 89 IMAGEcraft C2 M NetBurner 56 Sensors Expo amp Conf 48 CCS Inc 90 Intec Automation Inc 15 Noritake 5 Sierra Proto Express 92 Conitec 88 Integra
221. t reference book dedicated exclusively to the Rabbit 3000 Embedded Systems Design Using the Habbir 3000 Microprocessor Kamal and Bob Perrin RABBIT m LR Issue 178 2005 87 RLE IH Pd EASTERN p mas wl ro dnl sire restriction 2 layer 2 pc PROTOTYPE Printed Circuit Board Ako avaiable Small Fun Production D days tum Kwelectronics com In Circuit Emulator ICEPIC 3 Next Generation Emulation AB nes unire fer the PIC Mxracankraller Excenbanal perfarmanbe and FEATURES E From only Operates within MPLAB 9 70 Hardware suppoari s areia single steps in e Fast USB conreectian s Microchip asemik and compatib s Source level debug in assembler Full speed 4UMHE emulation Emulation Plug in daughbtertoans ordered separately to Configure system io icai ev m desired PIC SEE OUR WEBSITE FOR COBNPSATABEUTT More info www okwelectronics com High level 5232 interface Easy 1o program Low cost In stock Add color graphics in any 6 16 Bit embedded sysiem Easy laa aed flexible Up acd running in hours a 4 p PF sU Pi h X A Jal WX J e t ia ca www reachiech com
222. t title 00030 20 45 44 54 50 20 57 69 2D 46 69 20 53 65 72 gt EDTP Wi Fi Ser 00031 76 65 72 20 50 41 47 45 3C 2F 74 69 74 6C 65 ver PAGE lt title gt 00032 3C 2F 68 65 61 64 3E 3C 62 6F 64 79 3C 62 lt head gt lt body gt lt b gt Photo 2a The GET string is definitely in the Wi Fi module s receive buffer If all goes as planned the next screen shot should show the HTML that s to be sent to the client PC b The correct response is shown in the hex dump of the transmit buffer contents The web page here is simply a line of HTML that s stored in the ATmega128L s program flash memory 128K x 8 SRAM Now that I ve shown you how easy it is to create a simple wireless web server you can add your personality to the code and generate pages your self You ll want to store stuff along the way but if you look closely at the data memory layout in the Wi Fi source code you ll see that the Wi Fi web server s little TCP IP stack uses most of the ATmegal28L s on chip SRAM I included the 128K x 8 SRAM on the Wi Fi web server board so you don t have to limit your web server application because of a lack of avail able data memory The way you access the external SRAM depends on how your assem bler or compiler handles the extra memory area You may download a screen shot of a JTAGICE mkII debug window that shows what s behind the ImageCraft external SRAM handler mechanism The ImageCraft scheme allows you
223. t to see if there is a token in token out or token setup request If it s a token in the program will continue sending the requested descriptor If it s a token out the pro gram will continue processing it If it s a token setup the program will look at the contents of the buffer to www circuitcellar com device and mouse data is loaded into input buffer The mouse data con sists of 3 bytes of data the mouse but ton data unused the x position and the y position as defined in the HID report descriptor The data is updated in 100 ms intervals and the mouse begins to move in figure eights extremely irritating determine the bmRequestType and bRequestType For example if the bmRequestType is 80h and bRequestType is 6 the program will look at the wValue of the buffer 1 which means this is a Get Device Descriptor request The program will then begin to load the device descrip tor into the EPO input buffer And so the processing continues After the PC has requested and received all the needed USB descrip tors it sets the configuration for the DEBUG THE PROGRAM Initially I tried debugging the soft ware using the five LEDs on the cir DOWNLOAD our free CAD software DESIGN your two or four layer PC board SEND us your design with just a click exbresspcb com CIRCUIT CELLAR Issue 178 2005 19 Comment Debug Output H gt D Host to device SC Set conf
224. t to the MCU to indicate that it can safely reload the FPGA s 64 memory mapped control registers This way you don t have to update the registers dur system options First the 32 PWM channels are organized into four logi cal banks that can be individually dis abled through this register In addi tion a global option allows you to CLK 16 Bit master counter UPDATE _REG RDN 64 Channel multiplexer AO A1 64 Bit address decoder 8 Bit address latch ALE WRN STATUS LED m 44 Issue 178 2005 CIRCUIT CELLAR turn off each PWM signal completely when you send a 0 command to the chan nel This makes the servos go limp so you can move them manually When this option is disabled a O com mand value will cause the servo to hold at position O An LED is also tied to one of the ctrl reg bits It sim ply blinks when a valid serial command packet has been received which is useful for troubleshooting The individual modules enable the gener ation of a low jitter high accuracy PWM waveform A VHDL code snippet in Listing 1 describes the operation of one PWM channel The same module is simply replicated 32 times inside the FPGA The PWM module s operation is straightfor ward It simply compares its target pulse width register value against the master counter value and sets the PWM output to zero when the master counter exceeds this value One thing to note is that even if th
225. ted Knowledge Systems 75 Networks LLC 25 Silicon Laboratories Inc 10 Custom Solutions 91 Intrepid Control Systems 88 OKW Electronics Inc 88 SMTH Circuits 65 CWAV 92 Intronics Inc 92 Ontrak Control Systems 10 SPLat Controls Pty Ltd 1 Cypress MicroSystems 11 58 Jameco 2 93 TAL Technologies 86 Decade Engineering 64 92 JK microsystems Inc 87 PCB Fab Express C3 Tech Tools 91 Digital Products Co 75 Kerr Automation amp Engineering 2 40 41 Technologic Systems 86 DLP Design 73 Keil Software C4 Parallax Inc 87 Technological Arts 81 Dynon Inst 75 LabJack Corp 21 Philips ARM Design Contest 89 Tern Inc 18 Earth Computer Technologies 86 Lakeview Research 86 Phytec America LLC 90 Trace Systems Inc 95 Echelon Corporation 90 Lawicel HB 87 Phyton Inc 91 Triangle Research Intl Inc 87 EE Tools Electronic Engineering Tools 91 Lemon Studios 93 Picofab Inc 90 VNISource Design 90 Elsevier Inc 47 Lemos International 93 Pulsar Inc 93 Weeder Technologies 79 Inc 35 Linx Technologies 89 R2 Controls 19 ExpressPCB 17 M16C Design Contest 57 Systems Inc Preview of June Issue 179 ATTENTION ADVERTISERS Theme Measurement amp Sensors July Issue 180 Accurate Capacitance Meter Deadlines Precision Frequency Meter opace Close May 10 Electronic Angle Measurement Material Close May 17 Short Range IR Communications System Progressive Reflective Transmission Solution Theme
226. tel marketing department will get a lot of mileage out of the fact that every part in the ProASIC3 lineup comes in under 10 in high volume The entry level A3P030 30 000 gates is a bit different from all the other parts Actel is clearly positioning it as a loss leader for applica tions that don t need block RAM bitstream encryption or a PLL At only 1 50 in high vol ume their loss is your gain One standout fea ture that s unique to all the new ProASIC3 and ProASIC3E parts is the so called FlashROM FROM which is a 1 Kb flash memory Unlike the Issue 178 May 2005 83 Photo 1 The board and programmer are nice but it s the big ticket software including Synplicity and ModelSim that makes the 249 ProASIC3 starter kit a real bargain configuration flash memory FROM is accessible to your application for mis cellaneous data storage such as serial numbers IP addresses calibration fac tors and so on Interestingly although the FROM is both read and write accessible via the JTAG programming link it s only read accessible from the FPGA logic which explains the ROM label There s probably an argument for preventing the FPGA logic from writing to the FROM perhaps securi ty or power distribution issues but the restriction does seem limiting TOOL TIME AND TIME AGAIN Actel s flash memory FPGAs look good on paper but what about the development tools After all tools are everything when
227. the HTTP reply back to the PC client Photo 2b shows the HTTP response loaded in the Wi Fi web server s trans mit buffer Where did that come from Take a look at Listing 3 That s my web page complete with the HTTP high sign This entire thing started and ended with the client web brows er shown in Photo 3 When you look over and follow the web server thread in the Wi Fi web server source code you ll see that it really didn t take much coding effort to put that one liner in the client s web browser window Listing 2 It didn t matter if the write functions worked well because the read functions were being sabotaged by the addition of the SRAM and address latch char send command unsigned int char cmd unsigned int 004 cmd data while cmd_ data amp wr cf_iol6 parm wr cf_1ol6 cmd 004 cmd data while cmd_ data amp 004 evstat data cmd unsigned int cmd status evstat data rd cf iol6 Command Register CmdBusy Bit Mask Param Register Command Register rd cf iol6 Command Register CmdBusy Bit Mask rd cf iol6 EvStat Register jwhile evstat data amp EvStat Bit Mask cmd status rd cf iol6 cmd code cmd status amp rc cmd status amp wr cf iol6 switch rc case 0x00 C ww break case 0x01 l break case 0x05 re 2 break case PO break default result code break
228. the board as a stand alone controller using its on board Tiny Machine Basic programming language or you can use it as an RS 232 serial data acquisition board Communication is accom plished via two serial ports with true RS 232 drivers and DE 9 connectors matching PC compatible serial port pin outs The IC51 includes a real time clock calendar chip with on board battery backup and registers that are integrat ed into the variables of the Tiny Machine Basic language Convenient screw terminal blocks are used for all of the digital analog and relay con nections which include eight a A i 21i 4 kills zit CONTROLS Lighting HVAC Security 4 A V Much more HomeVision Pro is the newest most powerful automation controller in the award winning HomevVision product line It s configured from a PC but can then run standalone Features Two way X 10 amp IR Video screens on a TV 8 relays 16 digital amp 4 analog 1 0 64 digital temp sensors 1 USB amp 3 serial ports 4 Powerful scheduling 78000 lines 22000 objects Clock web server Expandable Software included 3 year warranty Custom Solutions Inc 800 398 8862 Web www csi3 com E mail cskgcsi3 com 10 Issue 178 2005 eee ee TE CIRCUIT CELLAR 10 A form C relays eight logic levels signals that you can use as inputs or outputs eight digital outputs and eigh
229. the same bit rate I could have used the encoding feature to con vert the Net Radio into a bandwidth hungry network radio station but I did n t want to build a device for spying COLOR LCD The LCD module consists of a con troller the LCD and the backlight assembly Like the VS1002 the con troller is connected to the ATmega64L microcontroller through the same SPI interface It has its own CS line in the schematics posted on the Circuit Cellar ftp site The SPI interface of the LCD is spe cial because there s only one clock and bidirectional data line But it was n t a problem because I didn t read any data back from the LCD It was as if it had only one receiving line Another special thing about the LCD controller interface is that it works with 9 bit data packets That was a problem because the AVR SPI interface can send a maximum of only 8 bits per packet So I used a small software trick to overcome this difficulty see Listing 1 The backlight of the LCD module con sists of two serially connected white LEDs that illuminate a light diffuser 26 Issue 178 2005 ing power supply for the main 3 3 V The power supply is based on a Maxim MAX831 which is a fixed output step down converter SOFTWARE The Net Radio s firmware is in the ATmega64L microcontroller You can ect file Warnings aren t generated dur ing compilation which is a good start At start up the firmware in
230. the text preprocessor and creates the actual sound output There are two approaches to creat ing sound output concatenative and formant The concatenative approach strings together prerecorded segments of speech in a number of different ways Depending on the application the database of utterances may be composed of complete sentences or broken into individual phonemes minimum distinctive sounds depend ing on the application An alternative to a database of phonemes is a diphone which is a recording of the transition between phonemes Note that the num ber of possible transition sounds goes up as the square of the number of phonemes possibilities how ever aren t needed Formant synthesis doesn t use any prere corded samples It uses an acoustic source filter model in which fre quency voicing and noise levels vary over time Multiple formant paths are often com bined to more closely imitate the complexity of the human vocal Five channel synthesizer Digital control component in the SpeakJet The serial port enables you to enter allophone data for immediate speech or sound output You can save the data in non volatile memory for subsequent output triggered by an event input 70 Issue 178 2005 tract Because a for mant database contains CIRCUIT CELLAR instructions for producing speech instead of actual samples it s much smaller than the concatenative database Votrax General
231. there are drawbacks to this method For instance it wastes a lot of potential computing power I built the Net Radio to address these problems see Photo 1 The Net Radio consumes a lot less power and takes up a lot less space than a PC Think about it you no longer have to worry about a key board a mouse a monitor and wires cluttering up the room in which you currently keep your radio receiver NET RADIO BASICS Do you have a cable connec tion a DSL connection or a satel lite connection The protocols for each connection vary from the IP packet s encapsulation e g PPPoE and PPPoA to the proto cols used for authentication from PAP to 802 1x The Radio is compatible with different Internet connections You can connect it to any Ethernet network router enables you to reach the Internet This setup is becoming increas ingly common because more and more homeowners are equip ping their houses with LANs 22 Issue 178 2005 After I knew what I would interface the Net Radio with I had to find a way to communicate with the network I knew I would use a microcontroller for the project but I didn t know how to connect it to an Ethernet network Some microcontrollers have an embedded Ethernet interface but they always need an Ethernet connector and additional components e g magnetics and passive components for a connection and some of these components are hard to find in low quantities
232. to allocate chunks of external SRAM space I carved out a 256 byte block of external SRAM xmem beginning at data memory address 0x1100 which EDTP Wi Fi Server PAGE Microsoft Internet Explorer File Edit View Favorites Tools Help Address http 192 168 0 151 D Search She Favorites ea 5 a 33 WI FI WEB SERVER CODE DOESN T HAVE TO BE COMPLICATED is the beginning of the external SRAM memory area and immediately follows the ATmegal28L s 4 KB of on chip SRAM The real work is done with the in line assembler routine which I gen erated with the ICCAVR Application Builder All I had to do was designate the external SRAM address name the memory block and enter the number of bytes to reserve My hand written code simply cleared the SRAM block to zero and then wrote the block with ascending ASCII characters beginning at ASCII 0x00 Nothing to it ACK FIN Although there s plenty of SRAM to go around you ll probably want to store your large web pages in program flash memory I noticed that when I told the ImageCraft C compiler that I had 64 KB of external SRAM it took it upon itself to start storing variables there There s a warning that comes up when you tell the compiler you have the extra data memory It basical ly says that if you want to control the external SRAM s content don t tell the compiler about it As the title of this section implies I ve reached the end o
233. to the parallel port To correlate received serial data with the WriteParallel and Set ClearPEO opcodes use the Ret ur nAck command to indi cate completion of those commands When connecting devices to the expan sion connector make sure you drive data on the data lines only when the USBLab is reading Use the read write signal and the data strobe to ensure this Drive the data bus only when read write is high and the data strobe is low If you fall out of synchronization with the USBLab when you re debug ging your code or the USBLab or both will probably confuse the data and opcodes If that happens you should reset the USBLab or send a string of NOP or Ret urnAck commands If you don t want to use the USBLab as a COM port DLP Design has a DLL based driver that provides essentially the same features You can call the DLL from any software that s capable of call ing a DLL including Python and of course C language If you re using the DLL driver you can change the EEP ROM values including the vendor VID and PID and the latency timer value EASY USB The USBLab provides an easy way to access functionality similar to the old parallel port but on newer computers and operating systems In addition the inclusion of the serial port provides new debug potential for your computer connected designs Finally you can apply the principles described in this article to adapt the DLP USB245 to your own application Now y
234. tomers love our web site it s fast uncluttered and jammed with tech data on our TRM 425L products The online store runs weekly sales with savings up to 40 Checkout xr 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 USB Bonanza you want to learn more about the Universal Serial Bus this is your month I m dubbing the May issue the USB Bonanza and it couldn t have come at a more opportune moment The lineup includes three fan tastic articles about dealing with the inevitable loss of serial and parallel ports on PCs and laptops If you haven t adapted to the changeover to USB yet you will likely have to in the near future as more and more man ufacturers move in that direction These informative articles will help you get started First up we have Robert Lang s USB Interface Development p 12 Faced with the elimination of classic serial and parallel ports on PCs Robert recognized the need to develop an interface to work with USB ports in order to facilitate data acquisition When he was finished design ing his new interface he thought other people in a similar position would find his experience useful We agreed The first step is to familiarize your self with
235. ts Real Time Clock Watchdog Supervisor Pervasive Internet Embedded devices providing internet connectivity for commercial and inaustrial applications Learn more at www powercoreflex com RABBIT uge bemiconductor pafford Street fe 530 757 8400 FEATURE ARTICLE by Daniel Cross Cole USB 2 0 Interface Daniel s inexpensive USB interface features an ADC0820 A D converter chip and an EZ USB interface The system can sample 100 000 bps and send 512 bytes in 1 ms to a laptop T laptop industry has been gradually moving away from serial and parallel ports in favor of Universal Serial Bus USB In anticipation of the day when USB is the only available port for building interfaces to measure the external world I developed an interface using National Semiconductor s inexpensive ADC0820 ADC chip and an EZ USB interface The system can sample 100 000 sps and send 512 bytes in 1 ms to a laptop using Visual C 6 0 to display the volt age samples or a Fast Fourier transform FFT The FFT appears 50 times per sec ond which is sufficient for real time fre quency analysis Cypress s EZ USB kit is expensive but it was the only one of the four systems that I tried that provided enough guidance and examples to devel op my own application for the USB 2 0 In this article I ll show you how to develop your own interfaces with USB also help you avoid several pitfalls WHY USB 2 0 For my fir
236. ugh the actual manufacturing process of ze making typical chip fram start to finish Includes a detailed discussion In plain language of each chip making step A Save 10 off and Free Shipping at books elsavier comcomputerang Use Offer Code 81507 PROBLEM SOLVED Custom Hardware amp software Design Rapid Prototypes Cost effective Design Free Consultation and Quotes MJS CONSULTING INC Mark J Samarin M S EE com 253 858 6844 90 Issue 178 2005 Development Tools PRESTO USB Programmer Extremely fast and flexible in system programmer for Microchip PIC amp dsPIC Atmel AVR amp 51 serial EEPROM amp Flash JTAG CPLDs FPGA PROMS Tired of waiting while programming your favorite chips Buy PRESTO now MU Beta PIC Emulator Real Time In Circuit Emulator for popular MCUs in 6 to 18 pin packages Unique flexible and affordable lowest cost per emulated device in industry And many other products ASIX Czech Republic EU info asix tools com www asix tools com China Connection PCB Production Assembly Turnkey Prototype Production D S PCB 12 per in 4 L PCB 20 per in 3 weeks Delivery wi solder Mask net included UL Approved MYLYDIA INC 1 800 Mylydia sales mylydia com www mylydia com It writes your USB code NO Need to be a USB expert HI
237. uired to communicate with the AT89C2051 slave device see Listing 2 A bit banging serial UART is used for this purpose The command response protocol is necessary to avoid data loss when the P89C51RD2 is paying attention to another important task and it can t receive the serial data in pep i m mo x the background A reserved port bit unsigned char notifies the host that you hit a key MOTOR The host then conveniently sends a ag Motor Data 3 L command to read the key code bdata unsigned char Motor 3 Current status and settings for motors The bit banging UART code put sbit XDir Motor 0 0 Direction and get c functions is implemented sbit XEn Motori 0 l Enable in assembly language and linked to T 2 bw the C code The AccessKBLCDSI ave sbit XEnLi Motor 0 4 If enabled function sends a command and waits sbit XEnLi 5 2 Motor 0 5 f enabled for a response from the slave see sbit XStepMode Motor 0 6 Half step 1 Listing 2 This notifies the slave to get ready for additional communication The host may send more data typical define LOC MOTORDATA define XMOTORDATA BASE LOC MOTORDATA XMOTOR 1 MOTOR DATA S ly the GOTOXY and Str 2LCD func tions and close the communication define YMOTORDATA BASE LOC MOTORDATA YMOTOR 1 SIZE define ZMOTORDATA BASE LOC MOTORDATA ZMOTOR 1 MOTORDATA SI ZE There are many configurable param eters T
238. uitcellar com web browser You don t have to install the client software first A few devices enable you to control equipment with only a GPIB interface over an Ethernet connection These devices suffer from two major draw backs First they re unnecessarily expensive which can put them out of reach for many designers and small companies Second they don t embed the client application for controlling the GPIB equipment so you must install software on each PC We designed a network GPIB controller that solves both of these problems Our low cost solution makes it easy to embed client applications CONTROLLER HARDWARE We used an eZ80F91 microcon troller to integrate a number of criti cal functions into a single device The GPIB driver is the heart of the con troller see Figure 1 It implements an IEEE 488 1 compliant GPIB bus con troller in the software by way of the eZ80F91 microcontroller s external GPIO lines The eZ80F91 microcon Mity SOC 1 386 Embedded sylem module 1 17R amp 232 445 16 IDE FOO RTO Parallel Vabcheog ZWE GAM 2 56 X 1 77 Optional 4446 565 00 50 75 Singles umit Qty 100 pricing ICOP BD2T VE 3 5 3B6 Embedded SEC CRTALCD 1 95 230 1 ASPs Parla DzkOnchip IDE WMaichdeg JME RAM 4 01 Xx 567 222 00 ea 154 00 Tipo unl pricing Dos 385 189 232 1 25 232485 1 parallel kOn Chip
239. upplies are standard fare 64 Embedded Ethernet 10Base T Ethernet 186 Processor 40 MHz DOS wi Flash File System Hardware Clock Calendar 512K DRAM amp 512K Flash Console Debug Serial Port 16 Digital 1 0 lines Optional DiskOnChip 5V DC Power Compact 3 75 x 2 50 only 598 uty1 2 Serial Ports 2 16 bit Timers Watchdog Timer Expand with the 1 0 32 Digital Inputs 20 Digital Outputs 11 Channels of 12 Bit A D C C amp Quick Basic Drivers Call 530 297 6073 Email sales jkmicro com On the web at www jkmicro com microsystems Issue 178 May 2005 4 ZigBee Modules Size XBee XBee Pro Achial Sirm 2 e Lowest Cost CIRCUIT CELLAR Toll Free 866 765 9885 ww wWw maxstream net www circuitcellar com troller not only reduces cost but it gives you a measure of investment protection because any updates to the GPIB protocol can be made to the system in the field via a software update The GPIB bus signals require line drivers external to the eZ80F91 micro controller We chose two commonly used Texas Instruments parts for this task SN75160 and SN75161 trans ceivers The former which drives the GPIB data bus is interfaced to the eZ80F91 microcontroller via GPIO port The latter which drives the GPIB control and handshaking signals is interfaced to the eZ80F91 micro controller via G
240. ve SKPSCMINIT3 R5F21134FP 349 SKPSCMINITZ RS5F21174FP 549 Evaluate test and learn SKP18C26A waozeoraacp FREE 549 about Henesas products 18 28 M30280FAHP intei d 54 in an interactive online SKP16C62P Ma0626FHPFP vertical 549 aKP32CB4 M30845FJGP 540 E negra nncir is ini US dollars from Aenesas suthonzed North American datribusnrs only and is subject bo change Popular Devices Data Flash KB 4 sE e BP 5 8 5 1 E amp Series EE E 5 5 Group Part Number D w 2 3 R8C 17 R5F211725P 18 20PinSS0P 20 g 8 2 512 1 1 15 X WOT 519 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 5476 Mi6C 28 M30281FAHP 16 20 98 4 4 55 13 X WDT 5590 MiBC B2P M3OG2AFGPGP 16 100 24 8 256 20K 5 3 87 26 X 8 25 M16C 82P MsoS26FHPGP 16 MXPinOFP 24 16 38 5 3 H7 26 X X 10 05 M32C B M3DRASFIGP 168 144PnLOFP 32 32 572 22K 5 5 124 3 X X 1I WDT 16 88 FEATURE ARTICLE by Prajakta Deshpande amp Praveen Deshpande Three Axis Steoper Motor Controller Part 2 Software Implementation Now that you can design a three axis stepper motor driver it s time to learn how to control it You can control the system locally with a keypad and remotely via an RS 232 serial interface Lz month we de
241. very best of low power Intel XScale RISC technology amp the industry standard PC 104 format www circuitcellar com rcom WWW ad COM COMM CIRCUIT CELLAR Think Embedded Think Arcom Issue 178 2005 27 Photo 3 After Net Radio has booted up and com pleted its self tests it displays a selection menu of accessible radio stations You can connect to one of them with a simple press of a button the system as small as possible One of its best features is its small size I also wanted a commercial quality sys tem that I could eventually sell with out having to make a lot of changes I stored the network radio station list along with other data in the ATmega64L s data EEPROM Ideally however I would have created a cen tral server on the Internet to store a list of network radio stations Each Net Radio would have a unique iden tifier stored somewhere in its flash memory and the flash memory would be protected from reading and writing After booting up the Net Radio would ask the central server to send it the sta tion list based on its unique ID All of this data then would be stored on the EEPROM and you d have the choice of listening to any one of several stations Under these ideal conditions the list size would be limited only by the size of the EEPROM I would be able to add an external EEPROM or even a 1 Gb mem ory card for additional space In addition it would be extremely
242. ves the descriptor type In this case a 1 indi cates that it s a device descriptor The descriptor gives the maximum packet size and other information The vendor ID and product ID are of particular interest The vendor IDs are assigned by the USB Implementers Forum Microchip has a vendor ID 04108 so I ll use it for this experi mental device Vendor IDs and prod uct IDs must be used carefully because they can cause an incorrect driver to be loaded if Windows recog nizes the vendor and product as one of its supported devices Because there aren t any custom Windows drivers for this device Windows will load the default HID driver when it enumer ates the device Because the HID is a general pur pose device that can support a mouse keyboard or just about any other low speed device you d like to build it requires a special descriptor to define the data that will be transmitted to and from the device The format of the report descriptor is rather com plex so the USB Implementers Forum developed the Descriptor Tool pro gram DT which can create edit and validate HID report descriptors DT was used to prepare the report descriptor for the Irritating Mouse test The report descriptor also speci fies that the x and y movements are relative to the previous position The Process Req routine is the program s workhorse that handles all of the control requests from the PC It first checks the BDnSTAT of the active endpoin
243. ware Security amp Peripheral Features Starting at 119 Optional 2 channel 12 bit ADC B channel 10 bit ADC 8 Single ended Channels 7 Differential Channels 2 Differential Channels with Programmable Gain 1x 10x 200x Byte oriented Two wire Serial Interface 120 Dual Programmable Serial USARTs 1TTL 1 RS 232A R5 422 or R5485 Master Slave SPI Serial Interface EPAM Channels 64 or 1255 Flash Ak Bytes SRAM Programmable Watchdog Timer f Dozens of Embedded Controllers with Countless Configurations to fit ANY Industry Two 8 bit Timer Counters with Separate Prescalers and Compare Modes Two Expanded 16 bit Timer Counter with Separate Prescaler Compare Moda and Capture Mode Two 8 bit PWM Channels 6 PWM Channels with Programmable Resolution from 1 to 16 Bits Programmable Watchdog Timer with On chip Oscillator 29 Digital VO that can sink or source 20 mA Serial O R 232A 15472 R54H5 Digital L O 12 Bit ADC Optional ViB 16 DC Unregulated Jopauuoj 87 p90J21lA 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 providi
244. way anything it is SpeakJet s output is simply modula z presently saying tion on a 32 kHz PWM carrier A two m ines samia MSA Register 237 Power up reset phrase The MSA operates the Bit7 0 Play 1 Silence five channel synthesizer Bit6 Always 1 according to parameters Bit5 Always 1 stored in the database Bit4 Always 1 Each value received via Bit3 Bit 3 of phrase pointer number to call on power up reset the serial port except Bit2 Bit 2 of phrase pointer number to call on power up reset escape commands redi Bit1 Bit 1 of phrase pointer number to call on power up reset The pi Vision3 IDE Debugger supports recting data to the SCP Bit 0 Bit 0 of phrase pointer number to call on power up reset virtual target simulation and includes a buffer causes the MSA Address 238 PortCTL Auto Silence RC TTL Mode software logic analyzer that graphically to execute one of its Bit 7 Reserved displays variables and l O registers database functions The command set rs RC input 1 TE tac ate RC input 1 TTL D v lopmii sists of a set of actions Bit4 RC1 E7 0 RC input 1 TTL Environirient 0 31 allophones Bit3 Auto Silence 0 off disable 1 enable provides 128199 and sound Bit 2 D2 Buffer half full 0 phrase control 1 output complete device effects 200 254 Bit 1 D1 Speaking 0 phrase control 1 output simulation and Note that only about BitO
245. y control their equipment Coding in LabVIEW enables us to deploy the application on Windows and Linux Unix platforms as a tabbed dialog box One tab is used for setting the default driver s parame ters The other tab controls the driver All the parameters declared in the motor data structure can be either configured or changed via the controls on the control panel This enables you to control the optics equipment via the GUI The LabVIEW software generates remote commands in accordance with the selected options for a motor For instance if you alter the motor s speed the software will generate a SPED X 100 command and store it in a buffer It would also generate command strings that correspond to the rota tional direction If you click Run command button the software will generate a MOV command knowing the final position requested and mode of movement It would periodi cally send a P0SI X query to obtain www circuitcellar com code for the state machine that you could easily link to other firmware modules VisualSTATE provides you with a compact and efficient API developed specifically for the MCS 51 micro controller You can easily integrate the VisualSTATE with or without a real time operating system The tool can also generate documentation that you d find useful during the code develop ment and maintenance processes An interactive VisualSTATE simulator allows you to execute a state machine m
246. y reactive engine core as opposed to the RTOS which is com plete framework for developing multi tasking software For applications based on tiny single chip microcon CIRCUIT CELLAR trollers with restricted memory you can t afford operating system overhead But you can handle the multitasking by modeling the application as one or more state machines You can model the simple embedded computation needed for controlling a stepper motor as a state machine see Figure 1 The state machine has states corresponding to the actual stages a motor goes through during operation The S state initializes the state machine and data associated with the motor e g its default speed direc tion and Stepping mode After initial ization the state isn t revisited unless you reset the driver Each state machine maintains a state variable that indicates the machine s current state The state machine code is simply a C language switch state ment construct see Listing 3 p 59 The state variable selects the case Each state numbered sequentially is declared within the case value branch The state machine code assumes that events or inputs are monitored in another section of the code After a relevant event occurs the state machine code is called Assuming that events whether variable or flag are accessible to the state machine code it would branch to the current state examine the relevant events and manipulate the state varia
Download Pdf Manuals
Related Search
COMMUNICATIONS communications communications degree communications merit badge communications equipment communications training courses communications jobs communications plan communications major communications biology communications plan template communications specialist communications director job description communications biology impact factor communications act of 1934 communications decency act communications physics communications jobs near me communications medicine communications workers of america communications merit badge requirements communications degree jobs communications federal credit union communications in algebra communications sustainability communications link failure
Related Contents
AVF EC170S flat panel wall mount eInforme : Aplicación web para el trabajo colaborativo Netzwerk-Scanner HP Compaq LA2306x "取扱説明書" Thermostat PERRY THCRTX03 Radio Thermostat Maitre "user manual" Hunter Fan 42408-01 Fan User Manual Copyright © All rights reserved.
Failed to retrieve file