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

Lab 03 for Computer Organization Course - Programming the PIC Microcontroller, Slides of Computer Architecture and Organization

A lab manual for cs140 - lab03 in the computer organization course, which covers programming the pic microcontroller using assembly instructions and configuring it to support additional hardware. The lab manual includes information about the demo board, ttl logic, wiring the board, and driving logic on various chips. Additionally, it provides an evaluation sheet for the lab.

Typology: Slides

2012/2013

Uploaded on 04/24/2013

baijayanthi
baijayanthi 🇮🇳

4.5

(13)

171 documents

1 / 27

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS140 - Lab03 1
Computer Organization
CS 140
Programming The PIC
Micro Controller
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b

Partial preview of the text

Download Lab 03 for Computer Organization Course - Programming the PIC Microcontroller and more Slides Computer Architecture and Organization in PDF only on Docsity!

CS140 - Lab03 (^) 1

Computer Organization

CS 140

Programming The PIC

Micro Controller

CS140 - Lab03 (^) 2

In the last labs, you learned how to program the PIC Microcontroller running on the Demo Board. You could write a bit of new code, and you could explain what various Assembly instructions do. You also had a general idea of how to read the hardware specification.

In this lab, you will have two very specific tasks.

  1. Take a piece of running code and configure it to support additional hardware.
  2. Use the Demo Board to test the behavior of logic chips.

But first, we’re going on a major detour introducing you to some new concepts.

These concepts include:

a. A new demo board.

b. A new PIC Processor.

c. TTL Logic.

d. Wiring up the Chip.

e. Code to drive and test this logic.

The Lab - Overview

CS140 - Lab03 (^) 4

The Demo Board

This connector was already on the board. The important thing to note is the signals coming out of each location. So if you want to find a particular pin, this is how to do it.

RB

RB6, RB MCLR Don’t mess with these three pins.

RC

This connector was added to the board. The important thing to note is the signals coming out of each location. So if you want to find a particular pin, this is how to do it.

RA

CS140 - Lab03 (^) 5

The Demo

Board

Here are changes made to this board.

  1. A 16 pin socket was added to hold a DIP chip
  2. Connectors added on both sides of socket to connect to the socket.
  3. Connector to access Ground
  4. Connector to access +5 Volts.
  5. Connector enabling a wire to hook the switch to the Microcontroller. DIP stands for Dual In-line package.

+5 V Pins

DIP Socket

Socket Connector

Ground Pins

Switch Connector

Socket Connector

Docsity.com

CS140 - Lab03 (^) 7

TTL Logic

A Input B Input Output 0 0 1 0 1 0 1 0 0 1 1 0 Apply to Pin 2

Apply to Pin 3

Result on Pin 1

Truth Table For Nor Gate

This is an real photo of a TTL Chip taken by space aliens.

Note especially that the NOTCH indicates the orientation of the chip. It shows that THIS is Pin 1.

There is a similarity between the picture and the diagram!!

The 74LS02 is a Quad Nor gate. It contains 4 separate independent gates – you can use one or all of them. The “LS” indicates this is a low power device.

The 74LS02 is a 14 pin chip. We’ll also be using 16 pin chips. Docsity.com

CS140 - Lab03 (^) 8

Wiring The Board

This shows the steps involved in wiring this whole thing together.

  1. The orange wire connects between the switch and RB5.
  2. Looking at the chip schematic, this particular chip wants +5V on Pin 14. The red wire provides that.
  3. The chip wants ground on pin 7. The white wire takes care of that. NOTE: You screw up the +5V and the ground and you will fry the chip.

Pin 14 Ground

Pin 7 Please note VERY CAREFULLY the orientation of the 74LS02 in the socket. a) The notch is at the left side in this picture. (This is not a requirement, but please do so – it will make debugging easier. b) The 14-pin chip is oriented/pushed to the left side of the socket as seen in this photo.

CS140 - Lab03 (^) 10

You can find starter-code Here. The program is called ChipDriver.asm.

You will be expected to understand this code. It’s highly parameterized and filled with comments. Hope you find it useful.

Note that for each of the devices (Chip driver/reader), Switch, LED; there’s a routine to configure and one to read/write as appropriate.

The Code

CS140 - Lab03 (^) 11

You will be amazed how useful your book is for this part. Of particular interest is the book’s description of three kinds of chips. I’ve provided an overview of the chip-type, examples of that type I will give you, and examples of chips I might ask you to wire up for show and tell.

Chip Type Provided For Practice For Show and Tell?

Logic Gates (3.3 in book)

74LS02, 74LS10, 74LS21 74LS00, 74LS02, 74LS08, 74LS10, 74LS20, 74LS21, 74LS27, 74LS30, 74LS Combinational Circuits (3.5 in book)

74LS42, 74LS138 74LS85, 74LS138, 74LS139, 74LS153, 74LS

Sequential Circuits (3.6 in book)

74LS194, 74LS174 74LS93, 74LS112, 74LS164, 74LS174, 74LS

Finding out more: The appendix of this document contains some information about these chips. Otherwise, Google can be your friend. (Search on “TTL” + Chip number) These chips were made originally by Motorola, Fairchild, Texas Instruments, and now by many vendors.

The Logic Chips

CS140 - Lab03 (^) 13

Task 2: Drive logic on various chips.

Your Task is to be able to use the Microcontroller to produce the states in the truth table for a selection of chips. As described, the provided code gives you an example of how to do this for the 74LS02.

You will have a set of others chips to practice on; and then at show and tell time, you will demonstrate your prowess with chip testing.

You will have a choice of what type of chip to test, and you will then wire up that chip on the board and produce code that can run that chip. The chip you will get will be one of those listed on a previous page labeled “For Show and Tell”. By all means, practice on the six chips provided in order to understand how they work. Get together with your buddies if you wish. Learn all you want about the Show and Tell chips though you won’t be able to practice on them beforehand.

You are encouraged to work together on this activity.

CS140 - Lab03 (^) 14

Task 2: Drive logic on various chips.

What type chip should you choose? Logic Chips are fairly low risk; you could even look at the specs for all those chips and have them programmed beforehand. But low risk means a somewhat lower grade. Combinational Chips are medium difficulty. They aren’t hard conceptually, but they require more connection wires. Also, how you display the results on the LEDs will take a bit of thinking. I have no preconceived notion of how that should be done, so you would have considerable latitude here. Sequential Chips are also medium difficulty. In general, their challenge is not in the number of wires, but in the requirement of timing – an input needs to go lowhigh ten times for instance in order to see the desired effect.

By The Way: Task 1 and Task 2 are independent of each other – you can wire the switch wherever you want for Task 2.

You are encouraged to work together on this activity.

CS140 - Lab03 (^) 16

Appendix – Logic Gates

74LS Quad 2-input AND

74LS Quad 2-input NAND

74LS Quad 2-input NOR

74LS Dual 4-input NAND

74LS Triple 3-input NAND

74LS Dual 4-input AND

CS140 - Lab03 (^) 17

Appendix – Logic Gates

74LS Triple 3-input NOR

74LS Quad 2-input OR

74LS 8-input NAND

CS140 - Lab03 (^) 19

74LS 3 to 8 line decoder (multiplexer)

Appendix – Combinational

This is a Decoder

CS140 - Lab03 (^) 20

Appendix – Combinational

This is a Decoder Docsity.com