program, code of program and screen shot of output (universal driver using µc p89c51)

19
Raisoni College of Engineering An Autonomous Institution under UGC Act 1965 |Accredited by NBA & NAAC ‘A’ Grade DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION ENGINEERING Session: 2015-2016 (EVEN Semester) Semester/Branch/Section: –VII / ETC – C Name of Subject: Embedded System TAE 3 Report on: Program, Code of Program and Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51) Submitted by: Akash Shahu (Roll No. 26) Ashish Pandey (Roll No. 30) Sumitted To:

Upload: ashish-pandey

Post on 15-Jan-2017

31 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

Raisoni College of EngineeringAn Autonomous Institution under UGC Act 1965 |Accredited by NBA & NAAC ‘A’ Grade

DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION ENGINEERING

Session: 2015-2016 (EVEN Semester)

Semester/Branch/Section: –VII / ETC – CName of Subject:

Embedded SystemTAE 3

Report on:

Program, Code of Program

and

Screen Shot of Output

(UNIVERSAL DRIVER USING µc P89c51)

Submitted by:

Akash Shahu (Roll No. 26)

Ashish Pandey (Roll No. 30)

Sumitted To:

Prof. S. Nimkar

E&TC Department, G.H.R.C.E.

Page 2: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

Report on:

Program, Code of Program and Screen Shot of Output

UNIVERSAL DRIVER USING µc P89c51

INTRODUCTION:

* Motors are considered as one of the most important part of an Industry. All the functions of the industries works on different types of motors. There are various types of motors being used in industry depending upon its application. The Ac and Dc motor required different type of controller to control the speed of motor .

* But actually our aim to design universal drive controller.

* The Whole hardware structure can be processed in a single central unit and can be termed as a universal controller. Temperature sensors, Current sensors, Speed sensors etc can be included into the hardware as per the application requirement .

Block Diagram:

Laptop

GUI

Source

Converter or

Charger 12v

AC Motor Driver

DC Motor Driver

USB TO

SERIAL

COMMUNICATIO

N

µc P89c51

AC MOTORDC MOTOR

REGULATOR IC

5V (7805)

Page 3: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

Methodology:

There are two methods used while designing the controller

DC Controller:

For DC motor control is done by using a simple voltage divider method.

AC Controller:

Why use PWM for speed variation?

When an AC motor is connected directly to an AC line (415V 3Φ for example) the motor speed is fixed and is calculated as follows

𝑛𝑠=120∗𝑓/𝑝 − 𝑠𝑙𝑖𝑝

ns = Motor speed (RPM)

f = fundamental frequency(Hz)

p = no. of poles

Controller

Page 4: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

8051 micro-controller(P89V51RD2):

Features:-

8051 Central Processing Unit

5 V Operating voltage from 0 to 40 MHz

64kB of on-chip Flash program memory

Supports12-clock/6-clock mode

SPI(Serial Peripheral Interface)

Three 16-bit timers/counters

TTL- and CMOS-compatible logic levels

RXD/TXD Pins available

Page 5: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

L293D (Motor Driver IC):

Wide Supply-Voltage Range: 4.5 V to 36 V.

Separate Input-Logic Supply.

Thermal Shutdown.

High-Noise-Immunity Inputs.

Peak Output Current 2 A Per Channel (1.2 A for L293D)

Page 6: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

Software Required:

FLASH MAGIC - This software helps to dump the program opcodes to the microcontroller. This allows easy access to all the ISP features by the device. i.e. programming the flash memory, Reading from flash memory.

Embedded PCB Designer - This will help for designing the circuit on the printed circuit board.

MATLAB version 2012 – This software would provide a graphical user interface (GUI) between machine and man it will be used for creating a graphical user interface for the application with the help of components available on the window. The application software to interface hardware system connected to PC using COM ports and provide GUI interface.

Advantages

A controller design for Torque control of AC & DC motor

Starter-less operation.

The Whole hardware structure can be Reconfigurable as universal controller.

This controller also gives an intelligent motor control (IMC) operation.

Speed control of any motor is important because required speed to accomplish a specific task

Application

This system may be used to run High graded Industrial Motors according to speed requirement.

Both AC as well as DC Drive will be in on system.

The system will be software controlled. So the user can enable or disable the system from his/her office room.

Page 7: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

Screen Shot:

OPERATING SCHEME

When both motor are off:-

When DC is operating

Page 8: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

When AC motor is operating

Coding/Programming in MATLAB Tool:--------------------------------------------------------------

; TRIAC -> P1.0 || ZERO CREOSING -> P3.7

; FIRE OFF TIMING : 4ms, 8ms, 12ms, 16ms

;------------------------------------------------------------

$MOD51

TRIAC EQU P1.0

HIGH_TIME EQU R0

LOW_TIME EQU R1

RELAY_12V EQU P0.0

RELAY_9V EQU P0.1

RELAY_5V EQU P0.2

MOV P0,#0FFH ; INTIALLY ALL RELAY OFF

CLR TRIAC ; INITALLY MAKE MOTOR OFF

Page 9: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

MOV P2,#0FFH ; MAKE PULLUP HIGH

MOV P3,#0FFH ; MAKE SENS DATA HIGH

MOV TMOD,#21H ; TIMER 0 SELECTED, enable timer1, mode 2 (auto reload)

MOV TH0,#0FFH ; LOAD VALUE

MOV TL0,#0FEH

MOV TH1,#0FDH ;9600 Baud rate

MOV SCON,#50H ;8 bit, 1 stop bit, REN enabled

SETB TR1

MOV R7,#00H ;USED TO ENABLE LOOP

MOV SBUF,A

JNB TI,$

CLR TI

START:

JNB RI,$

CLR RI

MOV A,SBUF

SJMP KEY_1

CHECK_KEYS:

JNB RI,CHECK_SENSOR

CLR RI

MOV A,SBUF

SJMP KEY_1

CHECK_SENSOR:

CJNE R7,#01H,CHECK_KEYS

MOV TH0,HIGH_TIME ; LOAD DEFAUL VALUE

MOV TL0,LOW_TIME

CLR TF0 ; CLEAR TF0 FLAG

CLR TRIAC ; OFF TRAIC

SETB TR0 ; START TIMER 0

Page 10: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

JNB TF0,$ ; WAIT TILL FLAG SET I.E.(ALPHA ANGLE FOR FIRING)

SETB TRIAC ; BETA ANGLE

SJMP CHECK_KEYS

;-----------------------------------------------------------

; 13ms => 65536uS - 13000uS => 52536uS => DD38 => 25% SPEED

;-----------------------------------------------------------

KEY_1:

CJNE A,#'5',KEY_2

MOV HIGH_TIME,#0CDH

MOV LOW_TIME,#38H

MOV R7,#01H

LJMP CHECK_KEYS

;-----------------------------------------------------------

; 10ms => 65536uS - 10000uS => 55536uS => D8F0 => 50% SPEED

;-----------------------------------------------------------

KEY_2:

CJNE A,#'6',KEY_3

MOV HIGH_TIME,#0D8H

MOV LOW_TIME,#0F0H

MOV R7,#01H

LJMP CHECK_KEYS

;-----------------------------------------------------------

; 8ms => 65536uS - 4000uS => 61536uS => F060 => 75% SPEED

;-----------------------------------------------------------

KEY_3:

CJNE A,#'7',KEY_4

MOV HIGH_TIME,#0F0H

MOV LOW_TIME,#60H

MOV R7,#01H

LJMP CHECK_KEYS

;-----------------------------------------------------------

; 0.05ms => 65536uS - 50uS => 65486uS => FFCE => 100% SPEED

;-----------------------------------------------------------

Page 11: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

KEY_4:

CJNE A,#'8',AC_OFF

MOV HIGH_TIME,#0FFH

MOV LOW_TIME,#0CEH

MOV R7,#01H

LJMP CHECK_KEYS

AC_OFF:

CJNE A,#'9',DC_5V

CLR TRIAC

MOV R7,#00H

LJMP CHECK_KEYS

;############################################################

; DC MOTOR

;############################################################

DC_5V:

CJNE A,#'2',DC_9V

SETB RELAY_12V ;OFF RELAY

SETB RELAY_9V ;OFF RELAY

CLR RELAY_5V

DC_9V:

CJNE A,#'1',DC_12V

SETB RELAY_12V ;OFF RELAY

SETB RELAY_5V ;OFF RELAY

CLR RELAY_9V

DC_12V:

CJNE A,#'3',DC_OFF

SETB RELAY_9V ;OFF RELAY

SETB RELAY_5V ;OFF RELAY

CLR RELAY_12V

DC_OFF:

CJNE A,#'4',ALL_OFF

SETB RELAY_12V ;OFF RELAY

SETB RELAY_9V ;OFF RELAY

SETB RELAY_5V

Page 12: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

ALL_OFF:

CJNE A,#'0',RETURN_KEY

CLR TRIAC

MOV R7,#00H

SETB RELAY_12V ;OFF ALL RELAY

SETB RELAY_9V

SETB RELAY_5V,

RETURN_KEY:

LJMP CHECK_KEYS

;*******************************************************************

; SERIAL SETTINGS FUNCTION

;*******************************************************************

SERIAL:

MOV TMOD,#20H ;enable timer1, mode 2 (auto reload)

MOV TH1,#0FDH ;9600 Baud rate

MOV SCON,#50H ;8 bit, 1 stop bit, REN enabled

SETB TR1

RET

;*******************************************************************

; FUNCTION FOR SENDING CHARACTER

;*******************************************************************

SEND_CHAR:

MOV SBUF,A

JNB TI,$

CLR TI

RET

;*******************************************************************

; FUNCTION FOR RECEIVING CHARACTER

;*******************************************************************

RECV_CHAR:

JNB RI,$

CLR RI

MOV A,SBUF

RET

Page 13: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

;------------------------------------------------------------

; TRIAC -> P1.0 || ZERO CREOSING -> P3.7

; FIRE OFF TIMING : 4ms, 8ms, 12ms, 16ms

;------------------------------------------------------------

$MOD51

TRIAC EQU P1.0

HIGH_TIME EQU R0

LOW_TIME EQU R1

RELAY_12V EQU P0.0

RELAY_9V EQU P0.1

RELAY_5V EQU P0.2

MOV P0,#0FFH ; INTIALLY ALL RELAY OFF

CLR TRIAC ; INITALLY MAKE MOTOR OFF

MOV P2,#0FFH ; MAKE PULLUP HIGH

MOV P3,#0FFH ; MAKE SENS DATA HIGH

MOV TMOD,#21H ; TIMER 0 SELECTED, enable timer1, mode 2 (auto reload)

MOV TH0,#0FFH ; LOAD VALUE

MOV TL0,#0FEH

MOV TH1,#0FDH ;9600 Baud rate

MOV SCON,#50H ;8 bit, 1 stop bit, REN enabled

SETB TR1

MOV R7,#00H ;USED TO ENABLE LOOP

MOV SBUF,A

JNB TI,$

CLR TI

START:

JNB RI,$

CLR RI

MOV A,SBUF

SJMP KEY_1

CHECK_KEYS:

JNB RI,CHECK_SENSOR

CLR RI

Page 14: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

MOV A,SBUF

SJMP KEY_1

CHECK_SENSOR:

CJNE R7,#01H,CHECK_KEYS

MOV TH0,HIGH_TIME ; LOAD DEFAUL VALUE

MOV TL0,LOW_TIME

CLR TF0 ; CLEAR TF0 FLAG

CLR TRIAC ; OFF TRAIC

SETB TR0 ; START TIMER 0

JNB TF0,$ ; WAIT TILL FLAG SET I.E.(ALPHA ANGLE FOR FIRING)

SETB TRIAC ; BETA ANGLE

SJMP CHECK_KEYS

;-----------------------------------------------------------

; 13ms => 65536uS - 13000uS => 52536uS => DD38 => 25% SPEED

;-----------------------------------------------------------

KEY_1:

CJNE A,#'5',KEY_2

MOV HIGH_TIME,#0CDH

MOV LOW_TIME,#38H

MOV R7,#01H

LJMP CHECK_KEYS

;-----------------------------------------------------------

; 10ms => 65536uS - 10000uS => 55536uS => D8F0 => 50% SPEED

;-----------------------------------------------------------

KEY_2:

CJNE A,#'6',KEY_3

MOV HIGH_TIME,#0D8H

MOV LOW_TIME,#0F0H

MOV R7,#01H

LJMP CHECK_KEYS

;-----------------------------------------------------------

; 8ms => 65536uS - 4000uS => 61536uS => F060 => 75% SPEED

;-----------------------------------------------------------

Page 15: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

KEY_3:

CJNE A,#'7',KEY_4

MOV HIGH_TIME,#0F0H

MOV LOW_TIME,#60H

MOV R7,#01H

LJMP CHECK_KEYS

;-----------------------------------------------------------

; 0.05ms => 65536uS - 50uS => 65486uS => FFCE => 100% SPEED

;-----------------------------------------------------------

KEY_4:

CJNE A,#'8',AC_OFF

MOV HIGH_TIME,#0FFH

MOV LOW_TIME,#0CEH

MOV R7,#01H

LJMP CHECK_KEYS

AC_OFF:

CJNE A,#'9',DC_5V

CLR TRIAC

MOV R7,#00H

LJMP CHECK_KEYS

;############################################################

; DC MOTOR

;############################################################

DC_5V:

CJNE A,#'2',DC_9V

SETB RELAY_12V ;OFF RELAY

SETB RELAY_9V ;OFF RELAY

CLR RELAY_5V

DC_9V:

CJNE A,#'1',DC_12V

SETB RELAY_12V ;OFF RELAY

SETB RELAY_5V ;OFF RELAY

CLR RELAY_9V

DC_12V:

Page 16: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

CJNE A,#'3',DC_OFF

SETB RELAY_9V ;OFF RELAY

SETB RELAY_5V ;OFF RELAY

CLR RELAY_12V

DC_OFF:

CJNE A,#'4',ALL_OFF

SETB RELAY_12V ;OFF RELAY

SETB RELAY_9V ;OFF RELAY

SETB RELAY_5V

ALL_OFF:

CJNE A,#'0',RETURN_KEY

CLR TRIAC

MOV R7,#00H

SETB RELAY_12V ;OFF ALL RELAY

SETB RELAY_9V

SETB RELAY_5V,

RETURN_KEY:

LJMP CHECK_KEYS

;*******************************************************************

; SERIAL SETTINGS FUNCTION

;*******************************************************************

SERIAL:

MOV TMOD,#20H ;enable timer1, mode 2 (auto reload)

MOV TH1,#0FDH ;9600 Baud rate

MOV SCON,#50H ;8 bit, 1 stop bit, REN enabled

SETB TR1

RET

;*******************************************************************

; FUNCTION FOR SENDING CHARACTER

;*******************************************************************

SEND_CHAR:

MOV SBUF,A

JNB TI,$

Page 17: Program, Code of Program and  Screen Shot of Output (UNIVERSAL DRIVER USING µc P89c51)

CLR TI

RET

;*******************************************************************

; FUNCTION FOR RECEIVING CHARACTER

;*******************************************************************

RECV_CHAR:

JNB RI,$

CLR RI

MOV A,SBUF

RET