Exercises for Timers 1. Write a program to generate a one minute timer clock with a 0.1 second display and then do the following: N Check its accuracy with the time site on the Internet. N Make adjustments to make it accurate to within one second per hour and then per day. Can this be […]
Continue reading…
Posts by Farahat
TIMERS AND COUNTERS:COUNTERS
COUNTERS Of the three timers in the 16F877A, only Timer0 (an 8-bit timer) and Timer1 (the 16-bit timer) can be used as counters. Timer2 does not have a counter input line. Generally speaking this makes Timer0 suitable for use with small counts and rapid interrupts and Timer1 suitable for larger counts. HOW DOES A COUNTER […]
Continue reading…
TIMERS AND COUNTERS:TIMER OPERATION CONfiRMATION
TIMER OPERATION CONfiRMATION To make sure a timer is working, set up a program in which the interrupt routine incre- ments a variable and the main loop displays it. If you see the variable incrementing, the interrupt routine is working. The speed of the incrementing will give you some idea of the rate at which […]
Continue reading…
TIMERS AND COUNTERS:PRE-SCALERS AND POST-SCALERS
PRE-SCALERS AND POST-SCALERS Pre-scalers and post-scalers can be confusing for the beginner. Here is a simple explanation. A pre-scaler is applied to the system clock and affects the timer by slowing down the system clock as it applies to the timer. Normally the timer is fed by a fourth of the basic clock frequency, which […]
Continue reading…
TIMERS AND COUNTERS:THE WATCHDOG TIMER
THE WATCHDOG TIMER A Watchdog Timer is a timer that sets an interrupt that tells us that for some reason the program has hung up or otherwise gone awry. As such it is expected that in a prop- erly written and compiled program the Watchdog Timer will never set an interrupt. This is accomplished by […]
Continue reading…
CONTROLLING THE OUTPUT AND READING THE INPUT:THE LCD DISPLAY
THE LCD DISPLAY This section describes the use of and interactions with existing hardware connections as they come with the LAB-X1 module. Other wiring schemes can be used with ease as defined in the compiler manual. The LCD is controlled from PORTD, and all eight bits of this port are connected to the LCD. You […]
Continue reading…
TIMERS AND COUNTERS
If you have no knowledge about timers, you should read this chapter a few times. However, there is some repetition in the other chapters to allow each part of the book to stand as an independent resource. Most users will find that using the timers and the counters is the hardest part of learning how […]
Continue reading…
CONTROLLING THE OUTPUT AND READING THE INPUT:EXERCISES
EXERCISES Answers to these problems are not provided. Since this is really all about input and output, a comprehensive set of exercises that focus specifically on input and output have been provided. We need to be completely comfortable with these I/O functions before we start on running motors, so you are encouraged to expand on […]
Continue reading…
THE SOFTWARE, COMPILERS, AND EDITORS:PICBASIC PRO COMPILER INSTRUCTION SET
PICBASIC PRO COMPILER INSTRUCTION SET As you can see from the preceding comparison, the PICBASIC PRO compiler pro- vides a much more comprehensive instruction set and is the compiler of choice for serious development work. The mathematical functions are substantially more powerful. It is, of course, also possible to program microcontrollers in assembly language and […]
Continue reading…
UNDERSTANDING THE MICROCHIP TECHNOLOGY PIC 16F877A: FEATURES OF THE MCU
UNDERSTANDING THE MICROCHIP TECHNOLOGY PIC 16F877A: FEATURES OF THE MCU PIC microcontrollers are manufactured by the Microchip Technology Corporation of Chandler, Arizona. We will be using the recommended 16F877A microcontroller in the LAB-X1 board, see Figure 3.1. Not all the features provided in the 16F877A will be addressed in the exercises to follow, but enough […]
Continue reading…