admin - Wed, 09/13/2006 - 13:26
As it is important to understand variable types in AVR-GCC lest take a deeper look at this.
Choosing proper variable type sometimes may be crucial in designing embedded software as microcontroller resources are limited. Choice of proper variable type may save lots of time and space of your program.
What is common variable type in 8 bit system? Of course byte or so called char type. Char name comes from word “character” because char type usually is used to store character symbols (ASCII). Char type can have values from -128 to +127 while unsigned char may have values from 0 to 255 256. Some compilers may use byte type instead of unsigned char.
admin - Wed, 09/06/2006 - 08:49
All AVR ports have Read-modify-write functionality when used as genera I/O ports. Direction of separate port pin can be changed. Each pin buffer has symmetric capability to drive and sink source. Pin driver is strong enough to drive LED directly , but it is not recommended. All port pins have selectable pull-up resistors. All pins have protection diodes to both VCC and GND.
Each port consists of three registers DDRx, PORTx and PINx (where x means port letter). DDRx register selects direction of port pins. If logic one is written to DDRx then port is configured to be as output. Zero means that port is configured as input. If DDRx is written zero and PORTx is written logic “1” then port is configured as input with internal pull-up resistor. Otherwise if PORTx is written to zero, then port is configured as input but pins are set to tri-state and you might need to connect external pull-up resistors.
If PORTx is written to logic “1” and DDRx is set to “1”, then port pin is driven high. And if PORTx=0, then port is driven low.
admin - Tue, 09/05/2006 - 08:46
Sometimes you might like to manipulate the members of structures in more generalized way. This can be done by using pointer reference to structure. Sometimes it is easier to pass pointer to structure than passing entire structure to function.
Structure pointer can be declared very easily:
struct structure_tag_name *variable;
admin - Tue, 09/05/2006 - 08:22
Basically Structures are nothing more than collection of variables so called members. Structures allows to reference all members by single name. Variables within a structure doesn't have to be the same type. General structure declaration:
admin - Tue, 08/29/2006 - 09:40
Why this bootloader is different? This is based on standard Motorola s-record compatible file which can be easily generated from Intel HEX. Firmware can be transferred via standard UART of any AVR microcontroller. File can be transferred using any Hyper terminal program or your own program. Just note, that it is necessary to have a delay of 250ms after each line transmitted. This can be set with almost all Hyper terminal program.
Download process can be automatized by using command line tool, which can be called from Makefile or another application.
admin - Fri, 08/25/2006 - 09:13
GNU Compiler Collection or GCC is free and have been around for a very long time. GCC is supported bu volunteers. This means there is a big community where you can find help for free and from different sources – but response can take longer or you want get at all.
But there is several significant advantages of GCC compiler collection:
GCC is available for many different processors like x86, AVR, ARM;
Code is very mature and works well. It is also well documented.
admin - Sat, 08/19/2006 - 11:03
Program Flow and control is a control method of your program. For example Loop constructions control repeated execution of repeated program segments where control is taken by control parameter. In this article we will go through if/else switch/case statements and loop sentences like while, do while, for.
As I mentioned three looping sentences available in C language one of them is While sentence. Lets take an example:
admin - Fri, 08/11/2006 - 07:45
This is good news for those who more than one working places. It is not convenient to install separate WinAVR development toolsets in separate computers and care about them. There is a solution. Now you can run your WinAVR suite directly from USB memory stick or other portable media without prior installation. You can download it from here Portable WinAVR its Free.
Whats included in package:
admin - Thu, 08/10/2006 - 10:11
The main thing what microcontrollers does is operates with data. There are four main operations that microcontrollers does: adds, abstracts, multiplies and divides (+,-,*,/). division can be split in division “/” and modulus operation “%”. For instance i1/i2 is integer division.
Other part of operators is Relation operators. They are used for boolean conditions and expressions. Expressions with these operators return true or false values. Zero is taken as false and non zero value as true. Operators may be as follows: <, <=, > >=, ==, !=.
The priority of the first four operators is higher than that of the later two operators. These operators are used in relational expressions such as:
admin - Thu, 08/10/2006 - 09:39
Constant value is understandable as non changeable value like PI=3.141592... value in math. Usually you use constants in your programs, but don't realize that they are constants. For instance:
x=x+3; The number 3 is a constant which will be compiled directly in addition operation. Constants can be character or string. Like in function printf(“Hello World\n”); “Hello World” is a string constant which is placed in program memory and will never changes.
It is usually recommended to declare constants by using identifier with reserved word const:
const int No=44;