Ece 447 lecture 3
This presentation is the property of its rightful owner.
Sponsored Links
1 / 12

ECE 447: Lecture 3 PowerPoint PPT Presentation


  • 53 Views
  • Uploaded on
  • Presentation posted in: General

ECE 447: Lecture 3. Microcontroller Programming in C. ECE 447: Class Exercise. Write a program in C that transfers 512 bytes of data starting at address 6000H to the block of memory starting at address 8000H. $0000-$01FF 512 bytes RAM. $0000. $1000. $ 2 000. $1000-$103F

Download Presentation

ECE 447: Lecture 3

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Ece 447 lecture 3

ECE 447: Lecture 3

Microcontroller

Programming in C


Ece 447 class exercise

ECE 447: Class Exercise

Write a program in C that transfers 512 bytes of data starting at address 6000H to the block of memory starting at address 8000H.


Ece 447 68hc11e9 memory map

$0000-$01FF

512 bytes RAM

$0000

$1000

$2000

$1000-$103F

64 bytes I/O registers

$2000-$B5FF

37.5 kbytes

$B600

$B600-$B7FF

512 bytes EEPROM

$D000

$D000-$FFFF

12 kbytes ROM

$FFFF

Expanded bus mode

ECE 447: 68HC11E9 Memory Map

External RAM

External RAM

recommended for use

recommended

for use

External RAM


Ece 447 memory map linker file

$0000-$01FF

512 bytes RAM

$0000

$1000

$6000

$2000

$1000-$103F

64 bytes I/O registers

$6000-$B5FF

21.5 kbytes

$2000-$5FFF

16 kbytes

$B600

$B600-$B7FF

512 bytes EEPROM

$D000

$FFFF

Expanded bus mode

ECE 447: Memory Map: Linker file

Program area - text

External RAM

Data area – data

External RAM


Ece 447 software cycle

Text editor

Assembly

source

C source

.c

.s

Cross-compiler

m6811-elf-gcc

Cross-assembler

m6811-elf-as

Object

listing .lst

Relocatable

object

.o

Relocatable

object

.o

libraries

Linker

m6811-elf-ld

(m6811-elf-gcc)

{lib_name}.a

Linker

command file

User libraries

memory.x

{lib_name}.a

Non-relocatable

executable program

(a.out)

ECE 447: Software Cycle


Ece 447 software cycle1

Non-relocatable

executable image

a.out

Downloadable

file converter :

m6811-elf-objcopy

Downloadable

file

a.s19

ECE 447: Software Cycle


Ece 447 class exercise 2

ECE 447: Class Exercise 2

Write a program in C that continuously transfers data from PORT E to PORT C of MC68HC11.


Ece 447 organization of mc68hc11

RAM

CPU

ROM

EEPROM

A/D

SPI

TIMER

SCI

8 (4)

8

4

2

PORT A

PORT B

PORT C

PORT D

PORT E

3

3

2

8

8

6

8 (4)

ECE 447: Organization of MC68HC11


Ece 447 class exercise 3

ECE 447: Class Exercise 3

Write a program in C that continuously scanspin PE5of PORT E of MC68H11.

Whenevera falling edge is detected at PE5, the microcontroller shouldclear the pin PC4,and toggle pin PC2 of MC68HC11.


Ece 447 setting and clearing a bit

ECE 447: Setting and Clearing a bit

Clearing a bit

Setting a bit

#define BIT3 0x04

unsigned char c = 5;

void set_bit3(void)

{

c |= BIT3;

}

#define BIT3 0x04

unsigned char c = 5;

void clear_bit3(void)

{

c &= ~BIT3;

}


Ece 447 toggling a bit

ECE 447: Toggling a bit

#define BIT3 0x04

unsigned char c = 5;

void toggle_bit3(void)

{

c ^= BIT3;

}


Ece 447 setting a bit at a given memory location

ECE 447: Setting a bit at a given memory location

#define BIT3 0x04

#define ADDR 0x1005

void set_bit3(void)

{

unsigned char *ptr;

ptr = (unsigned char *) ADDR;

*ptr |= BIT3;

}


  • Login