Vajad kellegagi rääkida?
Küsi julgelt abi LasteAbi
Logi sisse

Mikrokontrollerid ja robootika homework 1 (0)

1 Hindamata
Punktid
Mictrocontroller Week 03 
Numbering systems 
1.  Convert the decimal number 123.456 to the  following  formats, taking  whole  numbers and 
fractions into account . Show calculations. 
a)  Binary  
Fractional part
        Reading  direction   Integral part: 
       Reading direction 
0,456 x 2 = 0,912 

123 / 2 = 61 

0,912 x 2 = 1,812 

61 / 2 = 30 

0,812 x2 = 1,624 

30 / 2 = 15 

0,624 x 2 = 1,248 

15 / 2 = 7 

0,248 x 2 = 0,496 

7 / 2 = 3 

0,496 x 2 = 0,992 

3 / 2 = 1 

 

1  

 

 

 
So 123.45610 = 0111  1011 .0111 01002 
 
b) Hexadecimal 
Fractional part : 
 
Integral part : 
 
0,456 x 16 = 7,296 

123 / 16 = 7 
0,6875 x 16 =B(11) 
0,296 x 16 = 4,736 

7 / 16 = 0  
0,4375 x 16 = 7 
 
 
 
 
 
So 123.45610 = 7B.7416 
 
c)  base -5 
Fractional part: 
 
Integral part : 
 
0,456 x 5 = 2.28 

123 / 5 = 24 
0,6 x 5 = 3  
0.28 x 5 = 1,4 

24 / 5 = 4 
0,8 x 5 = 4 
0,4 x 5 = 2 

4 / 5 = 0 

 
 
 
 
 
So 123.45610 = 443.2125 
 
d) BCD 







0001 
0010 
0011 
 
0100 
0101 
0110 
 
 
2.  Extend the following unsigned 8-bit binary numbers to their 16-bit equivalents and convert 
the result  to hexadecimal. 
a)  011010112  
16-bit  equivalent is  0000 0000 0110 10112 
Result in hexadecimal = 006B16 = 6B16 
 
 
b)  101101012 
16-bit equivalent is 0000 0000 1011 01012 
   Result in hexadecimal = 00B516 = B516 
 
 
 
3. Extend the following signed two’s complement 8-bit binary numbers to their 16-bit 
equivalents and convert the result to hexadecimal. 
a)  011010112 
16-bit equivalent is  0000 0000 0110 10112 
Result in hexadecimal = 006B16 
 
b) 101101012 
16-bit equivalent is   1111  1111 1011 01012 
Result in hexadecimal = FFB516 
 
Logic and arithmetic 
4. Using two’s complement arithmetic, calculate the following (choose a  suitable number of 
bits for the representation): 
a)  121 – 185 = -64 
121 in 16-bit binary is 0000 0000 0111 1001  
-185 in 16-bit binary is 1111 1111 1011 1001 
-64 in 16-bit binary is 1111 1111 1100 0000 
 
00000000 01111001 
+     11111111 10111001 
--------------------------- 
       11111111 11000000  
 
b)  -70 – 88 = -158 
 
      11111111 10111010 

00000000 01011000 
------------------------- 
11111111 01100010 
 
 
5. Calculate the following  without  converting the number base. Show calculations. 
3A916 + 24D16 = 5F616 
 
     3A9 
+  24D 
--------- 
    5F6 
 
9 + D = 16 
A + 4 + 1 = F 
3 + 2 = 5 
 
6. Variable X contains the number of bytes to be read from an external device. Using a binary 
shift , write one line of pseudocode to calculate the number of bits to be read and store  the 
result in Y. 
 
1 byte = 8 bits  
Shift left = X ∗   2𝑛 , where n stands for how big the shift is. 
23 = 8, so we have to shift left by 3. 
 
Y = X shl 3 // shifts left by 3 bits, filling the empty bits on the right with zeros 
 
7. You have two Boolean variables A and B. Write down a logic expression using only the 
operators AND, OR and NOT that will evaluate to true if A and B are equal and to false  
otherwise. 
 
(A AND B) OR ((NOT A) AND (NOT B)) 
 
8. You have two strings stored in variables S1 and S2. Both strings are stored in ASCII  format  
and contain 8 bits per character and 20  characters  per string . Write pseudocode that will 
compare the strings without  case  sensitivity and return a Boolean result in variable Y 
indicating whether the strings match or not. 
 
Y = true; 
 
for i from 1 to 20; 
 
for j from 1 to 8, excluding 3; // first  bit is spared (omitted) and the second (third) bit for  upper  
 
 
bitindex = j + (i-1) ∗8; 
 
 
   if S1[bitindex] =! S2[bitindex]; 
 
 
   Y = false; 
 
 
    Exit   loop
 
 
   end; 
 
 
end; 
 
end; 
 
CPU  architecture  
9. Suppose a microprocessor adds the numbers shown below respectively. In each instance 
explain the influence  of the computation on the flag  register in terms of each of the flag bits Z, 
N, C, and V. Assume the processor can handle  8-bit binary  values using a two’s compliment 
representation. 
a) 60 + 80 
b) 60 – 80 
Range from -128 to 127.  
 
Equation 
Result 




Comment  
60 + 80 
140 




Produced 
carry(C) and 
overflow 
occurred (V) 
60 - 80 
-20 




Result is 
negative (N) 
 
Z remains 0, because result isn’t zero
 
Input and output 
10. You have four PROM modules like the below figure and a sufficient collection of logic 
gates. Drawcircuit   diagram showing how you can implement  4 kB of MP addressable 
memory  to your Microprocessor with12 address bits. 
 
PROM (Programmable Read Only Memory) scheme has 10 address  pins  
The input consists of 12 address bits. Use the most significant 2 bits to  select  a  
memory  chip and the least  significant 10 bits to select an address within the chip. The least  
significant 10 bits of the input address are  connected to the 10 address bits of each  
memory  module and the most significant 2 bits are connected to decoder and  
then to the decoder select pins, such that only one chip will be  active for each input combination. 
A PROM can address 210 = 1024 memory locations = 1 kB 
Four PROM chips will have 4kB of addressable memory. 
Microprotsessor can  access  212 = 4096 = 4kB locations. 
 
A0 
A0 
A0 
A0 
A1 
A1 
A2 
 
A1 
A1 
A2 
A2 
A2 
A3 
A3 
A3 
A3 
A4 
 
A4 
A4 
A4 
A5 
A5 
A5 
A5 
A6 
A6 
A7 
 
A6 
A6 
A7 
A7 
A7 
A8 
A8 
CS 
A8 
A8 
A9 
 
CS
A9 
CS 
A9 
A9 
CS 
 
 
 
 
A10 

 

DC  2 
A11   

 
 
 
11. You are designing a multi- user interface  that stores user preference data on external 
memory. You decided to use a PIC18F45K20 microcontroller and 24C02C  EEPROM  
memory. Your microcontroller needs to  generate a block wave  that will act as a  clock   signal  
to synchronize data  transfer to and from the memory. 
a) Choose a suitable clock frequency , based on the capabilities of the EEPROM module 
and the PIC. 
 
Suitable clock frequency is 0-400 kHz (from datasheet) 
 
b) Assume the clock frequency of the PIC is 16 MHz and one instruction cycle lasts 4 
clock periods.  Further  assume that one loop of your algorithm requires 4 
instruction cycles. Determine the total delay  time for completing a command cycle sent to 
EEPROM, assuming the clock in EEPROM is 100 kHz. 
 
EEPROM clock is 100kHz = 10 µs 
PIC clock is 16MHZ = 1 / 16 µs 
1
One loop command to PIC lasts 4 ∗ 4 ∗
 = 1 µs 
16
The delay for one cycle of EEPROM should be 0,5 cycle. 
Delay time for completing one command cycle is 5 µs + 1µs = 6 µs. 
 
 
 
12. You are designing an embedded system and need to communicate with a computer 
motherboard using an RS-232 interface. You decided to use a MAX232 driver to convert 
between the voltage  levels used by the PIC and those used by the RS-232 port (find a 
MAX232 datasheet on the  internet ). You are using a PIC18F45K20. Indicate, on the 
following diagram, how you would connect the PIC, the MAX232 and the RS-232 port. 
 
 
 
 
You have to connect following pins :  
 
MAX232:T1IN ↔ PIC:Tx  
MAX232:R1OUT ↔ PIC:Rx  
MAX232:R1IN ↔ RS232 :TxD  
MAX232:T1OUT ↔ RS232:RxD 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
Vasakule Paremale
Mikrokontrollerid ja robootika homework 1 #1 Mikrokontrollerid ja robootika homework 1 #2 Mikrokontrollerid ja robootika homework 1 #3 Mikrokontrollerid ja robootika homework 1 #4 Mikrokontrollerid ja robootika homework 1 #5 Mikrokontrollerid ja robootika homework 1 #6 Mikrokontrollerid ja robootika homework 1 #7
Punktid 10 punkti Autor soovib selle materjali allalaadimise eest saada 10 punkti.
Leheküljed ~ 7 lehte Lehekülgede arv dokumendis
Aeg2016-03-01 Kuupäev, millal dokument üles laeti
Allalaadimisi 6 laadimist Kokku alla laetud
Kommentaarid 0 arvamust Teiste kasutajate poolt lisatud kommentaarid
Autor Hendrik Karhu Õppematerjali autor
Kodutöö 1, max punktid

Sarnased õppematerjalid

Mictrocontroller Week 03
14
pdf

Mictrocontroller Week 03

Mictrocontroller Week 03 Numbering systems 1. Convert the decimal number 123.456 to the following formats, taking whole numbers and fractions into account. Show calculations. a) binary b) hexadecimal c) base-5 d) BCD === 1. a) 0111 1011.0111 01002 b) 7B.7416 c) 443.2125 d) 0001 0010 0011.0100 0101 01102 === 2. Extend the following unsigned 8-bit binary numbers to their 16-bit equivalents and convert the result to hexadecimal. a) 011010112 b) 101101012 === 2. a) 006B b) 00B5 === 3. Extend the following signed two’s complement 8-bit binary numbers to their 16-bit equivalents and convert the result to hexadecimal. a) 011010112 b) 101101012 === 3. a) 006B b) FFB5 === Logic and arithmetic 4. Using two’s complement arithmetic, calculate the following (choose a suitable number of bits for the representation): a) 121 – 185 b) -70 – 88 == 4. Convert back to verify answer == 5. Calculate the following without converting the number base. Show calculations.

Mehhatroonika
Homework 01
2
docx

Homework 01

Homework 1. a)123/2= 61,5; 61/2=30,5; 30/2=15; 15/2=7,5; 7/2= 3,5; 3/2=1,5 (1111011) 0.456*2=0.912; 0,912*2=1,824; 0,824*2=1,648; 0,648*2=1,296; 0,296*2=0,592; 0,592*2=1,184; 0,184*2=0,368; 0,368*2=0,736; (0,736*2=1,472; 0,472*2=0,944; 0,944*2=1,888) So b)123/16= 7,6875 ; 0,6875*16=11 ; 7/16 is less than one, then hex is 7B 0,456*16= 7,296 ; 0,296*16=4,736; 0,736*16=11,776; 0,776*16=12,416; 0,416*16=6,656; 0,656*16=10,496; 0,496*16=7,936; 0,936*16=14,976; 0,976*16=15,616; 0,616*16=9,856; 0,856*16=13,696; 0,696*16=11,136; 0,136*16=2,176; 2,176*16=2,816; 0,816*16=13,056 Hex is 7B.74BC6A7EF9DB22D c) 123,456/5=24,6912/5=4,93824/5=0,987648 0,987648*5=4,93824; 0,93824*5=4,6912; 0,6912*5=3,456; 0,456*5=2,28; 0,28*5=1,4; 0,4*5=2; 0*5=0 base-5 is d)BCD is 2. a) Unsigned 16-bit binary is 0000000001101011. Hexadecimal is 6B b) Unsigned 16-bit binary is 0000000010110101. Hexadecimal is B5 3. a) Signed two's c

Mikrokontrollerid ja praktiline robootika
CPM1A Programmable Controllers Operation Manual 1784470
402
pdf

CPM1A Programmable Controllers Operation Manual 1784470

Cat. No. W317-E1-11 SYSMAC CPM1A Programmable Controllers OPERATION MANUAL CPM1A Programmable Controllers Operation Manual Revised October 2007 iv Notice: OMRON products are manufactured for use according to proper procedures by a qualified operator and only for the purposes described in this manual. The following conventions are used to indicate and classify precautions in this manual. Always heed the information provided with them. Failure to heed precautions can result in injury to people or dam- age to property. ! DANGER Indicates an imminently hazardous situation which, if not avoided, will result in death or serious injury. Additionally, there may be severe property damage. ! WARNING Indicates a potentially hazardous situation which, if not avoided, could result in death or serious inju

Automatiseerimistehnika
Book Analog Interfacing to Embedded Microprocessors
568
pdf

Book Analog Interfacing to Embedded Microprocessors

Analog Interfacing to Embedded Microprocessors Real World Design Analog Interfacing to Embedded Microprocessors Real World Design Stuart Ball Boston Oxford Auckland Johannesburg Melbourne New Delhi Newnes is an imprint of Butterworth–Heinemann. Copyright © 2001 by Butterworth–Heinemann A member of the Reed Elsevier group All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Recognizing the importance of preserving what has been written, Butterworth–Heinemann prints its books on acid-free paper whenever possible. Library of Congress Cataloging-in-Publication Data Ball, Stuart R., 1956– Analog interfacing to embedded microprocessors : real world design / Stuart Ball. p. cm. ISBN 0-7506-7339-7 (pbk. : alk. paper) 1. Embedded computer

Mehhatroonika
Tööstuslik andmeside kontrolltöö 2 abimaterjal - vastused
3
doc

Tööstuslik andmeside kontrolltöö 2 abimaterjal - vastused

oData transparency: In bit and byte oriented protocols, there is a problem if a control character (for ETX (End of Text) ·Same as ETB, only no more blocks will follow. ITB (End of > Differences with HDLC ­ length of protocol field (1B or 2B) byte-oriented protocols) or the start-of-frame flag (for bit-oriented protocols) appears in the actual data. Intermediate Transmission Block) ·Same as ETB, except that the receiving statio Differs from HDLC because of multiaccess MAC that provides · Maximum payload length (default: 1500) This was not likely to happen in ASCII text, but is very likely with binary data. This is known as a data will not acknowledge after the error checking. EOT (End of Transmission) framing/error detection: · Type of CRC (2B or 4B) transparency problem an can be rectified with byte stuffing (for byte-orien

Tööstuslik andmeside
Programmeerimiskeel
555
doc

Programmeerimiskeel

tutvu lausearvutuse keskkonnaga: http://logik.phl.univie.ac.at/~chris/gateway/formular-uk-zentral.html Millistel muutuja väärtustel on lause (Av(B&A))v(-A&(Cv(B&-C))) väär? Panna tuleb results only, 0 on väär 1 on õige Tutvu ajalooga saidis kuni II maailmasõda: http://www.maxmon.com/history.htm Loe läbi jutt ja proovi andmetega mängida: http://math.hws.edu/TMCM/java/DataReps/index.html Kahend süsteemi arvu(101101001) ->kümnend süsteemiks. Nr sisse ja bianarile punkt, ja vaatan base ten integeri kümnendarvudest annab Ecki appletis juuresoleva graafilise kujutise, teen kujundi ja vaatan base integeri mis vastab kahendsüsteemi arvule 1110001 ASCII tabelis? Nr sisse ja punkt bianari, vaatan ...teksti Kümnendsüsteemi arv 33 on kahendsüsteemis? 33 kirjutan ja Base-ten integer, vaatan bianary Loe läbi jutud Atbashi ja Caesari šifri (Caesar cipher) kohta: http://www.wikipedia.org 2 Tutvu ajalooga kuni 1970ndad: http://www.islandnet.com/~kpolsson/comphist/ 47-68 ingli

Infotehnoloogia
Homework 1 in Microcontrollers and practical robotics
3
docx

Homework 1 in Microcontrollers and practical robotics

Homework 1 in Microcontrollers and practical robotics 1) a) 0 123.456 - 64 = 59.456 1 59.456 - 32 = 27.456 1 27.456 - 16 = 11.456 1 11.456 - 8 = 3.456 1 3.456 - 4 = 0 3.456 - 2 = 1.456 1 1 0.456 * 2 = 0.912 0 0.912 * 2 = 1.824 1 0.824 * 2 = 1.642 1 0.642 * 2 = 1.284 1 0.284 * 2 = 0.568 0 0.568 * 2 = 1.136 1 0.136 * 2 = 0.272 0 0,544 * 2 = 0,544 0 b)1111011.01110100 to hex 0111 => 7 1011 => 11 0111 => 7 0100 => 4 and so on.. answer is: 7B.74 c) 123.456 to base-5 100 = 400 20 = 40 3=3 400 + 40 + 3 = 443 5^-1 = 0,2 5^-2 = 0,04 5^-3 = 0,008 0,456/0,2 = 2 0,056/0,04 = 1,4 0,4/0,2 = 2 Final answer 443.212 d) 1 = 0001 2 = 0010 3 = 0011 4 = 0100 5 = 0101 6 = 0110 0001 0010 0011.0100 0101 0110 2) a) 16bit equivalent is a) 0000000001101011 the answer is 006B 1011 is in dec 11 and in hex B 0110 is in dec 6 and in hex also 6 b) 16bit equivalent is b) 0000000

Mikrokontrollerid ja praktiline robootika
Homework 2 Week 4
12
docx

Homework 2 Week 4

Week 4 homework. Question 1: 1. SNR – Ratio of root mean square signal to root mean square. 2. SINAD – Ratio of the RMS signal amplitude to the mean of value of the root sum square. 3. ENOB – The effective number of bits and relates to SINAD. 4. THD – Ratio of the rms value of the fundamental signal to the mean value of RSS of its harmonics. 5. SFDR – Ratio of the RMS value of the signal to the RMS value of the worst spurious signal. 6. Channels – multiple analog signal inputs to the ADC that can be individually selected or selected through a multiplexor. 7. Linearity – Describes how an ADC conveter follows a linear function. 8. Operating temperature – A temperature at which the ADC functions optimally, usually given by the manufacturer. 9. Power dissipation – The proportion of power dissipated (through heat) when the ADC is working. Question 2: An 8 bit ADC has a reference voltage of 5V. What is the digital output code word for an input of 1.2V? 0011

Inglise keel




Meedia

Kommentaarid (0)

Kommentaarid sellele materjalile puuduvad. Ole esimene ja kommenteeri



Sellel veebilehel kasutatakse küpsiseid. Kasutamist jätkates nõustute küpsiste ja veebilehe üldtingimustega Nõustun