Temperature measurement and control is one of the most common applications of microcontroller-based data acquisition systems. Four types of sensors are commonly used to measure temperature in commercial and industrial applications. These are thermocouples, resistive temperature devices (RTDs), thermistors, and integrated circuit (IC) temperature sensors. Each sensor has its unique advantages and disadvantages and by […]
Continue reading…
Uncategorized
Programming Microcontrollers In C:Data Types
Data Types The C51 compiler provides the standard C data types and in addition several extended data types are offered to support the 8051 microcontroller family. Table 2.1 lists the available data types (see the C51 reference manual for more information). Some of the data types are described below in more detail. signed char/unsigned char […]
Continue reading…
Microcomputer systems:Timer/Counters
Timer/Counters The 8051 and AT89C2051 contain two timer/counters known as timer/counter 0 and timer/counter 1 (larger members of the 8051 family contain more timers/ counters). These timer/counters can be operated in several different modes depending upon the programming of two registers TCON and TMOD, as shown in Tables 1.2 and 1.3. These registers should be […]
Continue reading…
PROGRAMMING PIC MICROCONTROLLERS IN C:STRUCTURE OF A C PROGRAM
STRUCTURE OF A C PROGRAM The simplest C program consists of three lines: It is always a good practice to include comments in programs to describe the operation of the various parts of the program. Comment lines should also be included at the beginning of a program to describe the aim of the program, the […]
Continue reading…
PROGRAMMING PIC MICROCONTROLLERS IN C:ACCESSING THE EEPROM MEMORY
ACCESSING THE EEPROM MEMORY Some PIC microcontrollers (e.g. PIC16F84) have EEPROM memories which can be used to store nonvolatile data. PICC Lite provides instructions for reading and writing to this memory. The EEPROM WRITE command is used to write a data byte to the EEPROM memory. For example, the following command writes 0x2E to address […]
Continue reading…
PROGRAMMING PIC MICROCONTROLLERS IN C:DELAYS IN C PROGRAMS
DELAYS IN C PROGRAMS There are many real-time applications where the microcontroller is too fast and we need to slow it down to see, for example, the flashing of an LED. The PICC Lite compiler offers two types of delay functions: a microsecond delay function, and a millisecond delay function. The file <delay.c> must be […]
Continue reading…
PROGRAMMING PIC MICROCONTROLLERS IN C:PRE-PROCESSOR COMMANDS
PRE-PROCESSOR COMMANDS Lines that begin with a ‘#’ character in column 1 of a C program are called pre-processor commands. The C language relies on the pre-processor to extend its power. Some of the commonly used pre-processor commands are described in this section.
Continue reading…
PROGRAMMING PIC MICROCONTROLLERS IN C:POINTERS IN C
POINTERS IN C Pointer are widely used in C programs. A pointer is a variable which stores the address of another variable. A pointer is declared by preceding it with the ‘*’ character. For example, a character pointer called p is declared as follows: char *p; Similarly, an integer pointer called pnt is declared by […]
Continue reading…
PROGRAMMING PIC MICROCONTROLLERS IN C:FUNCTIONS IN C
FUNCTIONS IN C Almost all programming languages support functions or some similar concepts. Some lan- guages call them subroutines, some call them procedures. Some languages distinguish between functions which return variables and those which do not. In almost all programming languages functions are of two kinds: user functions and built-in functions. User functions are developed […]
Continue reading…
PROGRAMMING PIC MICROCONTROLLERS IN C:PROGRAM FLOW CONTROL
PROGRAM FLOW CONTROL The PICC Lite language supports the following flow control commands: The if statement can be used together with the else statement when it is required to execute alternative set of statements when a condition is not satisfied. The general format is: Switch–Case Statement This is another form of flow control where statements […]
Continue reading…