single chip microcontrollers 7765j mount druitt college of tafe lesson 2
TRANSCRIPT
Single Chip Microcontrollers
7765JMount Druitt College of TAFELesson 2
Plagiarism Plagiarism is the practice of claiming or
implying original authorship of (or incorporating material from) someone else's written or creative work, in whole or in part, into one's own without adequate acknowledgement
Within academia, plagiarism by students, professors, or researchers is considered academic dishonesty or academic fraud and offenders are subject to academic censure
© Mike Stacey 2008
Plagiarism [2]
Common forms of plagiarism Downloading, borrowing or stealing an assignment
and presenting it as your own work. Copying a section of a book or article and submitting
it as your own work. Copying, cutting and pasting text from an electronic
source and submitting it as your own work. Using the words or ideas of someone else and
presenting them as your own. Relying too much on other people's material. Use
your own words as much as you can.
© Mike Stacey 2008
Plagiarism [3]
Plagiarism & the Internet “The internet can be a great source of information
and an effective research tool. However, just because electronic information is easily available does not mean it is 'free'. Remember that the information you find online should be referenced, just like any other source. Online sources should be used with care, fully acknowledged and evaluated in the same way you would any print-based source of information.”[1]References[1] "plagiarize." Merriam-Webster Online Dictionary. 2008.
Merriam-Webster Online. 8 May 2008, <http://www.merriam-ebster.com/dictionary/plagiarize>
© Mike Stacey 2008
© Mike Stacey 2008
Flow Charts – example from prac 2
initialise stack pointer
set temp reg
write temp to DDRA
load r17 = 00h
load r18 = 01h
RESET
load r19 = 02h
INIT_DATA
r17 < r18?SORT
smallest = r18
r19 < smallest? smallest = r19
T
F
T
F
smallest = r17
output smallest to Port A
DISPLAY
START
END
INITdef smallest = r20
def temp = r16
You need to show this level of detail in your assignment reports.
© Mike Stacey 2008
I/O Ports [1] 8 bit bi-directional Individual pins can be configured as either
input or output 3 address locations for the port
One for Data Register PORTA One for Data Direction Register DDRA One for Port A input pins PINA
Check out the memory map on page 11 and see what range of address space is used for the ports.
© Mike Stacey 2008
I/O Ports [2] Port A has an alternate function as analog inputs for the
ADC. If some of the pins are configured as outputs care must be taken to ensure that none of the outputs switches state as this may corrupt the result of the conversion.
The DDRAn bit in the DDRA register selects direction of that pin (read or write, output or input) If DDAn = 1 then DDAn is an input pin (READ)
Example:ser temp
out DDRC, temp
If DDAn = 0 then DDAn is an output pin (WRITE)
Example:clr temp
out DDRA, temp
© Mike Stacey 2008
Memory Maps. See pp 7-11 of data sheets
Conventional memory addressing modes can be used on the registers as well. This is enabled by the fact that the registers are assigned an address space of $00 - $1F
© Mike Stacey 2008
Memory Map for 90S8535
© Mike Stacey 2008
Register addressingThe registers are physically implemented in internal memory. The registers are accessed by using the address. This is invisible to the programmer.
Observe the register address space in AVR Studio
© Mike Stacey 2008
Memory mapped I/O – see pp 17-18 of data sheets
Data going out to a port first goes to a space in RAM memory defined by an address and is then transferred out to the port’s output register.
The output register itself is also mapped to an address in memory space but, like the general purpose registers, this is not physically implemented in RAM
© Mike Stacey 2008
Memory mapped I/O
Observe these addresses in AVR Studio
© Mike Stacey 2008
Observe memory mapping in AVR Studio
Step through the ledbutton.asm program from prac exercise 1b.
Find r16 and r15 in the register section of the “memory view” What addresses do they have?
Find DDRA, DDRC, PINA, PORTC in memory What addresses do they have?