De presentatie wordt gedownload. Even geduld aub

De presentatie wordt gedownload. Even geduld aub

2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 1 Les 4 - onderwerpen DB038 hardware : LEDs en displays.

Verwante presentaties


Presentatie over: "2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 1 Les 4 - onderwerpen DB038 hardware : LEDs en displays."— Transcript van de presentatie:

1 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 1 Les 4 - onderwerpen DB038 hardware : LEDs en displays Aansturen van één 7-segment display Aansturen van vier 7-segment displays

2 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 2 Als je voor loopt (of ‘s nachts niet kan slapen) : denk alvast na over je eind-opdracht De laatste twee lessen (+ projectweek en thuis!) ga je werken aan een ‘vrije’ opdracht. Verzin zelf een project(je). Stem af. Schijf zelf de opdracht. citeria: Niet te makkelijk Niet te moeilijk Externe hardware gebruiken is een plus (maar zeker niet verplicht) In principe individueel, eventueel met meer Externe info (code!) mag, maar wees er duidelijk over De opgave moet in overleg met de docent worden vastgesteld. Zie DB038 manual 6.3 en 6.4 voor suggesties.

3 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 3 DB038 4 x 7-segment LED display 8 LEDs

4 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 4 DB038 circuit – PIC DB038 manual 2.1

5 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 5 DB038 circuit – H multiplexer DB038 manual 2.7

6 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 6 DB038 circuit – LEDs and displays DB038 manual 2.9

7 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 7 Maak pinnen outputs (gebeurt al in DB038-1.inc) ; A0..A2 and D and E0..E2 are outputs BSF STATUS, RP0 MOVLW 0xD8 MOVWF ( 0x80 ^ TRISA ) MOVLW 0x00 MOVWF ( 0x80 ^ TRISD ) MOVLW 0xF8 MOVWF ( 0x80 ^ TRISE ) BCF STATUS, RP0

8 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 8 Selecteer en activeer LEDs (gebeurt al in DB038-1.inc) ; activate the LEDs BSF PORTA_SHADOW, 2 CALL PORTA_FLUSH MOVLW H'04' MOVWF PORTE_SHADOW CALL PORTE_FLUSH MOVLW H'55' ^ H'FF' MOVWF PORTD_SHADOW CALL PORTD_FLUSH

9 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 9 Aansturen van één 7-segment display Pinnen output maken, RA2 hoog maken: (gebeurt al in DB037-01.inc) Selecteer het meest rechter display: Schrijf de juiste waarde naar poort E Activeer de juiste segmenten: Schrijf de juiste waarde naar poort D DB038 manual 2.9.4

10 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 10 segment letters A B C D E F G DP http://en.wikipedia.org/wiki/Seven-segment_display

11 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 11 segment letters PIC pinDisplay Segment RD0A RD1B RD2C RD3D RD4E RD5F RD6G RD7DP let op: active low !

12 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 12 BCD/binair  zeven-segment We moeten dus een getal (0..F) omzetten naar een bitpatroon dat de juiste segmenten aan zet. byte zet_om_naar_zeven_segment( byte x ){ if( x == 0 ) return 0x15; if( x == 1 ) return 0x21;... }

13 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 13 zet_om_naar_zeven_segment : cblock temp7 endc movwf temp7 ; check temp7 == 1 ; skip if <> ; return 0x21 byte zet_om_naar_zeven_segment( byte x ){ if( x == 0 ) return 0x15; if( x == 1 ) return 0x21;... return 0x11; }

14 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 14 Opdracht 1 : hexadecimaal tellen op 1 zeven- segment display tel op de 1 cijfer van het 7-segment display van 0 tot F (en dan weer opnieuw, bv 1 tikken per seconde) Gebruik een conversie subroutine om te vertalen van een getal (0..F) naar het bitpatroon van de segmenten.

15 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 15 Opdracht 2 : tel decimaal op 4 zeven-segment displays Declareer 4 bytes waarin je 4 decimale digits getallen opslaat. Maak een verhoog subroutine die de 4-dgit decimale waarde met 1 verhoogt. Let op de carry van een digit naar een hoger digit. Laat de nieuwe waarde zien op de zeven- segment displays. Weer verhogen, weer laten zien, etc.

16 2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 16 multiplexen Laat Digit 1 zien (wacht) Doe eventueel ander werk Laat Digit 2 zien (wacht) Laat Digit 3 zien (wacht) Laat Digit 4 zien (wacht)


Download ppt "2PROJ5 – PIC assembler Hogeschool Utrecht / Institute for Computer, Communication and Media Technology 1 Les 4 - onderwerpen DB038 hardware : LEDs en displays."

Verwante presentaties


Ads door Google