AVR ISP

AVRISP is a very popular Parallel port programmer for flashing AVR type microcontrollers. Earlier I used programmer connected to com port, but frequently I needed this port for other purposes; I decided to make it work on the parallel port. The programmer on a parallel port is much simpler than connected to a serial port because there is no needed voltage adapter like MAX232. You can only connect your MCU directly to the port. But for safety reasons, there is good practice to use buffer ships like 74HC244. The header for programmer I used standard 6 pin ISP header.

Continue reading

AVR-GCC ABC [2]

After the release of AVRStudio4, there is the ability to integrate the AVR-GCC compiler in it. As you know AVR studio has only assembler compiler- debugger. Integration of AVR-GCC is done by the plugin. The plugin detects AVR-GCC by itself, you don’t have to bother. What do we get from it? Of course a full set of good tools comparable to commercial. The convenient user interface, automatic makefile generation, visual debugging by watching processors register, or even you can flash the chip. We can say that abilities are: 1. Compilation, setting parameters, automatic AVR-GCC detection; 2. Graphical User Interface – convenient project setting; 3. Tree-like project view; 4. Project can comply with predefined configurations; 5. Convenient error handling; 6. Ability to use external makefiles; 7. Map and List file generation; 8. Plugin inspect connections among source files (c and h files which are not part of the project); 9. User can work with c or ASM projects in one environment. Other documentation can be found in AVRStudio help files. This feature is well documented.

Continue reading

AVR-GCC ABC [1]

This time I decided to lay down some information on using the AVR-GCC compiler. I will not rewrite what’s in documentation is already written, but write down some issues that can help you start using this amazing tool. Introduction Most AVR programmers probably had a question in their mind about what compiler to use for their designs. The choice is huge. You can use commercial ones like IAR, CodeVision, ImageCraft. These compilers come with convenient GUI’s, code generators. But you have to buy a license to use them. So if you are going to do a low-budget project, the best choice is to use the open-source compiler GCC. This is the most successful open-source compiler in the world. The AVR platform is called AVR-GCC. The compiler itself has no graphical interface. Everything can be done in the MSDOS command line or the Linux command line. To make it easier to compile a project, there are makefiles used. GNU compilers usually are using UNIX style make files. This file can be run with the make.exe program. In reality, you don’t have to write makefiles – there are ready templates to use.Everyone may agree that using a compiler in the command line…

Continue reading

C language Operators and expressions

The main thing that microcontrollers does is operates with data. Microcontrollers do four main operations: adds, abstracts, multiplies, and divides (+,-,*,/). division can be split into the division “/” and modulus operation “%.” For instance, i1/i2 is an integer division. Another part of the 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 latter two operators. These operators are used in relational expressions such as: Note that the equality operator is == and not =. ‘=’ is an assignment operator. If you want to compare a and b for equality, then you should write a == b, not a = b because a = b means you are assigning the value of b to a, as shown in.

Continue reading

Constants in C language

Constant value is understandable as nonchangeable 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 that is placed in program memory and will never change. It is usually recommended to declare constants by using identifier with reserved word const: const int No=44; Identifying the variable as constant will cause the compiler to store this variable in program memory rather than in RAM, thus saving space in RAM. If special functions are used, then constants can also be stored in EEPROM memory.

Continue reading

The very basics of C

C language is a function-based programming language. C program itself is a function. Usually, parameters to the C function are passed as arguments. The function consists of a name followed by the parentheses enclosing arguments or an empty pair of parentheses if there are no arguments required. If there are several arguments, they are separated by commas. The mandatory part of the C program is the main function. This function must be included in every program because it is the first function run after its execution. Lets take an example: This is an elementary C program, but it contains all the necessary elements. Let’s examine a little bit about what we have written here…

Continue reading

Microcontroller C programming

There is no doubt that everyone faces C language when programming microcontrollers. This is the most popular language among hardware programmers. There are plenty of books about this language – you have to open and read. This article is not about language basics, but c language’s effectiveness in embedded systems touched. Quite often, you can find good examples of effective algorithms: faster code performance and code size. To write a good optimal algorithm, you have to know the structure of the compiler. Of course, we will not analyze compilers, but we can look through a few rules and tricks and achieve an optimal algorithm.

Continue reading

GNUARM for ARM microcontrollers

In this article, you’ll find some information about how to configure the GNUARM toolset for compiling ARM7 microcontrollers.GNUARM is the open-source toolset for ARM7 MCUs. It has a GCC compiler and debugger. Our purpose now is to set up tools in a Windows environment and compile one project.First of all download the compiled toolset from https://www.gnuarm.com: Select the newest [GCC-4.0 toolchain] located below Cygwin.After it is downloaded, start the installation: Start window Accept license agreement. Select folder where do you want GNUARM to be installed: Select the components. You can select all of them. Chose Start menu folder name – just leave as it is. Select the desktop shortcut to be placed. I highly recommend checking Cygwin DLL because I had to copy DLLs to copy manually despite I had Cygwin installed. If this option is checked, DLL files will be copied without bothering you. And press install.. Select checkbox in order to create system variable: PATH=c:\gnuarm\bin After we have GNUARM installed, download Binutils from https://optimize.ath.cx/ARM7/src/utils.zip, download this archive and unpack all contents c:\gnuarm\bin folder. Also, download https://optimize.ath.cx/ARM7/src/cygncurses-8.dll and put it in c:\gnuarm\bin folder. Now we are set to start compilation. Let’s try the test compilation. Just download the project…

Continue reading

ARM7-Base development board for LPC2148

After the ARM mini-board for LPC2148 is created, it’s time to develop a development board. I want to make the board as universal as possible.So I decided to put I2C, SPI, COM, and JTAG on board. I decided to use an external voltage adapter as there are needed 5V and 3.3V DC sources. For my experiments, I can use those voltages straight from a PC source. 5V there is used to supply MAX232IC. I decided to use it instead of MAX3232 because it is easier to get them in the market. Of course, I left the ability to use and MAX3232 by changing the jumper. All other free pins I made accessible by adding pinheads inboard.

Continue reading

ARM7 LPC2148 mini board

One day I’ve got an ARM LPC2148 chip in my hands. The Philips LPC2148 is an ARM7TDMI-S based high-performance 32-bit RISC Microcontroller with Thumb extensions 512KB on-chip Flash ROM with In-System Programming (ISP) and In-Application Programming (IAP), 32KB RAM, Vectored Interrupt Controller, Two 10bit ADCs with 14 channels, USB 2.0 Full Speed Device Controller, Two UARTs, one with full modem interface. Two I2C serial interfaces, Two SPI serial interfaces, Two 32-bit timers, Watchdog Timer, a PWM unit, Real-Time Clock with optional battery backup, Brown-out detect circuit General purpose I/O pins. CPU clock up to 60 MHz, On-chip crystal oscillator, and On-chip PLL.

Continue reading