Test Programs for MOT2 The following test programs for the MOT2 board will demonstrate aspects of direction, position and speed control. Direction Test A simple test program to drive the motor in each direction DCM1 is listed as Program 11.1. When S1 is held on, the motor runs in the forward direction, and in the […]
Continue reading…
Posts by Farahat
PIC Motor Applications:Motor Control
Motor Control There are two main types of control system, open loop and closed loop. An open loop system is essentially manually controlled or involves operating a load under fixed conditions. For example, a cooling fan will usually not need precise speed control, and might simply be switched on and off from a fixed voltage […]
Continue reading…
Programming Techniques:Numerical Types
Numerical Types Literal values given in PIC source code can be written using different number systems. The default is hexadecimal, that is, if the type is not specified, the assembler will assume it is hex. However, it is very important to note that the assembler will still get confused between numbers and labels if the […]
Continue reading…
Programming Techniques:Assembler Directives
Assembler Directives Assembler directives are commands inserted in PIC source code that control the operation of the assembler. They are not part of the program itself and are not converted into machine code. Many assembler directives will only be used when a good knowledge of the programming language has been achieved, so we will refer […]
Continue reading…
Programming Techniques:Register Operations
Register Operations We will now briefly review some of the options available when using the file registers, which provide more flexibility in programming. Result Destination The default destination for single register operations can simply be specified by label or number. For example, INCF spare increments the register labeled ‘spare’, with the result being left in […]
Continue reading…
Programming Techniques:Special Features
Special Features These include options such as oscillator type, internal timers to make the chip operation more reliable, code protection and internal hardware to support in-circuit programming and debugging. Most of these options are selected via the chip configuration word. Clock Oscillator Type The PIC MCU can be driven by an external RC network, a […]
Continue reading…
Programming Techniques:Interrupts
Interrupts Interrupts are generated by an internal event such as timer overflow, or an external asynchronous received at any time during the execution of another process. In the PC, when you hit the keyboard or move the mouse, an interrupt signal is sent to the processor from the keyboard interface to request that the key […]
Continue reading…
Programming Techniques:Hardware Counter/Timer
Hardware Counter/Timer Accurate event timing and counting are often needed in microcontroller programs. For example, if we have a sensor on a motor shaft that produces one pulse per revolution of the shaft, the number of pulses per second will give the shaft speed. Alternatively, the interval between pulses can be measured, using a timer, […]
Continue reading…
Programming Techniques:Program Timing
Program Timing Microcontroller (MCU) program execution is driven by a clock signal generated by an internal oscillator, which may be controlled by an external RC circuit or crystal. This signal is divided into four internal clock phases (Q1eQ4) that run at a quarter of the oscillator frequency (Fosc/4). These provide four separate pulses during each […]
Continue reading…
PIC Architecture:File Register Set
File Register Set All the file registers are 8 bits wide. They are divided into two main blocks: the special function registers (SFRs), which are reserved for specific purposes, and the general purpose registers (GPRs), which can be used for temporary storage of any data byte. The basic file register set (16F84A) is shown in […]
Continue reading…