Professional Documents
Culture Documents
SYNOPSIS
system for controlling a device based on the temperature sensor value. Temperature sensor is
connected to ADC by the o/p of ADC we can get the digital values of the temperature sensor.
Keys are connected to microcontroller by which we can set the threshold value for the
temperature which is seen in the LCD. If the sensor value is more than the given value then
the device will be OFF. If the temperature sensor value is less than given value than device
will be ON.
Devices, LCD, ADC. So the temperature value is been given to controller using ADC and
keys are used to set the temperature value if the value is exciding then device will be OFF
LCD
Power
Supply
T
Temperature R DEVICE
Sensor Micro I
Controller A
C
KEYS
ADC
BLOCK DESCRIPTION
Power supply
A power supply provides a constant output regardless of voltage variations. “Fixed" three-
terminal linear regulators are commonly available to generate fixed voltages of plus 3 V, and
The "78xx" series (7805, 7812, etc.) regulate positive voltages while the "79xx" series
(7905, 7912, etc.) regulate negative voltages. Often, the last two digits of the device number
are the output voltage; eg, a 7805 is a +5 V regulator, while a 7915 is a -15 V regulator. The
78xx series ICs can supply up to 1.5 Amperes depending on the model.
• All single cycle instructions except for program branches which are two cycle
• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
• Programmable code-protection
• Power saving SLEEP mode
TEMPERATURE SENSOR
RELAY:
Relay is an electromagnetic switch which is controlled with a small current and is used for
turned on or off high electric circuits or appliances. Means its magnetic coil is turned on or
off with a small current but its magnetic contacts are used for controlling high currents. Two
types of rely modules are commonly used first one is ac relay module whose magnetic coil is
operated at ac voltages. Similarly, second one is dc relay module whose magnetic coil is
operated at dc voltages. Both relay modules are easily available in market or online shop. But
in this article, we will only talk about dc voltages relay module.
CIRCUIT DIAGRAM
CIRCUIT DIAGRAM
PIC MICROCONTROLLER
PIC Microcontroller (PIC16F87X) Microcontroller Core Features:
• All single cycle instructions except for program branches which are two cycle
• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
• Programmable code-protection
• Low-power consumption:
Peripheral Features
• Timer1: 16-bit timer/counter with prescaler, can be incremented during sleep via
external crystal/clock
• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
• Synchronous Serial Port (SSP) with SPI (Master Mode) and I2C (Master/Slave)
• Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS controls (40/44-pin
only)
Pin layout of PIC16F877A
MEMORY ORGANIZATION
There are three memory blocks in each of these PICmicro MCUs. The Program
Memory and Data Memory have separate buses so that concurrent access can occur.
The data memory is partitioned into multiple banks which contain the General
Purpose Registers and the Special Function Registers. Bits RP1(STATUS<6>) and RP0
(STATUS<5>) are the bank select bits.
Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for
the Special Function Registers. Above the Special Function Registers are General Purpose
Registers, implemented as static RAM.
The register file can be accessed either directly or indirectly through the File Select
Register FSR.
The Special Function Registers are registers used by the CPU and peripheral modules
for controlling the desired operation of the device. These registers are implemented as static
RAM. The Special Function Registers can be classified into two sets; core (CPU) and
peripheral.
Status register
The STATUS register contains the arithmetic status of the ALU, the RESET status
and the bank select bits for data memory. The STATUS register can be the destination for
any instruction, as with any other register. If the STATUS register is the destination for an
instruction that affects the Z, DC or C bits, then the write to these three bits is disabled. These
bits are set or cleared according to the device logic. The TO and PD bits are not writable,
therefore, the result of an instruction with the STATUS register as destination may be
different than intended.
OPTION_REG register
INTCON register
The INTCON Register is a readable and writable register, which contains various
enable and flag bits for the TMR0 register overflow, RB Port change and External RB0/INT
pin interrupts.
PIE1 register
The PIE1 register contains the individual enable bits for the peripheral interrupts.
PIR1 register
The PIR1 register contains the individual flag bits for the peripheral interrupts.
PIE2 register
The PIE2 register contains the individual enable bits for the CCP2 peripheral
interrupt, the SSP bus collision interrupt, and the EEPROM write operation interrupt.
PIR2 register
The PIR2 register contains the flag bits for the CCP2 interrupt, the SSP bus collision
interrupt and the EEPROM write operation interrupt.
PCON register
The Power Control (PCON) Register contains flag bits to allow differentiation
between a Power-on Reset (POR), a Brown-out Reset (BOR), a Watch-dog Reset (WDT) and
an external MCLR Reset.
Addressing modes:
Direct Addressing
Indirect Addressing
Indirect unlike direct addressing does not take an address from an instruction but
makes it with the help of IRP bit of STATUS and FSR registers. Addressed location is
accessed via INDF register which in fact holds the address indicated by a FSR. In other
words, any instruction which uses INDF as its register in reality accesses data indicated by a
FSR register. Let's say, for instance, that one general purpose register (GPR) at address 0Fh
contains a value of 20. By writing a value of 0Fh in FSR register we will get a register
indicator at address 0Fh, and by reading from INDF register, we will get a value of 20, which
means that we have read from the first register its value without accessing it directly (but via
FSR and INDF). It appears that this type of addressing does not have any advantages over
direct addressing, but certain needs do exist during programming which can be solved
smoothly only through indirect addressing.
Indirect addressing, INDF and FSR registers
The INDF register is not a physical register. Addressing the INDF register will cause
indirect addressing. Indirect addressing is possible by using the INDF register. Any
instruction using the INDF register actually accesses the register pointed to by the File Select
Register, FSR. Reading the INDF register itself indirectly (FSR = ’0’) will read 00h. Writing
to the INDF register indirectly results in a no-operation (although status bits may be
affected).
I/O Ports
Some pins for these I/O ports are multiplexed with an alternate function for the
peripheral features on the device. In general, when a peripheral is enabled, that pin may not
be used as a general purpose I/O pin.
PORTA is a 6-bit wide bi-directional port. The corresponding data direction register
is TRISA. Setting a TRISA bit (=1) will make the corresponding PORTA pin an input (i.e.,
put the corresponding output driver in a hi-impedance mode). Clearing a TRISA bit (=0) will
make the corresponding PORTA pin an output (i.e., put the contents of the output latch on the
selected pin). Reading the PORTA register reads the status of the pins, whereas writing to it
will write to the port latch. Pin RA4 is multiplexed with the Timer0 module clock input to
become the RA4/T0CKI pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open
drain output. All other PORTA pins have TTL input levels and full CMOS output drivers.
Other PORTA pins are multiplexed with analog inputs and analog VREF input. The
operation of each pin is selected by clearing/setting the control bits in the ADCON1 register
(A/D Control Register1).
PORTB is an 8-bit wide, bi-directional port. The corresponding data direction register
is TRISB. Setting a TRISB bit (=1) will make the corresponding PORTB pin an input.
Clearing a TRISB bit (=0) will make the corresponding PORTB pin an output. Three pins of
PORTB are multiplexed with the Low Voltage Programming function; RB3/PGM, RB6/PGC
and RB7/PGD. Each of the PORTB pins has a weak internal pull-up. A single control bit can
turn on all the pull-ups. This is performed by clearing bit RBPU (OPTION_REG<7>). The
weak pull-up is automatically turned off when the port pin is configured as an output. The
pull-ups are disabled on a Power-on Reset. Four of PORTB’s pins, RB7:RB4, have an
interrupt on change feature. Only pins configured as inputs can cause this interrupt to occur.
The input pins (of RB7:RB4) are compared with the old value latched on the last read of
PORTB. The “mismatch” outputs of RB7:RB4 are OR’ed together to generate the RB Port
Change Interrupt with flag bit RBIF (INTCON<0>).
PORTC is an 8-bit wide, bi-directional port. The corresponding data direction register
is TRISC. Setting a TRISC bit (=1) will make the corresponding PORTC pin an input.
Clearing a TRISC bit (=0) will make the corresponding PORTC pin an output. When the I2C
module is enabled, the PORTC (3:4) pins can be configured with normal I2C levels or with
SMBUS levels by using the CKE bit (SSPSTAT <6>).
PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is individually
configurable as an input or output. PORTD can be configured as an 8-bit wide
microprocessor port (parallel slave port) by setting control bit PSPMODE (TRISE<4>). In
this mode, the input buffers are TTL.
PORTE and TRISE Register
PORTE has three pins, RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7, which are
individually configurable as inputs or outputs. These pins have Schmitt Trigger input buffers.
I/O PORTE becomes control inputs for the microprocessor port when bit PSPMODE
(TRISE<4>) is set. In this mode, the input buffers are TTL. PORTE pins are multiplexed
with analog inputs. When selected as an analog input, these pins will read as ’0’s. TRISE
controls the direction of the RE pins, even when they are being used as analog inputs.
The Data EEPROM and FLASH Program Memory are readable and writable during
normal operation over the entire VDD range. The data memory is not directly mapped in the
register file space. Instead it is indirectly addressed through the Special Function Registers
(SFR). There are six SFRs used to read and write the program and data EEPROM memory.
The EEPROM data memory allows byte read and writes. When interfacing to the data
memory block, EEDATA holds the 8-bit data for read/write and EEADR holds the address of
the EEPROM location being accessed. The registers EEDATH and EEADRH are not used
for data EEPROM access. These devices have up to 256 bytes of data EEPROM with an
address range from 0h to FFh.
Program memory access allows for checksum calculation and calibration table
storage. A byte or word write automatically erases the location and writes the new data (erase
before write). Writing to program memory will cease operation until the write is complete.
The program memory cannot be accessed during the write, therefore code cannot execute.
During the write operation, the oscillator continues to clock the peripherals, and therefore
they continue to operate When the write completes, the next instruction in the pipeline is
executed and the branch to the interrupt vector address will occur. When interfacing to the
program memory block, the EEDATH:EEDATA registers form a two byte word, which holds
the 14-bit data for read/write. The EEADRH:EEADR registers form a two byte word, which
holds the 13-bit address of the EEPROM location being accessed. These devices can have up
to 8K words of program EEPROM with an address range from 0h to 3FFFh
Timer0 Module
Timer mode is selected by clearing bit T0CS (OPTION_REG<5>). In timer mode, the
Timer0 module will increment every instruction cycle (without prescaler). If the TMR0
register is written, the increment is inhibited for the following two instruction cycles. The
user can work around this by writing an adjusted value to the TMR0 register. Counter mode
is selected by setting bit T0CS (OPTION_REG<5>). In counter mode, Timer0 will increment
either on every rising or falling edge of pin RA4/T0CKI. The incrementing edge is
determined by the Timer0 Source Edge Select bit T0SE (OPTION_REG<4>). Clearing bit
T0SE selects the rising edge. The prescales is mutually exclusively shared between the
Timer0 module and the watchdog timer. The prescaler is not readable or writable.
Timer0 Interrupt
The TMR0 interrupt is generated when the TMR0 register overflows from FFh to 00h.
This overflow sets bit T0IF (INTCON<2>). The interrupt can be masked by clearing bit T0IE
(INTCON<5>). Bit T0IF must be cleared in software by the Timer0 module interrupt service
routine before re-enabling this interrupt. The TMR0 interrupt cannot awaken the processor
from SLEEP since the timer is shut off during SLEEP.
Timer1 Module
The operating mode is determined by the clock select bit, TMR1CS (T1CON<1>). In
timer mode, Timer1 increments every instruction cycle. In counter mode, it increments on
every rising edge of the external clock input. Timer1 can be enabled/disabled by
setting/clearing control bit TMR1ON (T1CON<0>).
Block diagram of TIMER
TIMER2 MODULE
Timer2 is an 8-bit timer with a prescaler and a postscaler. It can be used as the PWM time
base for the PWM mode of the CCP module(s). The TMR2 register is readable and writable
and is cleared on any device Reset.
The Master Synchronous Serial Port (MSSP) module is a serial interface useful for
communicating with other peripheral or microcontroller devices. These peripheral devices
may be serial EEPROMs, shift registers, display drivers, A/D converters, etc. The MSSP
module can operate in one of two modes:
The MSSP module in I2C mode fully implements all master and slave functions
(including general call support) and provides interrupts-on-start and stop bits in hardware to
determine a free bus (multi-master function). The MSSP module implements the standard
mode specifications, as well as 7-bit and 10-bit addressing.
Two pins are used for data transfer. These are the SCL pin, which is the clock, and the
SDA pin, which is the data. The SDA and SCL pins are automatically configured when the
I2C mode is enabled. The SSP module functions are enabled by setting SSP Enable bit
SSPEN (SSPCON<5>). The SSPCON register allows control of the I2C operation. Four
mode selection bits (SSPCON<3:0>) allow one of the following I2C modes to be selected:
The SSPSTAT register gives the status of the data transfer. SSPBUF is the register to
which the transfer data is written to or read from. In receive operations; the SSPBUF and
SSPSR create a doubled buffered receiver. This allows reception of the next byte to begin
before reading the last byte of received data. When the complete byte is received, it is
transferred to the SSPBUF register and flag bit SSPIF is set.
Master Mode
• START condition
• STOP condition
• Acknowledge transmit
• Repeated Start
TEMPERATURE SENSOR
TEMPERATURE SENSOR
A large distinction can be made between temperature sensor types. Sensors differ a lot in
properties such as contact-way, temperature range, calibrating method and sensing element.
The temperature sensors contain a sensing element enclosed in housings of plastic or metal.
With the help of conditioning circuits, the sensor will reflect the change of environmental
temperature.
OUTPUT
LM35
GND
GND
It is easy to include the LM35 series in a temperature measuring application. The output
voltage of LM35 is linearly proportional to the Fahrenheit temperature, it has a Linear +10.0
mV/°F scale factor which means that you will get n*10.0 mV output voltage if the
environment temperature is n°F.
The LM35 series is available packaged in hermetic TO-46 transistor packages, while the
LM35C, LM35CA and LM35D are also available in the plastic TO-92 transistor package.
The LM35D is also available in an 8-lead surface mount small outline package. In our
functional module, LM35H in metal can package (TO-46) is used in the functional module, it
is very important to know that the wiring of sensor should be based on the positions of the
leading pins in different packages.
Out: It gives analog output voltage which is proportional to the temperature (in degree Celsius).
GND: Ground
Application Setup
LM35 is a temperature sensor which can measure temperature in the range of -55°C to
150°C.It is a 3-terminal device that provides analog voltage proportional to the temperature.
Higher the temperature, higher is the output voltage. The output analog voltage can be
converted to digital form using ADC so that a microcontroller can process it.
Interfacing Diagram
Driver IC ULN 2003A
Driver IC ULN 2003A
It is basically a relay driver IC and it is a Darlington array having high voltages and high
currents as well. It is made up of seven open collector Darlington pairs having common
emitter which shows ULN2003 has a capability of handling seven different relays at a time.
You should also have a look at Relay Interfacing with Microcontroller using ULN2003A.
ULN2003A is exactly the same as ULN2003with some small differences which are not of
much importance.
A single Darlington pair consists of two bipolar transistors and it operates on the current
range of 500mA to 600mA. ULN200X is a well known series of IC’s. ULN2003 is also the
part of this series. ULN2003 operates on 5V and TTL (Transistor Transistor Logic) and
CMOS (Complementary Metal Oxide Semi Conductor). Its pin configuration is designed so
that the input pins are at the left side of the IC whereas the the output pins of it are on right
side in front of the corresponding input pin. This IC has a very wide range of applications.
They are commonly used as relay drivers in order to drive different kinds of loads.
ULN2003A can also be used to drive different motors (e.g. DC Motors or Stepper Motors)
with Microcontrollers (like Arduino, PIC Microcontroller or 8051 Microcontroller etc.) .
Some of the other applications of ULN2003 include logic buffers, lamp drivers, line drivers,
LED display, motor driver circuits etc.
Its pin division on the basis of functions associated with them is shown in above
figure. Further description will be given in this tutorial later. In short the pins can be
divided into four different categories i.e. input pins, output pins, ground pin and common
pin. These pins along with their positions are shown below.
The functions associated with each pin of ULN2003 along with the pin names are shown in
the table given below.
The ULx200xA devices are high-voltage, high-current Darlington transistor arrays.
Each consists of seven NPN Darlington pairs that feature high-voltage outputs with common-
cathode clamp diodes for switching inductive loads.
The collector-current rating of a single Darlington pair is 500 mA. The Darlington
pairs can be paralleled for higher current capability. Applications include relay drivers,
hammer drivers, lamp drivers, display drivers (LED and gas discharge), line drivers, and
logic buffers. For 100-V (otherwise interchangeable) versions of the ULx2003A devices, see
the SLRS023 data sheet for the SN75468 and SN75469 devices.
The ULN2002A device is designed specifically for use with 14-V to 25-V PMOS
devices. Each input of this device has a Zener diode and resistor in series to control the input
current to a safe limit. The ULx2003A devices have a 2.7-kΩ series base resistor for each
Darlington pair for operation directly with TTL or 5-V CMOS devices.
The ULx2004A devices have a 10.5-kΩ series base resistor to allow operation
directly from CMOS devices that use supply voltages of 6 V to 15 V. The required input
current of the ULx2004A device is below that of the ULx2003A devices, and the required
voltage is less than that required by the ULN2002A device.
Internal circuit diagram of ULN 2003 having different resistors and diodes is shown in the
figure below.
LOGIC DIAGRAM
There are a lot of keys features associated with the relay driver ULN2003. A few of
which are given below.
Some of the key features are also given in the table below for the better understanding
about the working conditions of ULN2003
APPLICATIONS
The relay circuit driver ULN2003 has a wide range of applications in real life. Some
of the major applications associated with ULN-2003 are given below.
Logic buffers.
Line drivers.
Relay drivers (for driving different loads).
Lamp drivers.
LED display drivers (display devices).
Motor (stepper and DC brushed motor) drivers
SIMULATON
RELAY, UNIVERSAL MOTOR AND LCD POWERSUPPLY
RELAY
Relay is an electromagnetic switch which is controlled with a small current and is
used for turned on or off high electric circuits or appliances. Means its magnetic coil is turned
on or off with a small current but its magnetic contacts are used for controlling high currents.
Two types of rely modules are commonly used, first one is ac relay module whose magnetic
coil is operated at ac voltages. Similarly, second one is dc relay module whose magnetic coil
is operated at dc voltages. Both relay modules are easily available in market or online shop.
But in this article, we will only talk about dc voltages relay module
This electromagnetic field attracts the armature which is the liver connected through
spring. During this position the common point is connected with normally open point then
current is passed through common point to normally open point.
To interface pic microcontroller with relay, we need to use digital output port of pic
16F877A microcontroller. When we apply digital high signal to relay, relay becomes on and
when we apply digital low signal to relay, relay turns off. As
This microcontroller controlled the relay with so efficiently and intelligently. Circuit
diagram for relay module interfacing with pic16f877a microcontroller is shown below. I have
connected a push button with pic microcontroller which will be used to turn on and turn off
relay module. Suppose we want to turn on the relay module for any specific time then we
shell tell the microcontroller through programming to turn on the relay module for some time
Then this microcontroller automatically gives 5V dc voltages for that specific time to turn on
the relay module. So, we can easily control the relay module with pic 16f877a
microcontroller.
POWER SUPPLY:
The "78xx" series (7805, 7812, etc.) regulate positive voltages while the "79xx" series
(7905, 7912, etc.) regulate negative voltages. Often, the last two digits of the device number
are the output voltage; eg, a 7805 is a +5 V regulator, while a 7915 is a -15 V regulator. The
78xx series ICs can supply up to 1.5 Amperes depending on the model.
Features
1. Output Current up to 1A
2. Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24
3. Thermal Overload Protection
4. Short Circuit Protection
5. Output Transistor Safe Operating Area Protection
When you have a requirement for a project of say 12V, or even 5V if it's a digital project,
then these are the types you use. 7805 or 7812 are the types. There are of course negative
voltage regulators with the numbers 79XX which are substantially the same as those
discussed here excepting they are negative. We will not consider them further. Assume your
project calls for a basic fixed 12V D.C. to operate. Looking back to our earlier tutorial we
apply all the same principles. Look at the original schematic.
The basic power supply schematic
To obtain a DC power supply with both positive and negative output voltages, a
center-tapped transformer is used, where a third wire is attached to the middle of the
secondary winding and it is taken as the common ground point. Then voltages from the
opposite ends of the winding will be positive or negative with respect to this point.
Circuit description
This circuit is a small +5V power supply, which is useful when experimenting with
digital electronics. Small inexpensive wall transformers with variable output voltage are
available from any electronics shop and supermarket. Those transformers are easily available,
but usually their voltage regulation is very poor, which makes then not very usable for digital
circuit experimenter unless a better regulation can be achieved in some way. The following
circuit is the answer to the problem. This circuit can give +5V output at about 150 mA
current, but it can be increased to 1 A when good cooling is added to 7805 regulator chip.
The circuit has over overload and terminal protection.
The capacitors must have enough high voltage rating to safely handle the input voltage feed
to circuit. The circuit is very easy to build for example into a piece of veroboard.
Each pixel of an LCD typically consists of a layer of molecules aligned between two
transparent electrodes, and two polarizing filters, the axes of transmission of which are (in
most of the cases) perpendicular to each other. With no liquid crystal between the polarizing
filters, light passing through the first filter would be blocked by the second (crossed)
polarizer..
LCD Operation:
In recent years the LCD is finding widespread use replacing LEDs (seven-segment
LEDs or other multisegment LEDs). This is due to the following reasons:
The LCD discussed in this section has 14 pins. The function of each pin is given in
the table below.
While VCC and VSS provide +5V and ground, respectively, VEE is used for controlling
LCD contrast.
R/W, Read/Write:
R/W input allows the user to write information to the LCD or read information from
it. R/W=1 when reading; R/W=0 when writing.
E, Enable:
The enable pin is used by the LCD to latch information presented to its data pins.
When data is supplied to data pins, a high-to-low pulse must be applied to this pin in order
for the LCD to latch in the data present at the data pins. This pulse must be a minimum of
450ns wide.
D0-D7:
The 8-bit data pins, D0-D7, are used to send information to the LCD or read the
contents of the LCD’s internal registers.
To display letters and numbers, we send ASCII codes for the letters A-Z, a-z, and
numbers 0-9 to these pins while making RS=1.
There are also instruction command codes that can be sent to the LCD to clear the
display or force the cursor to the home position or blink the cursor. Table lists the instruction
command codes.
We also use RS=0 to check the busy flag bit to see if the LCD is ready to receive
information. The busy flag is D7 and can be read when R/W=1 and RS=0, as follows: if
R/W=1, RS=0. When D7=1 (busy flag=1), the LCD is busy taking care of internal operations
and will not accept any new information.
Note: It is recommended to check the busy flag before writing any data to the LCD.
Code ( Command to LCD Instruction Register
Hex )
2 Return home
1 Vss Ground
7 D0 Data Bit 0
8 D1 Data Bit 1
9 D2 Data Bit 2
10 D3 Data Bit 3
11 D4 Data Bit 4
12 D5 Data Bit 5
13 D6 Data Bit 6
14 D7 Data Bit 7
15 A +4.2 for Back light Positive supply for back light if available
In some LCD's you might not find the 15 and 16 pin so don’t worry. Here is how you
must wire them up.
UNIVERSAL MOTOR
A universal motor is a special type of motor which is designed to run on either DC or single
phase AC supply. These motors are generally series wound (armature and field winding are
in series), and hence produce high starting torque (See characteristics of DC motors here).
That is why, universal motors generally comes built into the device they are meant to drive.
Most of the universal motors are designed to operate at higher speeds, exceeding 3500 RPM.
They run at lower speed on AC supply than they run on DC supply of same voltage, due to
the reactance voltage drop which is present in AC and not in DC.
There are two basic types of universal motor : (i)compensated type and (ii) uncompensated
type
A universal motor works on either DC or single phase AC supply. When the universal
motor is fed with a DC supply, it works as a DC series motor. (see working of a DC series
motor here). When current flows in the field winding, it produces an electromagnetic field.
The same current also flows from the armature conductors. When a current carrying
conductor is placed in an electromagnetic field, it experiences a mechanical force. Due to this
mechanical force, or torque, the rotor starts to rotate. The direction of this force is given by
Fleming's left hand rule. When fed with AC supply, it still produces unidirectional torque.
Because, armature winding and field winding are connected in series, they are in same phase.
Hence, as polarity of AC changes periodically, the direction of current in armature and field .
Universal motors find their use in various home appliances like vacuum cleaners, drink
and food mixers, domestic sewing machine etc.
The higher rating universal motors are used in portable drills, blenders etc.
ADVANTAGE AND APPLICATION:
ADVANTAGE:
It implement is too safety to detect fault
The motor life can be improved
It is highly efficient
APPLICATION:
Commercial application
Indutrisal applicaton
CODING:
#include <16F877A.h>
#device *=16
#device adc=10
#use delay(clock=10000000)
#fuses HS,NOLVP,NOWDT,PUT,NOPROTECT,BROWNOUT
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
int dsec = 0;
int disp= 0;
int disp_bk = 0;
//////modbus variable////////
int sim_mode = 0;
int16 TEMPRATURE = 0;
int16 SPEED = 0;
int16 VBRS1 = 0;
int16 VBRS2 = 0;
int16 VBRS3 = 0;
//int16 VIBS = 60;
int msg = 0;
int16 flag = 0;
//int16 in_flag = 0;
//int16 spd_cnt = 0;
//int16 spd_stp = 0;
//int16 vbs_cnt = 0;
//int16 SEN_TIMER = 0;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void lcdready(void)
EN_LCD=0;
EN_LCD=1;
}*/
delay_us(500);
EN_LCD =0;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////
///////// LCD Command
Routine////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////
delay_ms(dsec);
////////////////////////////////////////////////////////////////////////////////
void lcdsetting(void)
{
command(0x38); // lcd 2 line ,5x7 matrix
delay_ms(1);
#byte ADCON_0=0X1F
#byte ADCON_1=0X9F
int16 AI[8];
int i;
int16 avg_tot = 0;
SET_TRIS_A( 0xff );
setup_adc_ports(AN0_AN1_AN2_AN3_AN4);
setup_adc(ADC_CLOCK_INTERNAL);
for(i=0;i<chn;i++)
avg_tot = 0;
set_adc_channel(i);
select = 1;
read_adc(ADC_START_ONLY);
while(select == 1)
}
delay_us(1);
set_adc_channel(i);
select = 1;
read_adc(ADC_START_ONLY);
while(select==1)
delay_us(1);
set_adc_channel(i);
select = 1;
read_adc(ADC_START_ONLY);
while(select==1)
delay_us(1000);
set_adc_channel(i);
select = 1;
read_adc(ADC_START_ONLY);
while(select==1)
delay_us(1000);
AI[i] = avg_tot / 4 ;
}
/////////////////////////////////////////
VBRS1 = AI[0];
VBRS2 = AI[1];
VBRS3 = AI[2];
// SPEED = (int16)((float)AI[2]*0.14718);
else
if(TEMP == 0)
TEMPRATURE++;
delay_ms(50);
TEMPRATURE = 0;
////////////////////////////////////////////
lcdsetting();
dsec = 10;
delay_ms(2000);
////////////////////////////////////////////
void main(void)
{
SET_TRIS_E( 0x00 );
sim_mode = 0;
setup_adc_ports(AN0_AN1_AN2_AN3_AN4);
setup_adc(ADC_CLOCK_INTERNAL);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_32);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RTCC);
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
port_b_pullups(TRUE);
TITLE ();
GROUND = 1;
lcdsetting();
dsec = 0;
for(;;)
{
// lcdsetting();
dsec = 10;
printf(display,"TEMPRATURE:%04ld",TEMPRATURE);
printf("TEMPRATURE:%04ld\n\r",TEMPRATURE);
printf("TEMPRATURE:%04ld\n\r",VBRS1);
delay_ms(500);
readAIstatus ();
}
CONCLUSION:
During the design as well as during the construction greater care has been put into
avoid hiccups the final stage. The PCB layouts were prepared with utmost care to
incorporate the circuits in a modular manner. The circuits are made as simple as to our
knowledge. Also components were selected keeping in mind their availability and cost.
It was a very interesting process of developing the prototype, stage by stage and
testing the same. We have to go through fairly pages of data related to the components
etc. it was a useful and full filling assignment to get the project completed in time. This