Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Odev1lojicalmojicalsalaksacma, Exercises of Electronics

pic18fasdaf polar bipolar microcontroller falan filan iste

Typology: Exercises

2018/2019

Uploaded on 11/17/2019

majinbuu
majinbuu 🇹🇷

4

(1)

1 document

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Ödev teslim tarihi: 16-Kasım-2019 23:59
Kayıt Numarası: 1234
Mikroişlemciler ()-sınıf numarası: 22851539
Mikroişlemciler (nö)-sınıf numarası: 22851508
Ödevlerde asla intihal yapılmayacaktır. İntihal yapan öğrenciler, fakülte disiplin kuruluna
sevk edilecektir.
1) The following shows the crystal freqency for three different PIC-based system. Find
the period of instruction cycle in each case.
a) 4 MHz b) 16 Mhz, c) 20 Mhz
2) How many instruction cycles does it take to execute the following instructions? How many
clock cycles? With a 25 MHz clock, how long does it take to execute the following
instructions? (give the answer in microseconds, do NOT round to the nearest microsecond!).
For reference, 1 MHz has a period = 1 us = 1000 ns.
goto next_line
next_line
movff 0x3A0, 0x020
movwf 0x020,w
3) Find the size of the delay of the code snippet below if the crystal frequency is 4 MHz:
DELAY MOVLW 0xFF
MOVWF 0X08
NOP
NOP
DECF 0X08,F
BNZ AGAIN
RETURN
4)
Location Contents
0x071 0x3A
pf3
pf4
pf5

Partial preview of the text

Download Odev1lojicalmojicalsalaksacma and more Exercises Electronics in PDF only on Docsity!

Ödev teslim tarihi: 16-Kasım-2019 23: Kayıt Numarası: 1234 Mikroişlemciler (iö)-sınıf numarası: 22851539 Mikroişlemciler (nö)-sınıf numarası: 22851508 Ödevlerde asla intihal yapılmayacaktır. İntihal yapan öğrenciler, fakülte disiplin kuruluna sevk edilecektir.

  1. The following shows the crystal freqency for three different PIC-based system. Find the period of instruction cycle in each case. a) 4 MHz b) 16 Mhz, c) 20 Mhz
  2. How many instruction cycles does it take to execute the following instructions? How many clock cycles? With a 25 MHz clock, how long does it take to execute the following instructions? (give the answer in microseconds, do NOT round to the nearest microsecond!). For reference, 1 MHz has a period = 1 us = 1000 ns. goto next_line next_line movff 0x3A0, 0x movwf 0x020,w
  3. Find the size of the delay of the code snippet below if the crystal frequency is 4 MHz: DELAY MOVLW 0xFF MOVWF 0X NOP NOP DECF 0X08,F BNZ AGAIN RETURN

Location Contents 0x071 0x3A

0x072 0x 0x073 0xA 0x074 0x Assume the W register has the value 0x2C in it, and that initial values of C, Z are both ‘0’. Assume the above memory contents, W register value, initial C, Z values at the START of each instruction. a) xorlw 0x Circle one: W dest. Reg. file dest. New value (hex) ____ C_flag :____ , Z flag:__ b) subwf 0x071, w Circle one: W dest. Reg. file dest. New value (hex) ____ C_flag :____ , Z flag:__ c) movf 0x073, f Circle one: W dest. Reg. file dest. New value (hex) ____ C_flag :____ , Z flag:__ d) btg 0x072, 4 Circle one: W dest. Reg. file dest. New value (hex) ____ C_flag :____ , Z flag:__ e) rrcf 0x073,w Circle one: W dest. Reg. file dest. New value (hex) ____ C_flag :____ , Z flag:__

  1. Write the following in assembly language unsigned char i,j,k,p,q,r,s,t; a) t = q & (p >> 2); b) if (5 >= t) { //if-body – just write a placeholder here } else { //else-body – just write a placeholder here }
  1. Write a PIC18 assembly language code fragment to implement the following. signed int i; i = i << 1; 17) Write a PIC18 assembly language code fragment to implement the following. unsigned long i, k; // this is a LONG, be careful k = k - i;
  2. Write a PIC18 assembly code fragment to implement the following. The code of the loop body has been left intentionally blank; I am only interested in the comparison test. For the loop body code, just use a couple of dummy instructions so I can see the start/begin of the loop body. unsigned int j,k; while(j==0||k!=0) { ...operation 1... ...operation 2... }

Write a PIC18 assembly code fragment to implement the following. The code of the loop body has been left intentionally blank; I am only interested in the comparison test. For the loop body code, just use a couple of dummy instructions so I can see the start/begin of the loop body. signed char i, k;

do { ...operation 1... ...operation 2... }while (k >= i);

  1. Write a program to find the largest element stored in the array that is stored in data memory locations from 0x10 to 0x5F in assembly language.
  2. Write a program to find the largest element stored in the five elements of array that is stored in data memory in c language..
  3. Given the following variable definitions, list the outcome of the following conditional tests in terms of “true” or “false”: unsigned int a=10, b=2; if (a>10) if (a> 0 ) if (a== 10 ) if (b>=2)
  4. Show the status C, DC, and Z flags after the addition of 9Ch and 64h in the following instructions: MOVLW 9 CH ADDLW 64H
  5. Show the status C, DC, and Z flags after the addition of - 10 and 64h in the following instructions: MOVLW - 10 ADDLW 64H
  6. Find the ROM memory address of each the following PIC chips: a) PIC18F22 20 with 4 KB b) PIC18F2 410 with 16 KB c) PIC18F 458 with 32 KB
  7. Which of the following is (are) illegal? a) MOVLW 500 b) MOVLW 0 x 50 c) MOVLW 00 d) MOVLW 255H e) MOVLW b’ 01010101 ’ f) MOVLW mybeyte, H’ 50 ’ a) ADDLW 300h, b) ADDLW 50 H, c) ADDLW - 20