Nachiket M' Kharalkar - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Nachiket M' Kharalkar

Description:

PT2 is LED output T (on means unlocked) ; The specific operation of this system ; unlock if AD is not pressed and P is pressed ;I/O port definitions on the 9S12DP512 ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 22
Provided by: nachiketk
Category:

less

Transcript and Presenter's Notes

Title: Nachiket M' Kharalkar


1
Introduction to Microcontrollers
  • Nachiket M. Kharalkar
  •  
  • Lab 1
  • Date 01/31/2008
  • E-mail knachike_at_ece.utexas.edu
  • http//users.ece.utexas.edu/knachike/spring08/
  •  

2
  • This presentation
  • http//users.ece.utexas.edu/knachike/spring08/
  • Lab manual
  • http//users.ece.utexas.edu/valvano/EE319K/EE319K
    _Sp2008.pdf

3
TExaS Simulator
  • Learn it well, you will use it to take Test 2
  • TExaS on all computers in ENS
  • Install from blackboard
  • Upgrade to latest version http//www.ece.utexas.e
    du/valvano/upgrade.html
  • Have Prof Valvano teach you
  • http//www.ece.utexas.edu/valvano/Readme.htm

4
(No Transcript)
5
MC9S12DP512 Architecture
  • Executes the standard 6812 instruction set
  • Port AD0 is an 8-channel 10-bit analog to digital
    converter or Port AD0 is an 8-bit digital input
    port
  • Port H is an 8-bit digital bi-directional port
  • Port P is an 8-bit digital bi-directional port
  • Port T is an 8-bit digital bi-directional port
  • Clock runs at 8 MHz

6
Port addresses
  • PTH equ 0260 Port H I/O Register
  • DDRH equ 0262 Port H Data Direction
    Register
  • PTP equ 0258 Port P I/O Register
  • DDRP equ 025A Port P Data Direction
    Register
  • PTT equ 0240 Port T I/O Register
  • DDRT equ 0242 Port T Data Direction
    Register

7
MC9S12DP512 Registers
8
MC9S12DP512 Memory map
  • 0x0000-0x03FF I/O ports
  • 0x0800-0x3FFF 14K bytes of RAM (Global
    variables are stored from 0800. Stack grows down
    from 3FFF and local variables stored in stack)
  • 0x4000-0xFFFF 48K Flash EEPROM simulated in
    TExaS (Total 512K bytes in the chip, Program is
    stored in this region)

9
Texas Simulator
10
Lab 1
PP2
P
AD
T P AD
11
Texas Simulator Loading a program
  • Click on the icon on the task bar
    to open Texas simulator.
  • Click File ? Open ?
  • Open tut.rtf file (from the MC9S12 folder)
  • Click Window ? Tile
  • Click Mode ? Processor to make sure that the
    processor is MC9S12DP512

12
Texas Simulator Writing your FIRST program
  • Click File ? New ? Program ? OK
  • File ? New ? Microcomputer ? OK
  • File ? New ? I/O device ? OK
  • Save each of these 3 windows with the same name
    in the same folder with their respective
    extensions

13
Texas Simulator Writing your FIRST program
  • Lab1.RTF
  • Program written by Your Name
  • Date Created 1/22/2008
  • Last Modified 1/22/2008
  • Section 1-2pm TA Nachiket Kharalkar
  • Lab number 1
  • Brief description of the program
  • The overall objective of this system is a
    digital lock
  • Hardware connections
  • PP2 is switch input P
  • PAD2 is switch input AD
  • PT2 is LED output T (on means unlocked)
  • The specific operation of this system
  • unlock if AD is not pressed and P is pressed

14
  • I/O port definitions on the 9S12DP512
  • ATD0DIEN equ 008D ATD Input Enable Mask
    Register
  • PORTAD0 equ 008F Port AD I/O Register
  • PTT equ 0240 Port T I/O Register
  • DDRT equ 0242 Port T Data Direction Register
  • PTP equ 0258 Port P I/O Register
  • DDRP equ 025A Port P Data Direction
    Register

15
  • org 0800 RAM
  • Global variables (none required for this lab)
  • org 4000 flash EEPROM
  • main
  • Software performed once at the beginning
  • loop
  • Software repeated over and over
  • bra loop
  • org FFFE
  • fdb main Starting address

16
Reset Vector
  • A reset vector tells the computer where in
    memory to begin execution after reset
  • You have to set it up
  • For us, program starts at main
  • Reset vector of 6812 located at FFFE, therefore
    we had this in our program
  • org FFFE
  • fdb main

17
Texas Simulator Writing your FIRST program
  • Click on the IO window and then click on IO tab.
  • Click on LED. Type PT2 for the 1st LED in the
    PORT window, give whatever label name you want.
  • Click on the switch tab and enter PAD2 in the
    PORT window similarly enter PP2 for switch P

18
Texas Simulator Writing your FIRST program
Program below the main
  • ldaa FF
  • staa ATD0DIEN
  • movb 00,DDRP
  • movb FF,DDRT

19
Texas Simulator Writing your FIRST program
  • ldaa PORTAD0
  • coma
  • anda PTP
  • staa PTT

Program inside the loop
20
Texas Simulator Running a program
  • Press Crtl B to assemble the program
  • Click Green Start button from the toolbar
  • Press Red STOP button to stop the program (any
    time)
  • Press the Yellow Reset button (or F9) to reset
    the registers etc after stopping.

21
Texas Simulator Debugging
  • Now Single step through the program by pressing
    F10
  • Create break point by entering address in the
    microcomputer window and press add OR by right
    clicking in the list file window
Write a Comment
User Comments (0)
About PowerShow.com