Wouter van Ooijen Mail: [email protected] Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

60
2TPRJ8 – hardware en ontwikkelomgeving Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1 Wouter van Ooijen Mail: [email protected] Sheets en info: www.voti.nl/hvu/2TPRJ8 www.voti.nl/hvu/arm hardware en ontwikkelomgeving voor 2TPRJ8

description

hardware en ontwikkelomgeving voor 2TPRJ8. Wouter van Ooijen Mail: [email protected] Sheets en info: www.voti.nl/hvu/2TPRJ8 www.voti.nl/hvu/arm. onderwerpen. het ARM bordje de fiets Virtual Machine - opstarten DevEnv – opstarten, editen, compileren debuggen met Insight - PowerPoint PPT Presentation

Transcript of Wouter van Ooijen Mail: [email protected] Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

Page 1: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

1

Wouter van Ooijen

Mail: [email protected]

Sheets en info:

www.voti.nl/hvu/2TPRJ8

www.voti.nl/hvu/arm

hardware en ontwikkelomgeving voor 2TPRJ8

Page 2: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2

het ARM bordje de fiets Virtual Machine - opstarten DevEnv – opstarten, editen,

compileren debuggen met Insight downloaden met OCD Commander het BSP opdrachten

Page 3: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

3

Philips ARM2106 microcontroller (64k RAM, 128k FLASH) voeding uit USB (maar geen USB communicatie) LCD 2x16 char (HD44780-compatible) klein luidsprekertje 16 schakelaars, uitlezen via 2 x HC165 schuifregisters 8 LEDjes, aansturen via 1 x HC595 schuifregister parallel JTAG programming interface (McGraigor Wiggler

compatibel) RS232 serial interface connector voor uitbreidingen

http://www.voti/nl/hvu/arm

Page 4: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

4

Page 5: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

5

LPC2106 (ARM

chip)

Page 6: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

6

Uitlezen v.d. toetsjes

Page 7: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

7

Aansturen v.d. LEDjes

Page 8: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

8

JTAG interface

RS232 interface

Page 9: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

9

snelheidsregeling voor een LEGO motortje

aansluiting van een hall (= magneet) sensor

Page 10: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

10

Page 11: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

11

Page 12: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

12

Log in (met je email en password) ‘Start’ de Virtual Machine met het

Artisan image In de Virtual machine settings moet

de paralelle poort meegenomen worden

Nu kan je de Virtual Machine echt starten

Als je een USB stick wil gebruiken dan moet je die nu pas inpluggen

Page 13: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

13

Page 14: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

14

Page 15: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

15

Page 16: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

16

Page 17: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

17

Page 18: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

18

PSPAD editor GNU assmbler/C/C++ compiler Insight debugger MAC_MOT TCP-to-parallel JTAG

interface

Los: OCD Commander (Philips Flash utility) C++ BSP/RTOS

Page 19: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

19

installeer de files uit de BSP (BikeComputer.zip?) in een lege directory let op: geen spaties in de

pathname

dubbel-klik op de .ppr file

Page 20: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

20

PsPad editormet GNU toolsvoor ARMasm/C/C++ontwikkeling

Page 21: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

21

build

foutmeldingen

Page 22: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

22

Als je dit krijgt bij het linken heb je debugger/loader niet afgesloten

Page 23: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

23

De microcontroller heeft 64Kb RAM, maar daar moet alles in: code, globale data, stack. Wees dus “een beetje” zunig.

Downloaden met de de JTAG debugger gaat niet erg snel. Zuinig zijn met code werkt dus sneller! Een klasse op zich kost geen code, maar (klasse) variabelen en (klasse) functies wel!

Downloaden met de OCD Commander gaat veel sneller, maar je kan dan nauelijks debuggen.

Jullie werken uitsluitend in RAM.

Page 24: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

24

sluit het bordje aan (USB + parallel)

Page 25: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

25

Dit is de setting voor JTAG

Page 26: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

26

start debugger

Page 27: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

27

zet onder file > target settings:Target = Remote/TCPHostname = 127.0.0.1Port = 8888

(als je netjes afsluit blijft zou dit moeten blijven staan)

Page 28: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

28

run > download

Page 29: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

29

Page 30: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

30

continue

Page 31: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

31

als het goed is kom je nu op het breakpoint aan het begin van main

Page 32: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

32

Je kan breakpoints toevoegen of verwijderen

(ook in andere source files)

Page 33: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

33

Je kan variabelen (en andere lijsten) bekijken

Page 34: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

34

Je kan regel voor regel het programma uitvoeren

Page 35: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

35

continue

Zoals het een embedded programma betaamt eindigt ons programma nooit.

stop

Page 36: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

36

Na een ‘stop’ zit je meestal ergens in assembler

Page 37: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

37

start de OCD Commander

Page 38: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

38

check

Page 39: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

39

Load file

Page 40: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

40

Page 41: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

41

Page 42: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

42

run

Page 43: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

43

Page 44: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

44

Overnieuw:

Halt

Load file

Go

Page 45: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

45

Als je dit krijgt moet je dat ding installeren / starten.

Page 46: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

46

Als je dit thuis krijgt kan je onder control panel > system > hardware > device manager (select view > show hidden devices) > non plug-and-pray devices > MAC_MOT > driver instellen op status = started, type = automatic

Page 47: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

47

Als de thuis die MAC_MOT driver niet kan vinden: installeer de Macraigor OCD commander (de link staat op www.voti.nl/hvu/arm)

Page 48: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

48

Als het echt niet werkt: de USB aansluiting

er even uithalen om het bordje te resetten, evt ook je PC resetten.

Page 49: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

49

class C_BSP {

public:

// get the one and only BSP:

static C_BSP * getInstance( void );

C_Busy * busy;

C_Interrupts * interrupts;

C_Timer0 * timer0;

C_Timer1 * timer1;

C_Pins * pins;

C_Beeper * beeper;

C_LEDs * leds;

C_Keyboard * keyboard;

C_LCD * lcd;

private: . . .

Chip

On-board peripherals

Page 50: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

50

class C_Busy {

public:

// wait n microseconds

void waitUs( int n );

// wait n milliseconds

void waitMs( int n );

private: . . .

Page 51: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

51

class C_Interrupts {

public:

// Check whether interrupts are currently enabled.

bool isEnabled( void );

// guards for an region of code that must run uninterruptable

// these calls work properly when nested

void unInterruptableBegin( void );

void unInterruptableEnd( void );

// check the current nesting of uninterruptable regions

// probably usefull for debugging

int unInterruptableCount( void );

private: ...

Page 52: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

52

class C_Timer {

public:

// abstract methodes:

virtual unsigned long getMillisec( void ) = 0;

virtual void registerCallback( void (* cb)( void ) ) = 0;

protected: . . .

Page 53: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

53

class C_Timer0 : public C_Timer { // C_Timer1 is similar

public:

// The registered function is called on each timer interrupt

// Registering another function overwrites the previous.

// N.B. The function cb() should not do any I/O write operations

// neither directly nor indirectly!

void registerCallback( void (* cb)( void ) );

// static member for the routines to call if the timer ticks

static void (* callback)( void );

// handler called when timer interrupt occurs

static void timerInterruptHandler0 (void);

// static member for the number of milliseconds

static unsigned long nrMillis;

inline unsigned long getMillisec( void ){ return nrMillis; }

// clock frequency

static const unsigned CLOCK_FREQ;

private: . . .

Page 54: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

54

enum DirectionT {

DirectionInput,

DirectionOutput };

class C_Pins {

public:

// set the direction of a pin

void setDirection( unsigned char pin,

DirectionT direction );

// get and set pin value

// set is usefull when the pin direction is output

// get is usefull when the pin direction is input

bool get( unsigned char pin );

void set( unsigned char pin, bool value );

private: . . .

Page 55: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

55

class C_Beeper {

public:

// switch the Beeper on (== high)

void on( void );

// switch the Beeper off (== low)

void off( void );

private: . . .

Page 56: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

56

class C_LEDs {

public:

// set the LEDs according to the 8 bits in value

void setAll( unsigned char value );

// switch the LED nr on or off

void setOne( unsigned char nr, bool value );

private: . . .

Page 57: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

57

enum KeyT {

Key0 = 6, Key1 = 15, Key2 = 14, Key3 = 13, Key4 = 12,

Key5 = 11, Key6 = 10, Key7 = 9, Key8 = 8, Key9 = 7,

KeyA = 3, KeyB = 2, KeyC = 1, KeyD = 0,

KeyStar = 5, KeySharp = 4,

KeyNone = 0xFF };

class C_Keyboard {

public:

// read the keyboard, return

// whether a key is pressed

// and if so which one

KeyT read( void );

// read the keyboard, to get

// the status of the given key

bool readKey ( KeyT key );

Page 58: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

58

class C_LCD {

public:

// send a HD44780 command byte to the LCD

void command( unsigned char cmd );

// send a HD44780 data byte to the LCD

void data( unsigned char chr );

// put the write cursor at (row, col)

// row = line number, 0 = top line

// col = column, 0 = leftmost

void gotoRowCol( unsigned char row, unsigned char col );

// write a char at the write cursor position and

// advance the write cursor position

void write( char chr );

private: . . .

Page 59: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

59

LET OP!1. De ‘hogere’ I/O classes (LCD, Keyboard, LEDs, etc)

mogen niet uit de interrupt (ge-schedulde timerticks) aangeroepen worden. Pinnen lezen en/of schrijven mag wel.

2. In de huidige versie van de opstart code en linker scripts worden de creators (initialisatie) van globale objecten niet aangeroepen! Gebruik dus locale objecten, evt. een globale pointer naar zo’n object (of references doorgeven).

Page 60: Wouter van Ooijen Mail:  wouter@voti.nl Sheets en info: voti.nl/hvu/2TPRJ8 voti.nl/hvu/arm

2TPRJ8 – hardware en ontwikkelomgeving

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

60

Opdrachten – vrijwillig, maar…

1. Laat de LEDs knipperen: iedere seconde heel even (bv 200ms) aan.

2. Geluid: maak een korte piep (bv 1 seconde 1 kHz).

3. Zet ‘Hello world’ op het LCD scherm, en iets naar keuze op de tweede regel.

4. Laat op het LCD of de LEDs zien als toets 1 of toets 2 wordt ingedrukt.