Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Atmel applications journal.Spring 2004

.pdf
Скачиваний:
96
Добавлен:
23.08.2013
Размер:
2.82 Mб
Скачать

A T M E L A P P L I C A T I O N S

Number 2 • Spring, 2004

 

 

 

 

 

 

 

 

 

 

 

 

ATA_STAT_BSY

0x80

//ATA

busy

 

 

ATA_STAT_RDY

0x40

//ATA

ready

 

 

ATA_STAT_ERR

0x01

//ATA

error

 

 

busy

ata_bsy()

 

 

 

 

drq

ata_drq()

 

 

 

 

error

ata_err()

 

 

 

 

ready

ata_rdy()

 

 

 

 

hard_reset

ata_hard_reset()

 

 

select_device_0

ata_select_device(0x00)

select_device_1

ata_select_device(0x01)

recalibrate

ata_send_cmd(CMD_RECALI-

identify_device ata_send_cmd(CMD_IDENTICE)

******************************************

ize drive. This routine assumes drive 0 is ly drive that is attached.

******************************************

nit_ata(void)

(!ready &

busy);

hard_reset;

_ms(10);

 

 

(!ready &

busy);

select_device_0;

(!ready &

busy);

recalibrate;

(busy);

 

if(error)

ntf("ERROR!");

f("\r\nDrive is READY!\r\n");

ions are squashed for space savings d int ata bsy(void)

Special

Focus:

Algorithm Builder for

Heterogeneous Device Networking

Construct an ATA Hard Drive Controller

A Compact Scheduler for AVR Microcontrollers

High-level Tools Targeted for AVR Controllers

8-bit Microcontroller Drives Battery-powered Thermostat

Atmel AVR-based constant Current Supply

Rapid Application Development: Race Against The Clock

Plus:

Atmel’s Mistral Emulation Platform for ARM9™ Core-based SoCs

USB Wireless LAN Media Access Controller

Interfacing the 3 Volt DataFlash™ with a 5 Volt System

FingerChip™ Technology for Biometric Security

Low-cost, High-security Solution

And:

Designer’s Corner

Code Patch

R

Europe’s #1 AVR

Stocking Distribution

Group

For commercial and technical support contact your local office:

 

an ATeG Company

an ATeG Company

an ATeG Company

 

 

an ATeG Company

INELTEK GmbH

Paseo Imperial, 8

Anatec AG

24 High Street

Hauptstrasse 45

Planta 3

CH-6300 Zug

Twyford UK

D89522 Heidenheim

28008 - MADRID (SPAIN)

Sumfrasse 7

+44 1189 342277

+49 7321 9385-0

+34 91 365 50 95

+41-41-748 3232

www.gd-technik.com

www.ineltek.com

www.anatronic.com

www.anatec.ch

 

 

 

 

A T M E L A P P L I C A T I O N S J O U R N A L

Jim Panfil,

Marketing Director,

Microcontrollers

Introduction

By Jim Panfil, Director of Marketing

Atmel has undertaken key initiatives to bring more complete solutions to the embedded marketplace. In this issue of the Atmel Applications Journal, we will focus on providing you more information on the versatility of the 8-bit AVR Microcontroller and a new development environment which supports ARM9 System on a Chip (SOIC) solutions. We included announcements of several new communication products. There is a RF transceiver targeted at remote keyless entry systems and an ASK receiver which enables development of low power tire pressure monitoring systems. Look for the single chip USB wireless LAN Media access controller that has all the processing and functionality required for the (MAC) protocol for wireless LANs.

Atmel expanded its leadership position in the dual output laser diode driver segment with the introduction of the world’s smallest three-channel device that supports all DVD standards for read write optical storage devices.

There is an increased requirement for security in embedded applications. Atmel now offers a family of Crypto Memory products, which provide a secure place for storage of sensitive information within a system. These devices contain a proprietary algorithm that encrypts data, passwords and check sums that protect factory configuration information, user preferences and encryption keys. Access to information stored in these devices is protected by a sophisticated authentication routine.

Biometrics is a convenient, low cost reliable means of identifying individuals. It measures certain physical characteristics and matches them with a template stored in the security system. Atmel selected fingerprint recognition as the means of biometric identification. Atmel’s FingerChip, electric fingerprint sensing circuit uses scanned thermal image capture and compare on a single CMOS die for fingerprint recognition. This approach has the advantage of small size, high accuracy and low power consumption. A complete security system can be constructed using Atmel standard products with industry standard software. Protection of computer systems, mobile phones, motor vehicles and screening access to restricted areas are typical applications with a growing need for protection from unauthorized use.

AVR Butterfly

The 8-bit AVR Microcontroller is the most popular Flash based solution in the industry. It has a high level of integration that reduces board space and cost while providing designers a wide range of derivatives to chose from. In this edition there are five application examples submitted by designers using the AVR that highlight some of the attributes of the Family. The Mega 169 with integrated LCD controller was used to design a residential thermostat. Two AA batteries were used to power the system and a 10-year battery life was a requirement. To achieve the battery life goal, reduction of power consumption was essential. The designer limited the maximum operating frequency and took advantage of the programmable sleep modes to keep power consumption to a minimum. The Mega 169 has excellent development tools support including the AVR Butterfly, which is the worlds lowest cost starter kit with a retail price of $20.

The Tiny 26 with integrated A/D converter and 2KB of self programming Flash memory was selected to implement a test equipment module used to measure six different light levels and log data to a laptop PC. An application note describing SPI design for the AVR inspired the designer to use the SPI on the AVR as a slave. The Tiny 26 integrated 11 channel 10-bit A/D converter eliminated the need for eight external A/D devices. Time to market was key and the integrated Brown out detector, reset circuit and internal RC reduced the need for external devices, system integration plus hardware debug.

Based on reader feedback we added a new section to this issue of the Journal called Code Patch. This is a complete list of all code used in this issue’s articles. You can find this code and download it for your use by logging on to www.atmel.com Atmel Applications Journal

.

Mega 169

www.atmel.com

page 1

A T M E L A P P L I C A T I O N S Number 2 • Spring, 2004

T A B

1

Introduction by Jim Panfil, Atmel

6

Algorithm Builder for AVR

by Gennady Gromov

8

Heterogeneous Device Networking

by William Foard

10

8-bit Microcontroller Drives Battery-Powered Thermostat

by Jim Panfil

12

Construct an ATA Hard Drive Controller by Fred Eady

17

A Compact Schedular for AVR

Microcontrollers by Andy Gayne & Steve Duckworth

18

Atmel AVR-based Constant

Current Supply by Jeffrey R. Skinner

22

High-level Tools Targeted for

AVR Controllers by Henrick Leerberg

L E O F C O N T E N T S

 

 

 

24

 

 

 

 

page 12

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Atmel’s Mistral Emulation Platform for

 

 

 

 

ARM9Core-based SoCs by Peter Bishop

 

 

 

 

27

 

 

 

 

 

page 35

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Low-cost, High-security Solution

 

 

 

 

by Mary Jarboe

 

 

 

 

 

 

 

 

28

 

 

 

 

 

 

 

 

USB Wireless LAN Media Access

 

 

page 40

 

Controller

 

 

 

 

 

 

 

33

 

 

 

 

 

 

 

 

Interfacing the 3 Volt DataFlash

 

 

 

 

with a 5 Volt System by Dirk Franklin

 

 

 

35

 

 

 

 

 

 

 

 

FingerChipTechnology for Biometric

 

 

 

 

Security

 

 

 

 

 

page 41

 

 

 

 

 

 

 

 

 

 

Rapid Application Development:

 

 

 

 

Race Against the Clock by Robert Severson

 

 

 

 

Departments

 

 

 

 

 

 

 

 

Atmel Notes

Page 3

 

 

 

 

Designer’s Corner

Page 41

 

 

 

 

New Section:

 

 

 

 

 

 

 

 

Code Patch

Page 45

 

 

 

 

All the code in the articles together in one place,

 

 

 

 

 

 

 

 

to make it easy to reference and download on-line!

 

 

 

 

 

 

 

45

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

www.atmel.com

page 2

R

A T M E L A P P L I C A T I O N S J O U R N A L

Atmel Notes...

New RF Remote Control ASK/FSK Transceiver Launched

Atmel’s new RF data control transceiver ATA5811/12 is designed for automotive and other mobile Remote Keyless Entry (RKE) and Passive Entry Go (PEG) systems that will benefit from the new devices' extremely low current consumption and small size, which are mandatory requirements for small, battery-driven applications such as a car key. In addition, the new transceiver can also be used for a broad range of further transceiver RF links were low power consumption and an effective system solution are required, such as energy metering, home automation, alarm and telemetry systems.

The ATA5811 is designed for 433 to 435 and 868 to 870 MHz, whereas the ATA5812 operates at 314 to 316 MHz. Both transceivers are pinand functionally identical. The ATA5811/12's current consumption is both in

receive and in transmit mode as low as 10.5 mA (3 V/ Tx with 5 dBm). This enables portable applications to be powered by a single Li-cell for smaller designs with extended lifetime.

This new device also exhibits excellent system performance: high sensitivity in ASK (e.g. -116.5 dBm at 2.4 kBaud) and FSK mode (e.g. -109.5 dBm at 2.4 kBaud), a PAE of nearly 40%, adjustable output power of up to +10 dBm for longdistance operation, a high selectivity and a high blocking plus low intermodulation due to the receiver module's lowIF architecture. Thanks to the transmitter module's closedloop Fractional-N synthesizer, the transceiver features high PLL bandwidth and excellent isolation between PLL and PA. "Since our new transceivers are bi-directional devices with half-duplex functionality, RF Remote Control systems will

reach a next step of increased security and convenience." Torsten Mann, Marketing Director for Automotive and Control Products at Atmel, explains. "Imagine a PEG car system realized with these new devices. You will not need to use a key, push on a button or plug in a card to open the car and start the engine. Just touch the car's door, then the key fob/ card will wake-up, the transceiver, implemented on the PEG card, will start to communicate with the car, and the car opens. This communication between car and card will be on an extremely high security level, based on interlocked hopping codes and crypted protocols."

Samples of the transceivers ATA5811/12 in QFN48

(7 x 7 mm) packages are available now.

Atmel Introduces Industry-Leading

Tire Pressure Monitoring (TPM) Receiver IC

The new ATA5283 ultra-low power ASK receiver IC provides the industry's best trade off in terms of minimum current consumption and maximum sensitivity. Furthermore, it is the smallest available device for 125 degree C applications, such as tire pressure monitoring. The new IC is designed for use in tire pressure monitoring modules where it wakes up the TPM module and enables data programming during production and tire change during service. Remote triggering and programming is usually done in a distance of about 2 meters. Due to this, TPM systems are not based on short-distance triggering solutions but on LF receivers. The ATA5283 operates in the range of 2.0 V to 4.2 V over temperatures of -40 to 125 degrees C. It can withstand environmental temperatures on battery supply up to 175 degree C for short intervals.

To comply with automotive manufacturers' standards, a TPM module must have a minimum life of 10 years. Since the integrated battery in such modules cannot be replaced, low current consumption is a must for TPM applications. The LF receiver ATA5283 is constantly in standby listening mode and monitors for a signal originating from the car or from a base station. The device switches off the TPM module when it is not needed to extend the module's battery life and wakes up the module only if a valid preamble has been detected. The ATA5283's current consumption in listening mode with a sensitivity of 1 mV rms is as low as 1 microampere typ., while competing products have current consumption at least 3 times higher. This combination is unique in the industry.

Another key requirement in TPM applications, which is addressed by this new device, is small outline and low weight. Since the high speed of a car wheel causes enormous centrifugal forces, a TPM module needs to be very small and may not exceed a weight of 35 grams. "We are proud to announce with the TSSOP8-packaged ATA5283 the world's smallest available stand-alone TPM IC for 125 degree C systems, until now, the smallest possible 125 degree C TPM products were only available in TSSO16 packages", Torsten Mann, Marketing Director for Automotive and Control products at Atmel, said. "Its high performancein terms of current consumption and sensitivity, along with its cost-effectiveness, will help TPM system makers to manufacture high-performance solutions at a reasonable price. In the future, cars with TPM systems will not be a luxury feature but a common standard." Samples of the ultra low power ASK receiver IC ATA5283 in TSSOP8 packages are available from Atmel now.

Atmel Licenses ARM926EJ-S Core for Next-Generation Products

Atmel has licensed the synthesizable ARM926EJ-S™ 32-bit RISC processor core from ARM for its next-generation system- on-chip (SoC) products. This agreement is the latest in a long-standing partnership between Atmel and ARM. Atmel was one of the first licensees of the ARM7™ Thumb® core family, and ARM® core-based products are making a significant and steadily increasing contribution to Atmel's revenue stream. The ARM926EJ-S core will be implemented in a 130 nanometer process for a variety of standard and custom products.

"The ARM926EJ-S core will be used by Atmel for both ARM core-based standard products and ASIC implementations," said Alfredo Vadillo, Atmel's director for ASICs and ASSPs. "The synergy between standard products, ASSPs and ASICs is unique in the industry and forms the basis of our SiliconCITY™ strategy."

"Atmel has experienced considerable success with ARM corebased products, which have enabled them to significantly reduce the time-to-market for their SoC roadmap," said John Rayfield, VP US Marketing, ARM. "The licensing of the ARM926EJ-S core now enables them to further this success in sophisticated SoCs aimed at a wide variety of applica-

tions."

continued on next page

www.atmel.com

page 3

A T M E L A P P L I C A T I O N S J O U R N A L

Atmel Notes... continued

Pictured above, Graham Turner - Vice president of Atmel's Microcontroller Division, presents an award to Vegard Wollan and Alf Bogen, joint managing directors of the AVR design group located in Trondheim, Norway, for achieving AVR sales in excess of 500 million units since its introduction in 1996. Currently manufactured in 0.35µ technology and shortly moving to Atmel's new 0.25µ process, the AVR family is increasingly seen as the most advanced and flexible 8-bit architecture in the industry and is supported by a wide range of low cost development tools from Atmel and many 3rd party vendors.

Atmel Licenses continued from previous page

The advanced features of the ARM926EJ-S core are an ideal match for the next-generation SoC products that Atmel is developing. Based on one of the richest libraries of qualified IP blocks in the industry (including embedded memories, industry-standard interfaces and high-performance analog), Atmel has developed a series of ARM core-based platforms that can be rapidly evolved into high-performance, low-power ASICs, ASSPs or Standard Products according to client and market requirements. These products form the basis of Atmel's SiliconCITY platform-based products which are aimed at fast-growing applications areas such as GPS, telematics, mobile communications, portable data storage, high-security point-of-sale terminals, wireless networking (WiFi™ and Bluetooth®), digital rights management and next-generation digital multimedia. One of the first products based on the ARM926EJ-S core will be a SoC for advanced multimedia applications.

About SiliconCITY

SiliconCITY is the creative foundation for Atmel's ASIC/ASSP product strategy. It is built on re-useable and validated IP and architectures from Atmel's broad line of standard products and ASSPs. Atmel has SiliconCITY platforms available now to give customers a significant time-to-market advantage. In addition, the common design infrastructure allows customers to seamlessly migrate from standard products to custom ASICs with confidence

in first pass success. SiliconCITY from Atmel…Your System Foundation.

Atmel FingerChip Fingerprint Sensor Selected For Sharp's Mebius Muramasa PC-TN1-H1W Tablet PC

The number one selling sweeping sensor, the AT77C101B FingerChip˙ biometric sensor, has been selected by Sharp Corporation to provide logon security for its newest and first fingerprint-protected Tablet PC®, Sharp Mebius Muramasa PC-TN1-H1W.

Integration of the FingerChip™ into Sharp's Tablet PC provides users with improved security and increased convenience towards protecting their information. The need to type a password or write it openly on the Tablet PC display is replaced by faster logon through a simple finger swipe on Atmel's FingerChip, preventing access to personal information, or critical data or illegal use of the device by a third party. "Atmel FingerChip continues its adoption in consumer markets thanks to its low cost, high image quality and very

small form factor. This solution offers high security of the users personal data, ensuring that information remains safe if the Tablet PC computer is lost or stolen. It also increases end-user conven-

ience, providing Sharp customers with a more enjoyable experience with their Tablet PC" said David Richard, Atmel Biometrics Worldwide Marketing Manger.

Atmel designed the FingerChip to provide a cost-effective small form factor solution that will meet the demands of biometric security for space constrained mobile applications. The FingerChip utilizes a unique patented method for imaging the entire finger by "sweeping" it across the sensor. Sweeping captures successive images (slices), then uses software to reconstruct the fingerprint.

This method allows the FingerChip to return a large, highquality, 500 dots per inch image of the fingerprint. This image is then processed through authentication software, to extract a template, which is used for fingerprint comparison.

The FingerChip is a CMOS thermal fingerprint sensor with a 0.4 mm X 14 mm scanning area, and an overall package

area of 26.6mm X 9.8 mm with a height of 1.5mm. The sensor measures the temperature differential between the skin ridges and the air caught in the fingerprint valleys. This method provides a high quality image even on poor quality fingerprints such as ones that are dry or worn with little depth between the peaks and valleys of the fingerprint. The thermal technology also operates well under extreme environmental conditions, such as extreme temperatures, high humidity, dirt, oil and water contamination.

In addition to providing a small form factor, the sweeping method also has the added benefit of self-cleaning the sensor, thus avoiding latent fingerprints. Latent fingerprints are prints left behind on a non-sweeping sensor which not only can cause problems with future reads, but also leaves an image that can be copied and possibly used to gain access to a system.

www.atmel.com

page 4

A T M E L A P P L I C A T I O N S J O U R N A L

Atmel Notes... continued

Atmel targets Secure 802.11b Wireless Connectivity

Atmel® Corporation plans to offer its suite of 802.11b Media Access Controller (MAC) and MAC plus baseband controller parts, including the Dual Ethernet to Wireless LAN Bridge part, eligible for Wi-Fi Protected Access certification. A Wi-Fi Protected Access™ (WPA) software upgrade to existing parts is available now. Atmel's future MAC plus baseband products will incorporate a hardware block implementing TKIP, an essential component of the Wi-Fi Protected Access security solution and of the upcoming IEEE 802.11i draft standard WPA, a standard promoted by Wi-Fi® Alliance, enhances the Wired Equivalent Privacy (WEP) encryption methodology, already offered in Atmel's 802.11b family of parts. WPA uses the 802.1x standard for port based network access control and Temporal Key Integrity Protocol

(TKIP), an increased level of security, by implementing random re-keying on WEP and by increasing the length of the keys from 40 to 128 bits. TKIP still uses RSA's RC4 algorithm for encryption.

"All Atmel's Wireless LAN current products are Wi-Fi Certified, either directly by Atmel or through customers using an Atmel based Reference Design. Now that the Wi-Fi Protected Access (WPA) certification program has been officially established from the Wi-Fi Alliance, Atmel will submit its products for WiFi Protected Access certification testing, ensuring the needs of Atmel's customers for interoperable and standards compliant solutions" said Dimitris Troupis, Atmel's Specifications Engineer.

"Atmel's commitment to seeking Wi-Fi Protected Access certification for their products is an indicator that they are one of the Industry leaders. We have found that organizations that are committed to interoperable solutions, particularly for complex solutions like security, are also committed to serving the broad and evolving needs of their customers" stated Dennis Eaton, Chairman of the Wi-Fi Alliance.

Wi-Fi Alliance led an effort to bring strong and interoperable Wi-Fi security to market in the form of the Wi-Fi Protected Access certification program. Atmel is contributing to that effort by upgrading its family of products for WPA and by seeking certification for its solutions from the Wi-Fi Alliance.

New Dual-Output Laser Diode Driver ICs in Industry's Smallest Package

The world's smallest dual-output laser diode driver ICs for the next generation of combined DVD+/-R, DVD+/-RW and CD-R/RW end products is now available from Atmel. The new devices ATR0807 and ATR0808 extend Atmel's successful family of dual-output laser diode drivers. The ATR0807 and the ATR0808 are three-channel laser diode driver ICs with two selectable outputs. The two identical outputs can either be used for DVDor CD-RW laser diodes. Each of them supports currents up to 500 mA. Rise and fall times are lower than 0.8 ns. This allows the development of DVD/CD drives with write speeds of 4 to 8 times for DVD and up to 52 times for CD.

These are industry's first such products in extra-small

4 mm x 4 mm QFN16 packages for space-saving applications, which makes them the first choice for the new DVD+/-R/+/-RW and CD-R/RW super combo drives that integrate re-writeable DVD and CD drive in one device.

Due to their architecture, the ATR0807/ ATR0808 can also be used for all other applications supporting two different laser diodes. All current DVD standards like DVD-R, DVD+R, DVD+RW and DVD-RW are supported. The input impedance of the ATR0807 is 500 Ohm, whereas it is 200 Ohm for the ATR0808.

"With the introduction of the new ATR0807 and ATR0808 devices, Atmel confirms its leading position in the fast grow-

ing market of re-writable optical storage devices", Detlef Sommer, Atmel's DVD Marketing Manager, said. "Atmel's objective is to provide various solutions to meet the designers' different needs. Each of our laser driver family members is dedicated to a specific application requirement. The pincompatible ATR0807/ ATR0808 devices combine minimum package size, and maximum write speeds needed for today's innovative combo devices."

Samples of the ATR0807/ ATR0808 in QFN16 (4 mm x 4 mm x 0.9 mm) packages are available now. SSO16-pack- aged versions for low-cost HH drive applications, either Pb-

free or in legacy package, are also available.

ImageCraft Tools Include Pumpkin's Salvo tiny RTOS

Pumpkin's Salvo tiny RTOS is now available at no additional cost to all users of selected ImageCraft ICC development tools for AVR Designs. Instead of trying to integrate tools from various suppliers, today's embedded software developers are increasingly looking for pre-packaged development solutions. By combining the Salvo RTOS with the ICC IDE, Pumpkin and ImageCraft are providing the user-friendly tools

that programmers need to speed up development and get to market quickly.

Pumpkin president Dr. Andrew E. Kalman said "Salvo tiny combines the power of event-driven multitasking in an exceptionally small footprint with the proven

code base of Salvo LE and Pro. With Salvo tiny, ICC users can quickly create powerful multitasking applications without limits on the numbers of tasks and events." ImageCraft's Vice President Richard F. Man commented, "ImageCraft is committed to providing professional quality C development tools at low prices. Besides the base compiler tools, a user typically wants a debugger and an RTOS. We have carefully selected to partner with Pumpkin because the Salvo RTOS takes very few machine resources, and is suitable for many embedded applications. With the inclusion of Salvo tiny, ICC development tools continue the tradition of providing the best value in the embedded tools market."

"Moreover, good tools at low prices are no longer sufficient. ImageCraft understands the need for ease of use. For exam-

ple, making sense of each microcontroller's myriad configuration options can be daunting," noted Richard. "Our ICC development tools include Application Builders to simplify the process of setting up on-board peripherals. We created ICC's Salvo Configurator along the same lines. Just a few clicks will automatically configure the ICC project with the desired settings and features for any Salvo distribution."

Salvo tiny is initially available for ImageCraft's ICCAVR, ICC430 and ICC11. Salvo is available in Lite, tiny, SE, LE and Pro versions for various embedded targets. For free downloads, evaluations, information and to purchase Salvo LE or Pro, please visit Pumpkin or ImageCraft on-line at:

www.imagecraft.com

www.atmel.com

page 5

A T M E L A P P L I C A T I O N S J O U R N A L

Algorithm Builder for AVR

by Gennady Gromov, Tula Telecom

The most commonly used programming tools for AVR Microcontrollers are a C language compiler or assembler. Each approach has relative strengths and limitations. Assembly language programs typically produce smaller code size but there an overhead associated with programming in Assembly language. Issues associated with programming in Assembly are non-visual listing and redundant detailing. Therefore, software developed in assembly language is time consuming. Programmers demand more efficient tools. C language for the 8-bit AVR Microcontroller is gaining in popularity because of code maintainability, portability and programming speed. When C language is used, the programmer has a visual listing and is released from redundant detailing. This appreciably accelerates code development. There is a penalty associated with C Language programming: less efficient code. There is a solution the algorithm tool for the AVR. Algorithm builder fits between the Assembler and C compiler. Code is still written in Assembly but the improve graphical used interface development time can be reduced 3-5 X and code size reduced 2 to 3X. This provides benefits of both approaches Development time is similar to C language programming while code density is improved. This is a result of the graphical used interface, which allows use of flow charts and tree like branch structures. Additionally the instruction notation form was simplified and the mnemonics of the Assembler was changed to visual notation:

in place of:

use’s:

MOV R0,R1

R1

-> R0

LDI R20,$5E

$5E -> r20

ADD R0,R1

R0

+ R1

ANDI R20,25

R20 & 25

SBIW X,15

X + 15

LSR R7

R7

>>

SBI PortB,3

1 -> PortB.3

 

 

 

The large instructions set, such as MOV, LD, LDI, LDD, ST, STD, IN, OUT, CBI, SBI etc., are changed to only one notation: “ -> “. Using this notation is more convenient than mnemonics, and the operation matter is easy to understand, but the main in AB is a graphic interface. The main problem of classical assembler is limitations of the text editor. The written program is built as a continuous vertical line. The logical structure of program is hidden and can be built only in a programmer’s imagination or on a paper.

Any program can be divided into the some logical accomplished fragments. These fragments (blocks) are terminated by operations after which, the linear program execution is unambiguously ended. There are subroutine return (“RET”, “RETI”) and unconditional branches. Below is example of subprogram containing three such blocks:

Sub:

ldi

XL,$60

 

ldi

XH,$00

M0:

ld

r16,X

 

cpi

r16,1

 

breq M1

 

cpi

r16,2

 

brne M2

 

sbiw X,2

 

rjmp M0

M1:

sbi

PortC,0

 

cbi

PortC,1

 

ret

 

M2:

sbi

PortC,2

 

cbi

PortC,3

 

ret

 

The first block is begins from the “Sub” label and terminated by unconditional branch (‘rjmp”). The second and third blocks are begin from the “M1” and “M2” labels and terminate at the subroutine return operators (“ret”).

The “Algorithm Builder” allows visual segregation of these blocks and places them on a plane. In result, the logical structure of program becomes visual.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Sub

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$60

–> XL

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$00

–> XH

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[X]

 

–>

 

r16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r16

=

=

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r16

=

 

2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

– =

 

 

 

 

 

1

–>

 

PortC.

0

 

 

 

 

 

 

 

 

 

X

+

2

 

 

 

 

 

–>

 

PortC.

1

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ret

 

 

 

 

 

 

 

 

 

 

 

1

 

–>

PortC. 2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

–>

PortC. 3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ret

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The above subroutine example will be looked in the following way in AB: Five base elements are used in Algorithm Builder for the building of program construction. There are:

LABEL,

VERTEX,

FIELD,

CONDITIONAL BRANCH and

UNCONDITIONAL BRANCH.

The “LABEL” element is represented as a short vertical line in the block. Label can have an optional name at left or right side of the line. The label purpose is like to label purpose in a classical assembler. It is a marking of places in the program for the branches.

The image and purpose of “VERTEX” is similar to “LABEL”, but the vertex is always begins a block and determines this geometrical placing.

The “FIELD“ element is most used. It is represented by the in-block centered string. The “FIELD” is used for writing down the most operations of microcontroller except the branches.

The image of CONDITIONAL BRANCH is an oval with an entered branch condition and a vector as an outgoing line with an arrow at the end. The end of line should terminate at LABEL or VERTEX to which the branch will be carried out when the entered condition is fulfilled.

The image of UNCONDITIONAL BRANCH is an outgoing from the block axis line with an arrow at the end similar to CONDITIONAL BRANCH vector.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Sub

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$60

 

–> XL

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$

00 –> XH

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[X]

 

>

 

 

 

r16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r16

 

=

=

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r16

 

=

 

2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

=

 

 

 

 

 

 

 

 

1

>

 

PortC.

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X

 

+

2

 

 

 

0

>

 

PortC.

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

 

–>

PortC. 2

 

 

Ret

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

–>

PortC. 3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ret

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

www.atmel.com

page 6

A T M E L A P P L I C A T I O N S J O U R N A L

Vertex

Sub

 

$60

 

–> XL

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$00

–> XH

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Label

 

 

 

 

 

Field

 

 

 

[X]

–> r16

 

 

Conditional

 

 

branch

 

 

 

 

 

 

r16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

=

=

 

1

 

 

 

Vertex

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r16

 

 

=

 

 

2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

– =

 

 

 

 

1

–>

PortC. 0

 

 

 

 

 

X + 2

 

 

 

 

0

–>

PortC. 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ret

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Unconditional branch

 

1

 

–>

PortC. 2

 

 

 

 

 

0

 

–>

PortC. 3

Field

 

 

 

 

 

 

 

 

 

 

 

 

 

Ret

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Note the example of algorithm in AB contains only one label name: “Sub”, and the “M0”, “M1”, and “M2” names are absent. In the classical assembler the branch addressing is carried out by labels’ names. The use on multiple branch and label names result in a listing crammed with vast number of labels names which are inevitable ballast.

In AB the branches are defined graphically by vectors. Therefore the necessity of labels’ names is absent. This eliminates the names of subroutines’ entries only. In above example it is a “Sub”.

The editor allows the arbitrary placing of program blocks on a plane according to programmer’s design. For example, the above subroutine can be redesigned as below:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Sub

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$60

 

–> XL

 

 

 

 

 

 

 

 

 

 

 

 

$00 –> XH

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[X] –> r16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r16

= 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

=

=

 

2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

– =

 

 

 

 

 

 

 

 

 

 

 

1

>

 

PortC.

 

2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X + 2

 

 

 

 

 

 

 

 

 

0

>

Ret

PortC.

 

3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

–> PortC. 0

 

 

 

 

 

0

–> PortC. 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ret

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

In any case, the compilation result will be equal.

The editor allows ending a vector at segment of another vector, end of which is as shown below:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Sub

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$60 –> XL

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$00 –> XH

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[X] –> r16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r16

= 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

=

=

2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

=

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

>

 

PortC.

 

2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X + 2

 

 

 

 

 

 

 

 

 

0

>

 

PortC.

 

3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ret

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

–> PortC. 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

–> PortC. 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ret

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The AB environment is all-sufficient. It contains the editor, compiler, simulator (debugger) and in-circuit serial programmer of a chip. I.e. this tool covers the whole design cycle including programming of a chip. The Capability of the simulator are similar to AVR Studio. In-circuit programming is provided by connecting the chip directly to LPT without additional devices. But the manual contains the recommended scheme of optical isolator.

The opened simulator:

The programmer window:

The Algorithm Builder supports most of AVR chips

The using of AB is very simply. It can be recommended both for beginners and for professional programmers.

This article covers only base aspects of work in AB. This environment allows the design in macro-level with operating of multi-byte values with sign; it supports the special inclusions into the algorithm providing the convenient setting of peripheral components; and others.

You can find the Algorithm Builder on AVR freaks web page (http://www.avrfreaks.net/) and at: (http://home.tula.net/algrom/english.html/).

The additional possibilities of AB will be stated in a following article in the next issue.

www.atmel.com

page 7

A T M E L A P P L I C A T I O N S J O U R N A L

Foard Systems Design has developed a novel approach to networking- sensoring sensorand andcontrolcontrol devices in distributed systems, along with controllers, devices, and system configurations based on this new technologynew technology. .

Heterogeneous Device

Networking

by William Foard, Foard Systems Design, Inc.

Foard Systems Design has developed a novel approach to networking sensor

capabilities.

Serial EEPROM support is provided in non-micro devices to store

and control devices in distributed systems, along with controllers, devices, and

additional device information such as calibration data.

Multi-featured combi-

system configurations based on this new technology. The Atmel AVR family of

nation devices are also supported.

 

 

 

microcontrollers has played a central role in these designs, since AVR features

FGI network devices are connected to an FGI network controller through a

are ideally suited to the diverse demands of the application.

 

 

 

 

 

branched daisy chain topology, simplifying initial installation and future system

FGI Distributed Sensor and Control Network Technology

expansion.

Power, ground, and two signal

lines are

used to interconnect

The FGI networking technology provides an easy-to-use, effective, high relia-

devices.

 

 

 

 

 

 

 

 

 

bility, low power consumption, and low cost means for interconnecting a het-

With many device types requiring as little as 3 milliwatts per device, overall

erogeneous mix of remote sensor and control devices. Configurations with

system power requirements are held to a minimum, much simplifying large

thousands of devices can be practically implemented.

scale system implementation. The miserly power requirements result in small-

 

 

 

 

 

At its core, the FGI networking approach uses a modified 4-20 milliamp sig-

er network power supply and backup battery needs, with resulting smaller

space, heat

dissipation, and weight benefits.

Importantly, the low current

naling technique, where devices on the network are individually enabled to

requirements allow much smaller wires and connectors to be used for inter-

transmit on a common 4-20 ma signal line. Control signals superimposed on

connecting the remote devices, with resistive losses held to a minimum. For

the 4-20 ma line, plus a separate data transmit line are used to select device

devices such as temperature sensors, the low power also minimizes inaccura-

activation states and to send control data to the devices.

cies introduced by self-heating.

 

 

 

 

 

 

 

 

 

 

 

Simple devices are implemented with direct connection to the FGI networking

The FGI network controller communicates with a host computer or other con-

logic. For networking 4-20 ma sensor types, their output current is switched

troller via RS-232 or RS-485, with additional interface

options planned.

directly onto the FGI 4-20 ma signal line, and digitized at the controller. This

Support software is provided, including serial-to-TCP/IP bridge software.

maximizes network performance, since no packet protocol is needed for device

 

 

 

 

 

selection or data measurement. Similarly, simple digital devices such as switch

Atmel AVR Feature Use:

 

 

 

sensors are implementing by directly sending high-low current levels on the sig-

 

 

 

AVR Based Network Controllers

 

 

 

nal line. In combination with control data sent to the device, multiple input

 

 

 

The FGI network controller is based on an ATmega128.

This full-featured

and output devices can be implemented to directly support such features as

latched outputs, frequency sensing, rotary encoder inputs, and direct-scan LED

processor minimizes support components needed to implement the controller,

module outputs.

This provides remote access to temperature sensors, digital

reducing size, increasing reliability, improving manufacturability, and minimiz-

potentiometers, video switch matrices, and many other commonly available

ing cost.

 

 

 

 

components. More complex functionality, such as motor control, benefits from

The FGI network uses 4-20 ma signaling from the remote devices. The AVR’s

incorporating device level microprocessors.

The FGI interface provides excel-

lent microprocessor support. Devices can implement master-slave communi-

internal 10-bit A/D is used to digitize analog 4-20 ma measurements, maxi-

cations, keeping the microprocessor size, cost, and power

 

 

 

 

 

 

requirements to a minimum. Alternatively, devices can

 

 

 

 

 

 

implement peer-to-peer communications for more imme-

 

 

 

 

 

 

diate performance, with the FGI networking chip provid-

 

 

 

 

 

 

ing most of the packet collision avoidance functionality.

 

 

 

 

 

 

Master-slave, peer-to-peer, and non-microprocessor ana-

 

 

 

 

 

 

log and digital devices can all be intermixed on the same

 

 

 

 

 

 

network.

 

 

 

 

 

 

 

 

 

Additional support for AVR microprocessors provided by

 

 

 

 

 

 

the FGI networking design includes a means to remotely

 

 

 

 

 

 

reprogram the device microprocessors via the network

 

 

 

 

 

 

through the SPI interface, without the need for or the

 

 

 

 

 

 

overhead costs of any self-programming support hard-

 

 

 

 

 

 

ware or software in the device. Single point remote pro-

 

 

 

 

 

 

gramming can deliver feature enhancements, bug fixes,

 

 

 

 

 

 

support for new attached hardware, customization fea-

 

 

 

 

 

 

tures, and temporary diagnostic software.

 

 

 

 

 

 

 

 

The FGI interface logic also provides plug-and-play style

 

 

 

 

 

 

 

 

 

 

 

 

self-configuration

and built-in network

self-diagnostic

 

 

FGI Controllers

 

 

 

 

 

 

 

 

 

 

 

 

 

www.atmel.com

page 8

Соседние файлы в предмете Электротехника