Free Essay

Engeenering

In:

Submitted By txt121
Words 427
Pages 2
SCHOOL OF ENGINEERING
YEAR 3 MECHATRONICS ASSIGNMENT

LAB REPORT

Reading an Analogue Voltage from a Potentiometer to turn a Motor on and off with reading of 40

Assignment 2
Owais Jahanzeb
BENG Mechanical Engineering with buissness

Lecturer: Dr. Tom Shenton

Aim & Objectives The aim of this lab is to develop a functioning program for the PICDEM board to read an analogue signal from a potentiometer and turning a motor on or off if the signal exceeds a certain limit. The program should depict the function that it should turn the motor ON and OFF if the potentiometer reading is less than or equal to 40. The practical uses of such program can be seen in automotive , injection moulding machines, wood processing machines, modern temperature controlled plants, speed control torque operations.

Developing Program 1

Figure 1. The schematic circuit & PICDEM board configuration for Program
Figure 1. The schematic circuit & PICDEM board configuration for Program

The objective of program is to read the correspondent voltage analogous to the potentiometer position and switch the motor on if the reading is over 40 and switch it off if the reading is less than or equal to 40, the value can be adjusted by twisting the screw clockwise and anticlockwise. The program works by implementing the following code.

PIC program for Test of potentiometer with value less equal to 40 with comments: include <p16f917.inc> extern DisplayDigit1, DisplayDigit2, DisplayDigit3 extern DisplayDigit4, InitLCD extern DisplayA, DisplayV, DisplayK, DisplayOmega extern DisplayRC, DisplayBATT, DisplayNeg, DisplayAC extern Display2DP, Display3DP, Display4DP extern DisplayDH, DisplayRH extern DisplayS1, DisplayS2, Displaym, DisplayM extern DisplayDecimal extern DisplayHex
STARTUP code ; linker command goto Start
PORT1 code ; linker command
Start
call InitLCD ; Set LCD registers bsf STATUS,RP0 ; Accessing Bank 1 bcf TRISD,7 ; Set RD7 as an output bcf STATUS,RP0 ; Going back to Bank 0 bsf ADCON0,ADON ; set A/D Module
LoopOuter
bsf ADCON0,GO_DONE ; start the A/D cycle
LoopInner
btfsc ADCON0,GO_DONE ; check if translation A/D is complete skip next command goto LoopInner ; if not clear keep checking movf ADRESH,w ; move highest bit of the conversion value to w call DisplayDecimal ; To show as decimal on LCD
CheckValue
movf ADRESH,w ; move highest 8 bit of the conversion to w sublw .40 ; subtract w from 40 btfss STATUS,C ; Check if w is greater than 40 goto motor_on ; turn on motor motor_off bcf PORTD,7 ; turn off motor clear PORTD 7 goto LoopOuter ; go back to beginning motor_on bsf PORTD,7 ; turn on motor goto LoopOuter ; go back to beginning
end

Similar Documents

Premium Essay

Finance Analysis

...INTRODUCTION We are required to collect stock prices of 35 public listed companies. There are 20 Malaysia, 5 United State, 5 United Kingdom, 5 Indonesia and KLCI index for the period of 2006 until 2013 based on weekly basis. Malaysia stock prices in this project based on Bursa Saham Malaysia. The stock prices of 20 Malaysia public listed company named by Prostaco, Raya International, Tiong Nam, Tong Herr, Toyo Ink, TSH, Turiya, United, Vitrox, UPA Corporation, Zecoon, Yokohama Industries, Woodlandoor, Wong Engeenering, White Horse Berhad, Whelcal Holding, Weida, Warisan TC Holding, Yinson Holding Berhad and YTL Power. While, the stock prices of 5 United State public listed company named by Adobe System INC, Alaska Air Group INC, Apple INC, The Aes Corporation and The NewYork Mellon Corporation. For stock prices of 5 United Kingdom public listed company named by Barclay, Bg Group, Big Yellow Group, Black Mount and Bovis Homes and lastly for the stock prices of 5 Indonesia public listed company named by Astra International, Bank Central Asia, Bank Danamon Indonesia, Kimia Farma and Unilever Indonesia. We also are required to demonstrate and explain the computations of annual return, risk, Sharpe ratio, return, covariance, beta, Treynor Ratio, portfolio standard deviation, and build a graph.  THEORETICAL CONCEPTS In this assignment, we used the formula of Variances, Annual, Standard Deviation, Covariance, Correlation Coefficient, Beta, Variance Of Portfolio, Risk, Sharpe Ratio...

Words: 2070 - Pages: 9