Tuesday, 29 December 2015

FPGA's for The Internet of Things

" Billions of devices are expected to be connected wirelessly by 2020. In this emerging era of connected devices, machines need not only be secure but also need to be secure at device, design and system levels. "


Billions of devices are expected to be connected wirelessly by 2020. In this emerging era of connected devices, machines need not only be secure but also need to be secure at device, design and system levels. The Internet of Things (IoT) requires diverse technology and specialised skill areas such as specialised hardware and sensor development, along with sophisticated real-time embedded firmware, cloud applications and Big Data analytics for massive real-time data into usable information, delivery of data to human-scale and human-usable platforms, particularly sophisticated smartphone apps. The IoT is revealing an important need in technology, that is, programmable hardware and I/O.
The IoT will soon be driven by field-programmable gate array (FPGA)-like devices, because these devices can interface with the outside world very easily and provide lowest power, lowest latency and best determinism. The IoT would interface with temperature, pressure, position, acceleration, analogue-to-digital converters (ADCs), digital-to-analogue converters (DACs), current and voltage, among others. Arduino and Raspberry Pi could also be used.
An FPGA can be considered a programmable special-purpose processor as it can handle signals at its input pins, process these and drive signals on its output pins.
The above system is very deterministic. An FPGA can interact with memory and storage devices through serialiser/deserialiser interfaces (SERDES), which also allow for Ethernet, serial or Bluetooth communication. An FPGA can, for example, take an HTTP request packet received from a wireless Ethernet component, decode its request, fetch information from memory and return the requested result back through the Ethernet device.
The FPGA could be coupled with an ARM processor to leverage higher-level software functions such as Web servers or security packages, if higher level of processing is required. The key consideration is the programmable aspect of an FPGA. In a typical development cycle, a supplier development kit is employed to configure the FPGA, while a printed circuit board (PCB) is developed with specific sensor/communication/display components, as required.

The IoT challenges

The IoT challenges include security, privacy, unauthorised access, malicious control and denial of service. A hardware-first approach with respect to security and implementation of necessary functionality on the systems on chip (SoC) level is vital for fully securing devices and platforms such as FPGAs, wearables, smartphones, tablets and other intelligent appliances.
In practice, the hardware-based platform offers a single user interface (UI) across factory locations, real-time visibility into operations and remote, cloud based feature activation. IoT devices also have long life spans, yet manufacturers are likely to stop developing and rolling out patches for a product once it reaches obsolescence. For these reasons, IoT devices should leverage hardware based security and isolation mechanisms that offer robust protection against various forms of attack.
The outside layer of this network comprises physical devices that touch, or almost touch, the real world, such as sensors (optical, thermal, mechanical and others) that measure the physical states of houses, machines or people.
There are some complete control systems such as thermostats, smartappliances or drone helicopters. The presence of these complex devices introduces an encounter with the IoT in the form of sensors and actuators, or complete systems.
Consider the thermostat at home. When we add an interface to it so that a mobile app can read the temperature, check for failures and change the set-point, it works automatically. This approach wants to, whenever possible, move control onto the Internet, and ideally onto a computing cloud and scatter tiny, inexpensive sensors everywhere. Here, we eliminate the thermostat altogether and, instead, put temperature sensors around the house, inside and out. And while we are at it, we pull the controller boards out of the furnace and air-conditioner, connect their inputs and outputs to the Internet as well, so a cloud application can directly read their states and control their sub-systems.
In general, these wireless interfaces match the characteristics such as low power and the ability to sleep at very low quiescent current, long periods of sleep and short bursts of activity. But the interfaces bring with them baggage, too. These are mutually-incompatible, have a short range and use simplified, non-Internet protocol (IP) packet formats. These characteristics necessitate a new kind of device to intermediate between the capillary network and the next layer of the IoT, that is, a local IoT concentrator.

The concentrator serves as a hub for short-range radio frequency (RF) links in its immediate vicinity, manages the link interfaces and exchanges data with these. Because these concentrators are unlikely to have any direct connection to an Internet-access router, these will generally use Wi-Fi or Long Term Evolution (LTE) as a backhaul network, which then becomes the second layer of the IoT. It is the job of the hub, then, to perform routine work of a network bridge as well as packing and unpacking, shaping traffic and translating between headers used in short-range RF packets and headers necessary for backhaul networks.

Future trends

In future, we can expect vehicles with an increasing amount of autonomous capabilities to navigate roads and highways, and interact with each other, their owners and the IoT. Intelligent cars and smartgrids are just the beginning of a changing ecosystem, where devices, systems and platforms that were previously disconnected will become online.
Ultimately, integration of various IoT devices and platforms will lead to the proliferation of smartcities across the globe, riding on the new digital infrastructure enabled by ubiquitous connectivity and the ever-increasing bandwidth. Thus, it is important to realise that, just because a system is embedded, it does not mean it is secure or will remain so, indefinitely.
Therefore security must be perceived as hardware rather than software patches, with chip makers routinely forced to contend with a wide range of potentially serious threats including data breaches, counterfeit components and intellectual property (IP) theft. Apart from ensuring fundamental chip security during manufacturing, embedding the right security intellectual property (IP) core into an SoC can help manufacturers design devices, platforms and systems that remain secure throughout their respective lifecycles.
Hardware-enabled examples include device provisioning, subscription management, secure payments, authorisation and return merchandise authorisation (RMA)/test support. Embedded SoC security can provide a critical root of trust, managing sensitive keys for secure boot, service authentication and key management. The SoC security core can regulate debug modes to thwart reverse engineering, while providing chip authentication to prevent counterfeiting. SoC based security can also manage one-time programming of on-chip resources.
COURTESY:V.P. Sampath , active member of IEEE and Institution of Engineers India. He is a regular contributor to national newspapers, IEEE-MAS section and has published international papers on VLSI and networks




Flexible Transistors

Flexible transistors could revolutionise the medical and consumer electronics industry, and have a look at some of the interesting applications being prototyped

The wearable electronics industry will soon be booming, according to many technology analysts. But the rigidity of the circuitry that goes inside the gadget has always been a limiting factor for developing devices that can be worn longer without discomfort.

Traditional TFT
Conventional thin-film transistors (TFTs) are rigid components made from inorganic materials such silicon and silicon-based compounds. But, the rigid nature of transistors has been hindering the development of wearables as it does not offer flexibility, consumes high power and causes general discomfort. The manufacturing is also costly because it requires a clean environment, high temperature, and complex, expensive steps of processing.


How organic TFT helps
An organic thin-film transistor (OTFT) uses organic semiconductors in its channel and is preferred in display systems due to its brightness, fast response time, vivid colours and ease of reading in ambient light. These are cheaper, more flexible, cheap and low-maintenance. Moreover, their electronic, chemical, optical and structural properties can be characterised to ease their processing; this can be utilised to coat them on a variety of surfaces, including soft substrates at relatively low temperatures.

Solving carrier mobility and strain effects
Thought OTFTs are relatively cheaper, their carrier mobility (the ease with which an electron can move inside a conductor or semiconductor under the influence of an electric field) is less. This would lead to sluggish response time, affecting the animation or video being displayed. It has been found out that the carrier mobility is influenced by crystallinity and the molecular arrangement in a crystal lattice. Researchers at the University of Nebraska-Lincoln, Stanford University, SLAC National Accelerator Laboratory and Oak Ridge National Laboratory have jointly come up with an off-centre spin-coating method that significantly boosts the carrier mobility of organic crystals.

Another challenge faced by scientists was to understand how the bending of the transistor would affect its performance as mechanical deformation could affect the electrical properties of the transistor, and several studies were being done in this area. A series of experiments by the University of Massachusetts, Amherst, has shown that such mechanical deformations decrease the performance of an OTFT only under certain conditions, and in other instances it either has no effect or enhances the performance of the TFT. They also propose a plate bending theory-based model to quantify the possible strains on the transistor due to deformations, and this would prove helpful for the development of better flexible devices.



Newspaper – Hogwarts style
OTFT technology would aid diverse applications. As already mentioned, they allow the fabrication of displays on flexible surfaces, unlike traditional TFT screens. One could give an OTFT coating to a flexible plastic sheet and it can be turned into a display whose content can be animated or varied periodically. By stacking a few such sheets you could make your own Daily Prophet newspaper, just like the ones in the Harry Potter series! Or you could have the Spider Man in a comic book move around the pages and speak the dialogues. Another possibility is an electronic tattoo to monitor your vital signs, which can be stuck to or removed from your skin just like a temporary tattoo.
Wow, OTFT surely offers myriad interesting possibilities, particularly in the consumer electronics, entertainment and medical fields. Lots to look forward to! 


COURTESY : EFY

Tuesday, 1 December 2015

Li Fi - Light Fidelity

Li Fi post 2

After success of wireless data transmission technology Wi-Fi, scientists are coming with a new age technology ‪#‎Li_Fi‬.

'#Li_Fi' is a lot faster than what we are currently getting from Wi-Fi. In Lab conditions, researchers claimed to achieve the speeds of 224 gigabits per second by testing #Li_Fi technology.
Researchers believe that #Li_Fi is capable of sending data up to 1GB per second which is 100 times quicker than average Wi-Fi networks.












Thursday, 26 November 2015

5 Free eBooks On Analog Circuits Designing


Learn to design and program your own circuits with there free ebooks. Happy reading!





1. Analog Integrated Circuit Design

Author/s: Tony Chan, Carusone David A. Johns, Kenneth W. Martin

Publisher: Wiley

This book strives to quash the notion that the design and test of high-performance analog circuits are “mys-tical arts.” Whereas digital design is relatively systematic, analog design appears to be much more based uponintuition and experience.

2. Analog Circuits

Author/s: Yuping Wu

Publisher: InTech

The invariable motif for analog design is to explore the new circuit topologies, architectures and CAD technologies to overcome the design challenges coming from the new applications and new fabrication technologies. In this book, a new architecture for a SAR ADC is proposed to eliminate the process mismatches and minimize the errors. A collection of DG-MOSFET based analog/RFICs present the excellent performance; the automated system for a passive filter circuits design is presented with the local searching engaging; interval analysis is used to solve some problems for linear and nonlinear analog circuits and a symbolic method is proposed to solve the testability problem.

3. CMOS Circuit Design, Layout, and Simulation (3rd Edition)

Author/s: Phillip E. Allen, Douglas R. Holberg

Publisher: Oxford

The Third Edition of the book covers the practical design of both analog and digital integrated circuits, offering a vital, contemporary view of a wide range of analog/digital circuit blocks including: phase-locked-loops, delta-sigma sensing circuits, voltage/current references, op-amps, the design of data converters, and much more. Regardless of one's integrated circuit (IC) design skill level, this book allows readers to experience both the theory behind, and the hands-on implementation of, complementary metal oxide semiconductor (CMOS) IC design via detailed derivations, discussions, and hundreds of design, layout, and simulation examples.


4. Analog Integrated Circuits for Communication: Principles, Simulation and Design

Author/s: Donald O. Pederson, Kartikeya Mayaram

Publisher: Springer

Analog Integrated Circuits for Communication: Principles, Simulation and Design, Second Edition covers the analysis and design of nonlinear analog integrated circuits that form the basis of present-day communication systems. Both bipolar and MOS transistor circuits are analyzed and several numerical examples are used to illustrate the analysis and design techniques developed in this book. Especially unique to this work is the tight coupling between the first-order circuit analysis and circuit simulation results. Extensive use has been made of the public domain circuit simulator Spice, to verify the results of first-order analyses, and for detailed simulations with complex device models.

5. Analysis and Design of Analog Integrated Circuits

Author/s: Paul R. Gray, Paul J. Hurst, Stephen H. Lewis, Robert G. Meyer

Publisher: Wiley

This is the only comprehensive book in the market for engineers that covers the design of CMOS and bipolar analog integrated circuits. The fifth edition retains its completeness and updates the coverage of bipolar and CMOS circuits.

A thorough analysis of a new low-voltage bipolar operational amplifier has been added to Chapters 6, 7, 9, and 11. Chapter 12 has been updated to include a fully differential folded cascode operational amplifier example. With its streamlined and up-to-date coverage, more engineers will turn to this resource to explore key concepts in the field.

COURTSY : EFY

10 Technologies To Be Thankful For

From wearables and 3D printing to smart home innovations and intelligent transportation, the 2015 tech market has given us lots to be thankful for. To kick off Thanksgiving in the US, we’ve pulled together a top 10 list of gadgets and technologies from the past year that have, or will have, a positive impact on humanity.

  1. Supercomputers: Supercomputers have helped us make some great strides in healthcare. For example, teams from UC Berkeley and the University of California San Diego used the supercomputing resources of the National Energy Research Scientific Computing Center to simulate how ultrasounds and tiny bubbles injected into the bloodstream might break up blood clots, limiting the damage caused by a stroke in its first hours.
  2. 3D Printing: 3D printing isn’t just millennial makers. In fact, its applications are very promising and ever-evolving across many industries, including healthcare, education, and even fashion. Imagine how much more fun science and math might have been in high school way back when had the charts, graphs and models been 3D printed.
  3. Intelligent Transportation: Google is not the only name in the driverless car game. In fact, automakers including Audi, BMW and Volvo have all tossed their hats in the ring to create intelligent transportation solutions, and the ante was upped even more when Apple followed suit.
  4. Smart Home Appliances: The smart home landscape continues to take off, with new products emerging often. While lighting remains the gateway product, the possibilities extend to securing and operating every room and appliance in the house.
  5. Biometric Authentication: You don’t have to work in finance to know that money is complex, and so securing it goes well beyond a typical text-based password. Biometric authentication for mobile payments will continue to diversify beyond fingerprints to things like facial recognition, and innovations will continue to be a result of partnerships, like the one between Accenture and Visa.
  6. Augmented Reality/Virtual Reality (AR/VR): Twenty-first century medicine is far from traditional — everything is laced with technology. AR/VR has offered healthcare professionals alternative options for surgical training, therapy, and even stroke rehabilitation.
  7. Artificial Intelligence: Robotics have come a long way since Rosie, the Jetson’s maid. AI has made its mark on education by offering students an opportunity to think critically and creatively in an interactive environment. It has also made an impact in medicine, where nanorobots are used for surgical procedures, search and safety, and food safety.
  8. Wearables: Fitness trackers kicked off the wearable fad, but they only scratch the surface of possibility with wearables. The landscape continues to evolve as consumers grow more comfortable interacting with technology that’s less visible. The technology will grow more sophisticated as more data is collected about the user experience across devices.
  9. Application-Powered Technology: As tech innovations become more and more invisible, apps to power them become more necessary. Wearables and other IoT devices almost all have companion apps that serve as the main command center, so that if for some reason a rule or setting fails, there’s a main dashboard to update or reset functionality.
  10. Data Storage Solutions: Devices aren’t the only technology pressured to change over time. As more devices emerge that collect information, data storage solutions must also change and adapt. We’ve evolved past paper punch cardswith cloud systems dominating the market, housing more than one exabyte (about one quintillion bytes) of data.
courrtsy: IEEE Spectrum TM



Thursday, 15 October 2015

MIT's 3-D Microwave Camera Can See Through Walls

See Through Walls - MIT's 3-D Microwave Camera Can See Through Walls

Image: Camera Culture Group/MIT Media Lab
Microwaves propagating across a metal peacock ornament are visualized as a color-coded temporal sequence
Visible light is all well and good for things like eyeballs, but here at IEEE, we do our best to cover the entire spectrum. As always, we’re especially interested in anything that confers superhero-like abilities, like X-ray vision, or in this case, M-wave vision, which sounds even more futuristic. At MIT, they’ve been working on a prototype for a time of flight microwave camerawhich can be used to image objects through walls, in 3-D.
A microwave camera is sort of like a cross between a visible light camera and a radar imaging system, incorporating some of the advantages of each. Like radar, microwaves don’t really notice things like darkness or fog or walls, but unlike radar they’re not confused by the kinds of angled surfaces that make the stealth fighter so stealthy. Radar systems also tend to be big, complex, low resolution, and expensive. By taking a more camera-like approach to radio frequency imaging, essentially treating microwaves like waves of light and using a passive reflector like a lens, MIT has been able to leverage computational-imaging techniques to develop a low cost, high resolution imaging system.
MIT’s microwave camera can do 3-D imaging using time of flight, in the same way that Microsoft’s latest Xbox Kinect sensor works. The time of flight camera sends out bursts of microwaves and then keeps careful track of how long it takes for the microwaves to bounce off of something and return to the sensor. After doing some not very fancy math with the speed of light, you can then calculate how far away that something is. MIT’s camera has a temporal resolution of 200 picoseconds, allowing it to resolve distances with an accuracy of 6 cm, enough for usable 3-D imaging.
Here's a video showing the microwave camera taking pictures of (among other things) a mannequin through a solid wall:



 ,
If the mannequin in the video looks suspiciously like it's covered in aluminum foil, that’s almost certainly because it is, in fact, covered in aluminum foil. Doing this actually makes the mannequin more human like: we’re very good at reflecting microwaves in this frequency range because we’re ugly bags of mostly water, and covering the plastic mannequin in tin foil makes it a close approximation to the real thing. You can see the resolved 3-D image at the tail end of the video, and at 41 x 41 pixels, it’s sufficient resolution “to [be] able to see how many limbs a person has,” according to MIT. You know, just in case whatever is on the other side of the wall has extra limbs, which means you probably don’t want to enter that room.


( Li - Fi ) - Light Fidelity

What if every light bulb in the world could transmit data? Harald Haas, the pioneer behind this new type of light bulb, believes Light-Fidelity (Li-Fi) will be able to supplement Wi-Fi in the near future.

As LEDs become a more common source for room lighting, they're opening a new pathway for linking mobile devices to the Internet, with the potential for wider bandwidth and quicker response time than Wi-Fi. At least that???s what researchers such as Harald Haas, chair of mobile communications at the University of Edinburgh, are hoping.

As LEDs become a more common source for room lighting, they're opening a new pathway for linking mobile devices to the Internet, with the potential for wider bandwidth and quicker response time than Wi-Fi, At least that's what researchers such as Harald Haas, chair of mobile communications at the University of Edinburgh, are hoping.
“All the components, all the mechanisms exist already,” Haas says. “You just have to put them together and make them work.”
Haas's group, along with researchers from the Universities of Cambridge, Oxford, St. Andrews, and Strathclyde, are halfway through a four-year, £5.8 million project funded by the Engineering and Physical Sciences Research Council, in the United Kingdom. They are pursuing ultraparallel visible light communication, which would use multiple colors of light to provide high-bandwidth linkages over distances of a few meters.
Such a Li-Fi system, as it's been dubbed, could supplement or in some instances replace traditional radio-based Wi-Fi, they say. But taking on such a broadly used radio technology is an uphill battle.
At the IEEE Photonics Conference in October, members of the consortium showed off the progress they're making. For instance, the team has used commercially available red, green, and blue LEDs as both emitters and as photodiodes to detect light. By doing that, they created a system that could both send and receive data at aggregate rates of 110 megabits per second. When transmitting in one direction only, they reached a rate of 155 Mb/s.
But Haas says that this version is limited by existing LEDs, and by the use of LEDs as transmitters and detectors at the same time. Members of the consortium, however, have created a better LED, which provides a data rate close to 4 gigabits per second operating on just 5 milliwatts of optical output power and using high-bandwidth photo diodes at the receiver. With a simple lens to enhance the distance, they can send data 10 meters at up to 1.1 Gb/s, and soon they will increase that to 15 Gb/s, Haas says.

LIGHT FANTASTIC: A CMOS digital-to-analog converter developed at the University of Edinburgh helps LEDs act as communications devices.
The 802.11ad Wi-Fi standard for the 60-gigahertz radio band reaches just under 7 Gb/s, so Li-Fi would more than double that rate.
They're also using avalanche photodiodes to make better receivers. In an avalanche photodiode, a single photon striking the receiver produces a cascade of electrons, amplifying the signal. Haas's team at the Li-Fi R&D Centre has created the first receiver chip for Li-Fi with integrated avalanche photodiodes on CMOS. The 7.8-square-millimeter IC houses 49 photodiodes.
Separately, the Fraunhofer Institute for Photonic Microsystems, in Dresden, Germany, had announced plans to demonstrate a Li-Fi hot spot in November (after press time) at the Electronica 2014 trade show in Munich. Frank Diecke, who leads the team developing Li-Fi at Fraunhofer, says that the system would most likely use infrared light and is aimed at industrial users rather than consumers. The hot spot was set to be a point-to-point link with a data rate of up to 1 Gb/s.
“You can have more or less the same data rate as over a USB cable,” Diecke says. “That's very challenging for most wireless technologies, like Wi-Fi and Bluetooth.” Another advantage, says Diecke, is that the latency of Wi-Fi-the time between when a signal is sent and when it's received-is measured in milli-seconds, whereas Li-Fi's latency is on the order of microseconds. In industrial applications, where data has to flow between sensors, actuators, and a control unit, low latency and high data rates would make Li-Fi useful in places where Wi-Fi is not. “We don't want to replace Wi-Fi,” he says. “That's not our goal.”
But Diecke says Li-Fi could complement existing communications technologies, including Wi-Fi and gigabit Ethernet. For now, his group is not focusing on combining it with general lighting, as Haas proposes.
A group of European academic researchers and networking companies is aiming for the consumer market, though. The group is working on a project called Advanced Convergent and Easily Manageable Innovative Network Design (ACEMIND) to develop ways to manage local networks in homes and small businesses. ACEMIND includes a number of demonstrator projects to test different technologies, including Li-Fi. Dmitris Katsianis at the University of Athens, who is a participant in ACEMIND, thinks Li-Fi might be in practical use within the next five years. “Li-Fi has the advantage of being useful in electromagnetically sensitive areas such as in hospitals, aircraft cabins, and power plants,” he says.
Haas is counting on a much bigger market. He expects LEDs to evolve past just being light sources, much the same way the cellphone evolved from a communications device to a mobile computer. “In 25 years, every lightbulb in your house will have the processing power of your cellphone today,” he says. “It will in the future serve illumination as just one of many purposes.”
courtsy: IEEE 


Monday, 12 October 2015

USING AVR MICROCONTROLLERS FOR PROJECTS

K. Padmanabhan, P. Swaminathan & S. Ananthi

The AVR 8535 microcontroller and its new version ATmega8535 are versatile, high-performance but low-cost chips. This article series covers typical applications of this processor illustrating its power and cost-effectiveness in an embedded system.

The AVR family comprises several chips, all with almost the same instruction set. Of them, the 90S8515, 90S8535 and ATmega8535 chips are low-cost and readily available with the complete set of port pins. The ATmega8535-16 is more powerful and available for around Rs 250. Capable of running at 16 MHz and achieving almost 16 million instructions per second (MIPS), it is one of the fastest devices available in the market today.

Using ATmega8535, you can build a microcontroller-based project with following features:
1. Four ports, of which one of them has eight analogue-to-digital converter (ADC) channels
2. ADC conversion time is as little as 60 microseconds. Imagine adding an external ADC to 8051 or any other microcontroller chip—that would have taken the cost to over four digits. And mind you, it is a 10-bit ADC, not just 8-bit.
3. If an 8MHz crystal is connected, each instruction executes in 1/8th of a microsecond. The 89C51 at 12MHz clock had its internal division by twelve, so it ran at just one microsecond. Thus, ATmega8535 chip is eight times faster with an 8MHz crystal. However, you can also use a higher-frequency crystal. The chip is basically a RISC processor that executes most instructions in one clock cycle itself.
4. The chip has RS-232 transmit and receive terminals much like the 8051 family, but it can support even higher baud rates.
5. It has quite a few internal registers, RAM, EEPROM and CODE memory (flash memory in excess of 4kB).
6. The instruction set is versatile, complete with several arithmetic, logic and transfer instructions and related jump instructions, etc.
7. An analogue comparator pin, which can compare an external analogue voltage and take control action.
8. Reset is possible through the software, and a watchdog is provided. Power-down or sleep modes are available.
9. An additional serial interface, known as the SPI bus, with three wires: data (2) and clock (1). These pins can be used for programming or loading the code from a PC through the printer port or serial port. For programming the internal flash memory locations, just 5V supply is enough.
10. Two PWM output pins, which are useful for power control applications.
11. Several timers as in other members of the 8051 family, but with much better time resolution.
12. Additional features like input capture and output compare.

Here, we shall delve into the chip’s operations with typical programs and circuits. All the development tools including ‘C’ compiler are available for free from the Internet.

The features of ATmega8535 make it the right candidate for various embedded control applications. Even a digital filter can be implemented on the device, provided you are fully conversant with its hardware and software features. You can download the databook of ATmega8535 from the ‘ATMEL.com’ Website to understand its features and work out simple applications.

The sample programs given here can be used to yield a powerful controller for many applications like a filter or motor controller.

Programming the chip
The AVR source code file with ‘.asm’ extension can be written using either the EDIT, Wordpad or notebook programs.

As with all microprocessor or microcontroller programs, for the source code, one has to enter the program by mnemonics and assembler directives and then convert the same into a code list for the program. (Directives are assembler commands used to control the input, output and data allocation of the assembler. These are, however, not translated into op-codes directly.) This is done using the cross-assembler software ‘avrasm.exe.’



To describe the modus of writing of an Assembly language program, a simple program (LED.ASM) for AVR processors is given below:



This program helps you understand:
1. Access to the output port (here port B, where LEDs are connected)
2. The different parts of a typical assembler program
3. Different conventions like use of semicolon, upper-/lower-case letters, etc

Explanatory notes for LED.ASM
1. In Assembly language, all the text on a line after a semicolon (;) is treated by the cross-assembler as comments and it does not use it for code formation.

2. Including the m8535def.inc processor-specific file in Assembly program means all the I/O register names, I/O register bit names, etc appearing in the datasheet can be used. Failure to include this file may result in a number of error messages. Ensure that this file is placed in the same directory as your source code file (LED.asm in this case). Else, give complete path for the m8535def.inc file.

3. Following conventions havebeen used in the program:
(a) Words in upper-case letters are used for command directive words of the Assembly language or predefined ports of the processor.
(b) Mnemonic words are written in lower case.

4. LIST directive turns on the listing output if it had been previously turned off. Similarly, NOLIST directive, if used, will turn off the listing output.

5. DEF directive is used to define a text-substitution label for a string. A label/name is easy to remember. Here, register R16 is replaced with ‘mp’ name. Thus whenever ‘mp’ is encountered in the source code, it will be automatically replaced with ‘R16.’



6. ‘.org $0000’ defines the reset address. When power is switched on, the program starts from this location. A restart from the reset address can be activated by resetting the respective hardware pin of the chip (pin 9) or upon watchdog timer reaching its zero count. A relative jump command (rjump) at this reset location directs the program execution to label (main)—as long as the label is within 2k locations from the reset address (0000). Incidentally, ‘rjmp main’ is the first code-generating instruction. 

7. It is essential to set up the stack pointer before being able to call any subroutine, since stack is required for saving the return address, where the next program execution is to start from. The program lines starting with ‘ldi R16,low(RAMEND)’ and ending with ‘out SPH, R16’ do just that.

8. The ‘ldi mp, 0b11111111’ and ‘out DDRB, mp’ lines set port-B pins as the output. The first line, interpreted as ‘load immediate (ldi) into register ‘mp’’, loads binary value ‘11111111’ into the ‘mp’ register. The second line transfers the contents of ‘mp’ (11111111) to the data direction register of port B (DDRB). DDRB is already defined in the m8535def.inc file. (If you want to set port-B pins as input, load binary ‘00000000’ into ‘mp’ and output it to DDRB.) Incidentally, ‘0b’ precedes a binary number. Similarly ‘0x’ precedes a hex number. Numbers without these prefixes denote decimal numbers by default. Hence you may replace ‘0b11111111’ with either ‘0xFF’ or simply ‘255’ to achieve the same results. 


9. The rest of the program starting at label ‘loop:’ and ending with ‘rjmp loop’ achieves switching on and off of the LEDs with a delay. The delay subroutine starting at label ‘delay:’ and ending with return instruction ‘ret’ is called from within the loop.

Initially, ‘mp’ is loaded with hex value ‘00’ and output through port-B pins, making them low. Since the cathodes of all the eight LEDs are connected to these port pins via current-limiting resistors, the LEDs light up. Thereafter, the delay subroutine (Rcall delay) is called and ‘mp’ is loaded with hex value ‘FF’ and transferred to the port-B output to turn off the LEDs. The loop is repeated as long as the power is switched on.

10. The internal R-C clock of ATmega8535 is 1 MHz by default. In the absence of ‘Rcall delay’ instruction, each of ‘ldi’ and ‘out’ instructions requires 1000 ns, while ‘rjmp’ instruction requires 2000 ns. Thus loop execution would take 4000 ns. This amounts to LED switching rate of 250 kHz.

Introduction of delay between switching on and off reduces this frequency to around 0.5 Hz by decrementing registers ‘r19’ and ‘r17’ from ‘255’ to ‘0,’ thereby making the elapsed time slower by 256×256 (which works out to around 0.5Hz rate).

After assembling the LED.asm source file, the program will have eight words. The LED.LST file stores the result of the assembly process in the form of a listing.

Once a program has been written using any editor, wordpad or notepad, it is assembled using the avrasm.exe AVR assembler, which is included in this month’s EFY-CD. Of course, the AVRSTUDIO 4.0 integrated development environment (IDE) is more versatile and user-friendly software for development, but the avrasm.exe assembler is simpler and direct.

Simply typing ‘avrasm -i LED.asm LED.lst LED.hex’ under the DOS prompt makes the cross-assembler generate code for the LED.hex file and also provide a text file giving both the code and the program together in LED.lst. Thus, you get the LED.lst listing file and the LED.hex Intel hex code file.


http://www.electronicsforu.com/electronicsforu/circuitarchives/my_documents/my_files/2A2_Figures.zip
Alternatively, you can prepare a batch file as follows:
Upon DOS prompt, enter ‘copy con avr.bat.’ In the following line, type ‘Avrasm -i %1.asm %1.lst %1.hex.’ Pressing ‘F6’ key in the following line displays ‘Control-Z.’ Now pressing the ‘Enter’ key displays “1 file copied.”

Now the avr.bat file has been prepared. This simple batch file is invoked to assemble this (or any) program by typing ‘Avr LED’ upon the DOS prompt and pressing the ‘Enter’ key.

This assembles the program, and forms both the list file (that contains the code-cum-Assembly listing) and the hex file (the actual Intel-format hex file for use by the programmer).

Likewise, any other assembly program ‘xxx.asm’ can be coded into the hex file by simply typing ‘avr xxx’ on DOS prompt. ‘xxx’ denotes the name of the program. The ‘.asm’ is not to be typed.

In our LED.asm program, we have included the m8535def.inc file. This file is required along with the avrasm.exe cross-assembler. For other AVR processors like 90S8515, 90S8535 and at-Tiny 26, the files to be included are 8515def.inc, 8535def.inc and tn26def.inc, respectively.

The next task is to burn the code into the chip. Note that a chip previously programmed or erased is automatically erased when a new program is burnt into it using the device programmer as described below.

The AVR device programmer
The AT-PROG programmer software is used for programming ATmega8535. This menu-drive programming software is simple to use and invoked from command prompt.

The software uses a simple pod connected to the printer port of a computer. The circuit of the pod (shown in Fig. 3) is very simple. It just connects the IC to be programmed to the pins of the PC’s printer port.

This circuit is assembled on a small PCB with a D25 male-female plug at one end. The IC base is a 40-pin zero-insertion-force socket (ZIF). This enables easy insertion and removal of the IC to be programmed.

The AT_PROG.exe is a simple programming software that can be run under DOS prompt by typing AT-PROG. The files At-prog-hlp.htm, At-prog.exe, At-prog.cfg and At-prog.ini should be placed in one directory before running the AT-PROG. These files have been included in this month’s EFY-CD as part of this article.

The menu-driven window of the AT-PROG programmer has the following menu items:
1. File menu. This menu is used to select or open the LED.hex file, or whatever, which is to be programmed into the device.

Pull down the menu by clicking it. Under ‘Open’ option, enter the file name as ‘LED.hex’ and press ‘Enter.’ The IC to be programmed is selected from the AVR-Programmer window by clicking the edge of the small rectangular window and choosing the IC as shown in Fig. 4. Now connect the printer-port connector to the programming pod, whose circuit is shown in Fig. 3.
2. Write menu. On clicking the ‘Write’ menu, the ‘Activity’ window at the bottom whitens and shows ‘Connecting’  (refer Fig. 5). Then, the data is transferred to the IC and verified after programming, showing ‘ok’ in the same window.
3. Check menu. This menu is used to find out whether the IC is inserted in the socket and whether the connector connections are okay. It will indicate an error if the IC is not there or not responding.

In this mode of programming, the serial-peripheral interface (SPI) of the AVR chip is used. This interface has three wire connections:
(i) Master output and slave input (MOSI)
(ii) Master input and slave output (MISO)
(iii) Serial clock (SCLK)

Using these wires, the SPI interface does the serial transfer of data (i.e., our program codes) into the chip, which is configured as a slave. The data and clock are connected via MOSI and SCLK pins of the chip, respectively. Upon reception of each byte, the chip acknowledges it by sending a byte (53hex).

In ‘Check’ mode, the IC is enquired about its name by the computer (Master), which it replies with its signature code embedded in the chip memory by the manufacturer. Each IC has its specific signature code. Thus, by noting the code itself, what IC is being programmed will be known to the computer. So the small window under the device-select rectangular window can be clicked to show ‘autodetect’ the IC.
4. Options menu. In this menu, the speed of the clock used for transferring data from the computer can be selected as ‘slow,’ ‘normal’ or ‘fast.’ With present high-speed PCs, choose ‘normal’ or ‘slow.’ In the same menu, the ‘read signature bytes’ option is to be enabled and it is so by default.
5. Port menu. The port menu, which is next to the file menu, is useful if a different printer port is available. The program automatically selects the available printer port.

When the ‘Activity’ window shows ‘ok’ after clicking the ‘Write’ menu, remove the programmed chip from the programmer circuit board and fix it onto the target circuit for the LED.asm program (shown in Fig. 2). Now apply 5V and press the switch connected to Reset pin, if needed. (The circuit resets at power-on.) The LEDs start blinking fast and the waveform can be observed on the CRO for any of the pins at the output to the LEDs. It will be around 600 Hz.

Message display on the LCD module
Method I. Given below is the source code for message display on the LCD module along with suitable comments wherever needed.


This program displays ‘Electronics ForU’ on the LCD module (Fig. 6). The message may be displayed on the LCD in a single or two rows depending on the LCD module. In some LCD modules, the first eight characters are written consecutively, while for display of the next eight characters, the program needs to restart the cursor at address $C0. But Hitachi-make single-row types do not need to restart the cursor’s address after the eighth entry; the characters can be written consecutively up to ‘16,’ i.e., in a single row.

The program is named as ‘LCD_CHAR.asm’ and assembled into the ‘.hex’ file by typing ‘avr lcd_char’ and invoking the cross-assembler AVR. Now the lcd_char.hex file is generated. The AT-PROG programmer burns this code into the flash memory of the ATmega8535.

Note that while assembling this program using ‘avr lcd_char’ command, the definition file for IC ATmega8535 (m8535def.inc) should be in the same directory.

Method II. This message display program uses look-up table. In the message display program described in Method I, ‘Call lcdwr’ instruction was written for each character. Here, instead, if we enter all the bytes for ‘Electronics ForU’ in a table, they can be picked up one by one until the end and shown on the LCD screen. For the purpose, there is an instruction called load program memory (LPM).

The table, as also the name, is stored in the program memory. Here is the program along with necessary comments.



The actual-size PCB for programming and LCD message display are given in Figs 7 and 9, while their component layouts are shown in Figs 8 and 10, respectively.

courtsy: EFY