SPONSORED LINKS
 
 
Google
 
Assembly Language Programming with Microcontroller
 Assembly Language Programming with Microcontroller

INTRODUCTION

The instructions executed by the CPU are defined by a binary code called machine code. The instructions Bid corresponding codes are machine dependent. Each instruction is represented by a unique binary string that causes the microcontroller to perform a low-level function (e.g., add a number to a register or move a register's value to a memory location).

Microcontrollers can be programmed using assembly language, which has a mnemonic command corresponding to each instruction (e.g., ADD to add a number to a register and MOV to move a register's value to a memory location).However, assembly language must be converted to machine code, using software called an assembler, before it can be executed on the microcontroller. Below given are few reasons to write program in assembly language.
To speed computer operation
To reduce the size of the program
To write programs for special situations
To better understand how computer operates
To remove complicacies associated with machine level programming.

MICROCONTROLLER PROGRAMMING LANGUAGES

Machine/Assembly language
Machine language is the program representation as the microcontroller understands it. It is not simple for one to understand machine language. Assembly language is a human-readable for of machine language which makes it much easier. Each assembly language statement corresponds to one machine language statement. 

An assembly/machine language program is fast and small. This is because programmer are in complete charge of what goes into the program. To assembly language debugging of programs are not easy.

If beginners are starting out learning about microcontrollers, it would be worth first learning assembler By programming in assembler, beginners master the underlying architecture of the chip. which is important if beginners intend to do anything significant with microcontroller.

Interpreters
An interpreter is a high level language translator that is closer to natural language. The interpreter is a program that resides in the microcontroller. It executes a program by reading each language statement one at a time and then doing what the statement says to do. The two most popular interpreters for micro controllers are BASIC and FORTH.

BASIC's popularity is due to its simplicity, readability, and of course just about everyone has at least played with BASIC at one time or another. One may say about [interpreted] BASIC is that it is slow. Often this can be solved by using a different technique for performing the desired task.

FORTH has a very loyal following due to its speed (approaching that of assembler language) and its incremental approach to building a system from reusable parts. Many FORTH systems come with a host system which turns desktop computer into a development system. FORTH can be quite difficult to write in (if one have no experience with it) and is probably even harder to read. However, it is a very useful and productive language for control systems and robotics, and can be mastered in time. The nicest thing about developing a system with an interpreter- is that one can build program interactively. One can first write a small piece of code and then try it out immediately to see how it works. when the results are satisfactory. one can then add additional components until the final result is achieved.

Compilers
A compiler is a high level language translator that combines the programming ease of an interpreter with greater speed. This is accomplished by translating the program (on a host machine such as a desktop PC) directly into machine language. The machine language program is then burned onto an EPROM or downloaded directly to the microcontroller. The microcontroller then executes the translated program directly, without having to interpret first.

The most popular microcontroller compilers are C and BASIC. PUM, from Intel, also has some popular support due to that company's extensive use of that language.

Due to both its popularity and its slow speed, it was only logical that BASIC would appear as a compiled language. A few companies supply a BASIC compiler for several of the more popular microcontrollers. Execution speed is drastically increased over interpreted BASIC since the microcontroller is freed from the task of interpreting the statements as the program runs.

While interpreted Forth approaches the speed of many compilers, compiled Forth screams along. Today there are many high performance optimizing native code Forth compilers. Of course it still has compactness and more elegant factoring of functionality than in most languages.

Now-a-days C is most preferred language in development areas. C is used on compute from the tiny microcontroller up to the largest Cray supercomputer. Although a C program can be a bit tedious at times to read, it is a powerful and flexible development tool. Although a high level language, it also gives the developer access to the underlying machine. There are several very good and cheap C compilers available for the more popular microcontrollers.

Fuzzy Logic and Neural Networks
Fuzzy Logic and neural networks are two design methods that are coming into favor in embedded systems. The two methods are very different from each other, from conception to implementation. However, the advantages and disadvantages of the two can complement each other.

The advantage of neural networks is that it is possible to design them without completely understanding the underlying logical rules by which they operate. The neural network designer applies a set of inputs to the network and "trains" it to produce the required output. The inputs must represent the behavior of the system that is being programmed, and the outputs should match the desired result within some margin of error. If the network's output does not agree with the desired result,- the structure of the neural network is altered until it does. After training it is assumed that the network will also produce the desired output, or something close to it, when it is presented with new and unknown data.

In contrast, a fuzzy-logic system can be precisely described. Before a fuzzy control system is designed, its desired logical operation must be analyzed and translated into fuzzy-logic rules. This is the step where neural networks technology can be helpful to the fuzzy-logic designer. The designer can first train a software neural network to produce the desired output from a given set of inputs and outputs and then use a software tool to extract the underlying rules from the neural network. The extracted rules are translated into fuzzy-logic rules.

Fuzzy logic is not a complete design solution. It supplements, rather than replaces traditional event control and PID (proportional, integral, and derivate) control techniques. Fuzzy logic relies on grade of membership and artificial intelligence techniques. It works best when it is applied to non-linear systems with many inputs that cannot be easily expressed in either mathematical equations used for PID control or IF-THEN statements used for event control.

BACK

SPONSORED LINKS