• No results found

MECHATRONICS 3TA4 Final 2007

N/A
N/A
Protected

Academic year: 2020

Share "MECHATRONICS 3TA4 Final 2007"

Copied!
9
0
0

Loading.... (view fulltext now)

Full text

(1)

MECHATRONICS 3TA4 — Final 2007

Problem 1

Parta

ln an electrical system, a ground loop refers to a (generally unwanted) current in a conductor connecting two points that are supposed to be at the same potential, often ground, but are actually at different potentials. If we have two different potentials for ground, the result will be a floating voltage and it is unclear as to what logic O should be considered.

Pmtb

?artc

To use the PWM function, we first have to choose a repeat period such that the motor has time to react

appropriately. If this period is too short, the motor will see the input either on all the time or off all the

time regardless of the pulse width. The width of the pulse will be determined by three things: the repeat

period, max voltage, and target voltage. The ratio between the desired and max voltage will dictate what percentage of the repeat period for which the lVlCU should keep the output pin high.

Part cl + e

See other final.

.€f@b1sm2-?arta@-b

See other final.

Parts

The output is counting up to 89 instead of S9 (or so it would seem) because the RTC outputs values

encoded in BCD: binary coded decimal. BCD separates and stores every digit into a nibble (4 bits) then

the whole number will be added together (not an actual addition, just the first number followed by teh second, etc). For example, Sin BCD is 0101. 9 in BCD is 1001. Therefore the value returned by the RTC is 101 1001. A direct binary to decimal conversion without decoding will return 89 instead of the actual

value of 59.

‘s... Us J

fa; 2.

unsigned int bcd to dec(unsigned char bac)

return (((bcd >> 4) & Obllll)*lO + (bcd & 0xOF));

(2)

Parte

Partf

unsigned char rtc readlunslgned LHC address)

l’

1n

unsigned char v;

i2c_sta:t();

i2c_write{rtc_addr), i2c write{addressl; i2c startil;

i2c writelrtc add: I1);

t = i2c read{O); i2c stopi);

return v;

l

//somewhere in the main function

rtc read(0x04i; //hours

rtc read{Cx33;; //minutes

rtc read(0x02}; //seconds

Problem 3%“

Parts

There are two assumptions made when analysing an op amp, the first states that there lS no current

going into the op amp’s inputs. The second is that the voltages at the op amp’s inputs are the same

Partb

c=s><1o5 (;=V—___"_"-V-;->v,,=c-(vt-v-)

1

120 = G ' (l/T — VT) I (1000OO)(—l — 5)><10' = —O 6V

r I

120 = G - (VT — l/T) I (1000OO)(O — 5)><10' I -0 5l/

2',-'5‘

l_;

11,, = 0 - (Vt - v-) = (100000)(2s + 5) >< 10* = 3 or

{ -~,,—.§. ~.

i i

I R,-Ll, U0 I =

2:, vo R; 12,,

(3)

Partd

Because there is no current flowing through the op amp’s inputs, the R30 resistor is not doing anything. In addition, since current is not flowing through the resistor there is no voltage drop across the resistor therefore no voltage (OV) to the op amp’s input. This must mean that v,- = 0. If this is the case,

£5? = % = undefined; to remedy this problem, we need to replace R30 and put it between ground and the junction of R29 and the op amp’s input. In addition, the value for R29 should be 20k if we want an

amplification of 3, ie i—° = 3.

&_%—n

R1 R2

R2 12,, — v, 120

, 3- -. . : N 1

R1 vi vi

R2

-—=3—1=2

R1

The ratio between R29 and R30 should 2 for a 3X amplification, we therefore need to change the

resistor values accordingly (ie R29 = 20k).

131:1 9

1 we = 6OHz = — T

— 1 -Rc

{'60-1 1

R *= "I ~ " 1671611

60><C 60><0.1>< 10“

w—_ (=

%’¢a11"ii§

l

1

ZO:§'i‘R2

1

Z[:§‘i"Rl"i“R2

1

G :1/‘3_ -§5_+-R2.

1

1

‘*1

§+R,+R,

1 Z

§C="i'R2

G2/rieril 2 51X G1" 1

(4)

l\/IECHATRONICS 3TA4 — Final 2008

— _ __ __ __ __3 __ ____;__" 7 ' __ *— —*s ' ——~r _ _ __ r— _ _ _ ' _ ___ __ 11

Problem

?arta

The three different types of memory typically integrated into an AVR microcontroller are:

0 FLASH ROM: non-volatile memory where the program code is stored.

0 EEPROM: non-volatile memory that is byte-addressed, and easily changed at run-time.

0 RAM: volatile memory that stores your variables and data at run time.

Partb

0 RS-232 (Recommended Standard 232): full-duplex a/synchronous serial interface for connecting

external devices reliably over long distances. This protocol differs from the others due to the following reasons:

O O

Uses voltage higher than +3V for logic 0

Uses voltage lower than -3V for logic 1

or Voltage near 0V signify a break in the line therefore providing some degree oferror detection

<1 SPl (Serial Peripheral Interface): full-duplex synchronous serial interface for connecting low/medium-bandwidth external devices using four wires. SPl devices communicate using

a master/slave relationship over two data lines and two control lines:

O

O

f\l

\../

O

Master Out Slave In (MOSI): supplies the output data from the master to the inputs of the slaves.

Master In Slave Out (MISO): supplies the output data from a slave to the input ofthe master. It is important to note that there can be no more than one slave that is transmitting data during any particular transfer.

Serial Clock (SCLK): a control line driven by the master, regulating the flow of data bits. Slave Select (SS): a control line that allows slaves to be turned on and off

with hardware control.

~ IZC (lnter-Integrated Circuit): two wire serial bus protocol used by peripheral lC's in electronic systems to communicate with each other using simple communication hardware. The two wires are depicted as Serial-to-Data (SDA) and Serial-Clock-Line (SCL). Communication can occur in both directions separately but not simultaneously and there can only be one master and one slave active on the bus at any one time.

Fartc

(5)

Problem, 2%

Parta

(32),O = (20),6 H 32 = 0120

Part iii

(]IF)]_6 :(31)1O 9") "—'-'

Partc

The counter will need log; 32 = 5 bits to encode the inputs from the disk This is assuming of course,

that the counter only supports counting for a full revolution and will reset to 0 when it reaches the initial

state.

Partd

The resolution r = —3y—6(-2- = 11.25 0/

22 pulses

pulse

Parts

1 1 I 1

l l l

I 1 l +q-v-.--Q.»--.

i

C.;..{.‘{) r

(“-Z/_,/

Encoder Ch. A ?\

(L; Q‘;

.L_<e_d

dwn/up

~—i2" Clk

Encoder Ch. B J

V i

V

(I C1; C};

'3 (Zr {IQ

Counter

'1:~41 F‘. £1

?nflflena3

T‘-‘=3-*§= .= $3525 £51

The purpose for the pull-up resistors at these locations is to avoid a floating voltage when the line is not in use. Since all these lines act as inputs at one time or another, they need to be able to take on either logic 0 and logic 1 at all times. Without the pull-up resistor, the lines are capable of logic 0 (when the controllers connect to ground) and a floating voltage when not in use With the resistor the line lS asserted to logic 1 by default.

._..._.._._..l

__ ___ ._ I

-.._..,_____.1

Where x can be any port supported by the microcontroller.

DDRx = 0x00;

(6)

Pertc

The main advantage is less circuit parts and therefore lower cost of the overall system.

Partd

lt's not possible to use the internal resistors in this case because a much lower resistance is needed here

to be useful. If we were to use the internal resistors, we'd get a voltage which is lower than what the controller would consider logic 1.

Parte

PCICR=0x05;

PCMSKO=0x0l; //unmask interrupt for button 2

PCMSK2=0X04; //unmask interrupt for PGRT C, PIN 2

//Generate 152 signal for displaying time

PORTC.2=l; // Activate pull-up resistor for Port C, Pin 2.

rte write toiclkout addr,0b1000001l);l_

Partf

- ~ . e —@ *m“ = ' *0 ' '1 '11

incerrae- (ec Inrui void pc inc‘ isrgvei ,

unsigned char timefii = PCF8563 read timei&nrs,&mi:,&seci;

led clearii;

‘r-n ‘ ,/\_'—,v-\ -, n 13’J») I " ';_r\.' . _,_;>

tor ii—u,1<3,+1_i

i

.‘¢-' ’-:7 <']i'-_‘ ‘»-“ _..-:4:-‘lI"]" 44'- 1\v_‘.¢Li.\,’._‘i3 4"L |,_..,'£"1 ‘Qat-_/_ , ‘J /1

I C '"

F TJ

.1.{-3U1D l\)-~ D"'-J'\"'|"""\

O.4

}_..l\_._. '\

1. (T—

0 L *5CT

: D -it-.~,:. r~ v1

-.-;'~.._/_.~\ 4.- ~.. _. Hue. 1__v....,~';

.. (r*r4 ct‘ .»*'

L .. vb

- .- - .

-3.-{1 3-_ ,5.-,9-a-4-.'_..-\... .— ~._/.4 :-'_4L...D;.,

i

_l

P?Obi€H14

Parre

(7)

Partb

Two assumptions have to be made when analysing an ideal op amp the first assumption states that there is no voltage difference between the two inputs is 0; the second assumption states that there is no

current passing through either of the two inputs.

Partc

a=100000”/V c=F‘5_j’-F->v,, =0-(vt-i/—)

1'

I1’

Hi

?mtd

Parte

Knowingt

{}~'\ *'

E {"11 _ =._..

120 = G - (VT — V‘) = (100000)(1 — 5 >< ' = -0 4V

But the op amp saturates at 0V for negative inputs therefore output IS 0V

120 = a - (i/t - 1/") = (100000)(5 - 0 ><

"6 =

12,, = a - (vi - i/-) = (100000)(2s - 1 >< 10-6 =

V

sn

0.3 V/,,5

fbw

Zrta

2rr(4l/)

1

ZO:(F“i'SC2

:-Zi

( R1 ) .

12,, -——-———--—— ILIL

hat the currents passing through the junction A are equal due to the assumptions we

made in part b, we can manipulate the equation to discover the ga V = iZ

: SE1

-1

1 +5622,

120

sc,R.,

L’, _

1+sc2R,

-119 Hz

)_l 1 + 2

(8)

Problem 5

Parta

ATmeqe324F’ U2

K _ PE§fJlf2XI£;*-.=T€li '>

__;;1 eeiiii

V 1'15 R i

;___AJg

_

g

_ 3

. Peenurennun

F‘)

~ r‘ 2 _ .. 4 esri icrhiair-11 ;i

,-' ii

"’?’£~;.: U3 11.0

-I; ".r‘r,.z;

6 1

"U w m 21":501 I-‘

R

l

'1‘-/\—*

U1) P56 {ix~El'30’i 1313 4-5'\/‘ix PE-S? 1'5-Cit‘, ii .

i L. ‘ Q‘ y

_.._.__. F

4 _ . ,>.,- ,.

fal-_ ¢-i f-‘L; =;

\ _.i§ fix‘ ;i

_ T _____ _ii; ii 0 1'1

_____ TPS?8G33OE2O

iii

= l

nsv 6 Gi"€i')

its 1

__.__;__( A

__ ,”__ ,__,_ 1

T; ‘.1 ‘-1

» rii1'*J_;

is

_&-,,.--.- .

1"‘ l

i ‘*3 * 13 9

i 1 ,__ F __, iirniii

g iuur

3 l

r - , g 14 nonrnxni

_.._.__.

- my1“ - -“Oi ~'Ti'=i. 1"-1‘ '.,

i»-l

ih i !|i“li'Uj

1-" -. -_,_'_,_, i=1 15?. {ii-i ij

)3 1 i>i.u i_r;<:-.43: ‘H %”]£iLI11é@

.-=7"- g_-w-\

_, "l.i"_ii_a'_1"' [AQUIPAG ii\i'_>"=.)PA1 rneeiene (acaiena iA§4}F£4 [assigns {A§6)PA6 ineriear AREF GHQ AVCG iffieneieur iiuggiiens {T01} P135 i_'TCii'.)) F"1.i

{Ti-ii.’-ii P-‘I 3

?»-1- -\\..

i‘ ,i“‘i 3

.1>_ __.-_

;f;i3.~=i; .@>'i"‘.i .?EliYL} i’"="_Il‘. CF“ 311? 473 38 ‘G-\ -r 3}’ 36 35 34 1____. l ill’: .312 3? l 3a l l 1 EU l y EB .__.__ 1-1 '_ 1 .. l l an l25 Z-1 Z3 1"] '_ 1. ._..i.. 1; -Fi

(4-1-5) _ 15

(2.8 - 1.5) _

1.5

R,

TR,

R

2

15

- R3R7 R1

(9)

Partb

//’ enaiaie analag comp and interrupt on failing edge

ACSR = OXOA;

Parts

The purpose of this filter is to condition the signal coming from the temperature sensor. The low pass

References

Related documents

At a more common stage, studies have measured sophistication of controls, reliance on accounting performance events , dimensions of information such as scope,

Zou, “A recursive least M-estimate algorithm for robust adaptive filtering in impulsive noise: fast algorithm and conver- gence performance analysis,” IEEE Transactions on

It therefore develops a framework on mapping and integrating disaster risk reduction into the higher education at policy, practice and community levels.. This paper argues

Finally, concerning not only assisted editing tools but tools against vandalism generally, it is argued that the anonymity feature is a sensitive category: anons have been in

All stationary perfect equilibria of the intertemporal game approach (as slight stochastic perturbations as in Nash (1953) tend to zero) the same division of surplus as the static

(36 bits/20 ms) RPE parameters (47 bits/5 ms) From radio subsystem LTP parameters (9 bits/5 ms) + Short term synthesis filter Long term synthesis filter Post- processing Output

Effect of the amount of A206/1 wt % γAl 2 O 3 nanocomposite added and the temperature on the electrical conductivity of aluminum wires (measured as a percent of

 Applying Service Design methods and tools into internal processes in Company X through a pilot project and evaluating the benefits, challenges and key factors regarding