PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : [ERLEDIGT] Nokia 3310/3330 Display für µC



PICture
21.10.2005, 18:14
Hallo!

Das Grafikdisplay hat eine Auflösung von 48x84 Pixel und ist mit einem Philips Kontroller PCD8544 ausgestattet. Es ist auch sehr verbreitet und unter 5 EUR bei ebay zu haben. Ich habe den Anschluss an PIC noch vereinfacht so, das man jetzt bloß 3 pins am PIC braucht, und dazu noch 3 Taster angeschlossen. Ich finde das Display sehr gut und einfach zu steuern.

Anstatt des LM317 mit R1 und R2, kann man den 78L02 anwenden.

Wenn jemand die Taster nicht braucht, kann die D4,D5,R6,R7,R9,R10
weglassen (mittlere Skizze).

Wenn PIC mit max. 3,3V arbeitet, kann man das Display direkt anschliessen. In dem Fall bleiben in der Schaltung (ohne Taster) nur C1,C2 und R8 (untere Skizze).

Mit einfachen Hardware und ein paar zusätzlichen Zeilen im Code (SerSend) kann man die Pinzahl sogar auf 2 reduzieren, aber nur ohne Tasten (ganz unten). Im modifiziertem Unterprogramm wird ein Flag _Fdc benutzt, das am Anfang des Programms deklariert werden muss. Anstatt

#define _SCK PORTA,2 ; display serial clock
#define _SDT PORTA,1 ; display serial data
#define _DC PORTA,0 ; display 0-command,1-data
DTemp equ 0x20
DTemp1 equ 0x21

muss sein

#define _SCK PORTA,1 ; display serial clock
#define _SDT PORTA,0 ; display serial data
#define _Fdc Flags,0
DTemp EQU 0x20
DTemp1 EQU 0x21
Flags EQU 0x22

Das Display ist für Textaugabe nicht besonders geeignet, weil es keinen eigenen Zeichengenerator besitzt, der programmiert werden muss. Vielleicht braucht jemand sowas?

Für das Testprogram soll nach der Änderung der Konfiguration ein Quartz max. 16 MHz verwendet werden, da der Displaykontroller, laut Datenblatt nur bis 4 MHz geht.

MfG


VCC VCC
VCC + +
+ .-------. | |
| | | +3V | |
+--+ LM317 +--+----+--+-------+-------+-----------------+
| | | | | | | | | |
'---+---' .-. | .-. -. .-. .-. .-. .-
| | |R1 | | |R3 | |R4 | |R5 | |R6 | |R7 | |R8
R2 | | |220| | |3k3 | |3k3 | |3k3| |20k| |20k| |10k
300 | '-' | '-' '-' '-' '-' '-' '-'
___ | | | | | | D1| | |
+-|___|-+------+ . | +----------------->|--------------|-->SCK
| | | | | D2| | |
=== | | +--------->|--+-----------|-->SDT zum PIC
GND | | | | D3| | |
T1 R9 680 | | | +->|--|-----+-----|-->D_C
--- ___ | | | | | | |
+--o o--+---|___|---|--|-------|-------|-----+ | |
| | | | | | | +--+
| V D4 | | | | | | |
| T2 - R10 680 | | | | | C2 | ---
| --- | ___ | | | | | µ1 | ---
+--o o--|-+-|___|---|--|-------|-------|-----------+ | |
| | | | | +-----+ | +-+-+-----------|--+
| | V D5 | +-----------+ | | | | | | |
| T3 | - +------------+ | | | | | | | ===
| --- | | | | | | | | | | GND
+--o o--+-+ D4,D5 Ge | | | | | |--- C1 10µ |
| | | | | | |### + |
=== | | | | | | | +---------+
GND | | | | | | | |
V V V V V V V V
Display 1 2 3 4 5 6 7 8


VCC=5V
+ .-------.
| | | +3V
+--+ LM317 +--+----+--+-------+-------+-----------------+
| | | | | | | |
'---+---' .-. | .-. -. .-. .-
| | |R1 | | |R3 | |R4 | |R5 | |R8
R2 | | |220| | |3k3 | |3k3 | |3k3 | |10k
300 | '-' | '-' '-' '-' '-'
___ | | | | | | D1 |
+-|___|-+------+ . | +----------------->|--------------|-->SCK
| | | | | D2 |
=== | | +--------->|--------------|-->SDT zum PIC
GND | | | | D3 |
| | | +->|--------------|-->D_C
| | | | |
| | | | |
| | | | +--+
| | | | | |
| | | | C2 | ---
| | | | µ1 | ---
| | | | | |
| | +-----+ | +-+-+-----------|--+
| +-----------+ | | | | | | |
+------------+ | | | | | | | ===
| | | | | | | | GND
| | | | | |--- C1 10µ |
| | | | | |### + |
| | | | | | | +---------+
| | | | | | | |
V V V V V V V V
Display 1 2 3 4 5 6 7 8


VCC=max.3,3V
+
|
o-----------------------+
| |
| .-.
| | |R8
| | |10k
| '-'
| |
| +---------------------|-->SCK
| | |
| | +-------------------|-->SDT zum PIC
| | | |
| | | +-----------------|-->D_C
| | | | |
| | | | |
| | | | +--+
| | | | | |
| | | | C2 | ---
| | | | µ1 | ---
| | | | | |
| | | | +-+-+-----------|--+
| | | | | | | | |
| | | | | | | | ===
| | | | | | | | GND
| | | | | |--- C1 10µ |
| | | | | |### + |
| | | | | | | +---------+
| | | | | | | |
V V V V V V V V
Display 1 2 3 4 5 6 7 8



.-----. _
vom _SDT >----+------|J Q|----> D/C zum Display
| | |
PIC _SCK >----|------|>CK |
| |\ | _|
+-| >O-|K Qo-
|/ '-----'


oder


.-----. _
vom _SDT -----------|D Q|----> D/C zum Display
|\ | _|
PIC _SCK ------| >O-|>T Qo-
|/ '-----'


Der Inverter kann auch mit einem (SMD) Transistor realisiert werden.

Display Nokia 3310/3330

12345678
.----------------------------.
| |||||||||| |
| |||||||||| |
| '--------' |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
'----------------------------'



; Test programm for graphic display from Handy NOKIA 3310 with 3-pin connection
LIST P=16F630
include "P16F630.inc" ; 4.000 MHz internal clock
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _INTRC_OSC_NOCLKOUT
#define _SCK PORTA,2 ; display serial clock
#define _SDT PORTA,1 ; display serial data
#define _DC PORTA,0 ; display 0-command,1-data
DTemp equ 0x20
DTemp1 equ 0x21
ORG 0x0000
Main call Init
call DLine1
call §SP
call §SP
call §SP
call §N
call §O
call §K
call §I
call §A
call §SP
call §3
call §3
call §1
call §0
call §sl
call §3
call §3
call §3
call §0
call §SP
call §SP
call §BL
call §BL
call §BL
call §G
call §R
call §A
call §P
call §H
call §I
call §C
call §SP
call §D
call §I
call §S
call §P
call §L
call §A
call §Y
call §SP
call §T
call §E
call §S
call §T
call §BL
call §BL
call §BL
call §SP
call §SP
call §SP
call §SP
call §SP
call §0
call §1
call §2
call §3
call §4
call §5
call §6
call §7
call §8
call §9
call §.
call §sl
call §SP
call §SP
call §SP
call §SP
call §SP
call §SP
call §SP
call §A
call §B
call §C
call §D
call §E
call §F
call §G
call §H
call §I
call §J
call §K
call §L
call §M
call §N
call §O
call §SP
call §SP
call §BL
call §SP
call §SP
call §SP
call §P
call §Q
call §R
call §S
call §T
call §U
call §V
call §W
call §X
call §Y
call §Z
call §SP
call §m
call §u
call §s
call §SP
call §SP
call §SP
call §SP
call §SP
call §ar
call §SP
call §su
call §SP
call §sd
call §SP
call §os
call §SP
call §ct
call §SP
call §sk
call §SP
call §SP
call §SP
call §SP
sleep
DLine1 movlw 0x40
call COut
movlw 0x80
call COut
return
COut bcf _DC
movwf Dtemp1
goto LCDOut
DOut bsf _DC
movwf Dtemp1
LCDOut movlw 8
movwf DTemp
SerSend bcf _SDT
btfsc Dtemp1,7
bsf _SDT
rlf Dtemp1,1
bsf _SCK
bcf _SCK
decfsz DTemp,1
goto SerSend
return
Init movlw 7 ; set comparator off
movwf CMCON ; and RA0-3 to digital I/O
bsf STATUS, RP0 ; bank1
bcf OPTION_REG,7 ; enable pull-ups
clrf TRISA ; set RA0-5 as outputs
clrf TRISC ; set RC0-5 as outputs
call 0x3FF ; call calibration value
movwf OSCCAL ; calibrate internal RC oscillator
bcf STATUS, RP0 ; bank 0
clrf PORTA
clrf PORTC
movlw 0x20 ; chip active, horizontal adressing, basic instruction set
call COut
movlw 0x0C ; normal mode
call COut
return
§0 call §BL
movlw 0x3E
call DOut
movlw 0x22
call DOut
movlw 0x3E
call DOut
return
§1 call §BL
movlw 4
call DOut
movlw 0x3E
call DOut
call §BL
return
§2 call §BL
movlw 0x3A
call DOut
movlw 0x2A
call DOut
movlw x2E
call DOut
return
§3 call §BL
movlw 0x2A
call DOut
movlw 0x2A
call DOut
movlw 0x3E
call DOut
return
§4 call §BL
movlw 0x0E
call DOut
movlw 8
call DOut
movlw 0x3E
call DOut
return
§5 call §BL
movlw 0x2E
call DOut
movlw 0x2A
call DOut
movlw 0x3A
call DOut
return
§6 call §BL
movlw 0x3E
call DOut
movlw 0x2A
call DOut
movlw 0x3A
call DOut
return
§7 call §BL
movlw 2
call DOut
movlw 0x3A
call DOut
movlw 0x6
call DOut
return
§8 call §BL
movlw 0x3E
call DOut
movlw 0x2A
call DOut
movlw 0x3E
call DOut
return
§9 call §BL
movlw 0x2E
call DOut
movlw 0x2A
call DOut
movlw 0x3E
call DOut
return
§A call §BL
movlw 0x3C
call DOut
movlw 0x0A
call DOut
movlw 0x3C
call DOut
return
§B call §BL
movlw 0x3E
call DOut
movlw 0x2A
call DOut
movlw 0x14
call DOut
return
§C call §BL
movlw 0x1C
call DOut
movlw 0x22
call DOut
movlw 0x22
call DOut
return
§D call §BL
movlw 0x3E
call DOut
movlw 0x22
call DOut
movlw 0x1C
call DOut
return
§E call §BL
movlw 0x3E
call DOut
movlw 0x2A
call DOut
movlw 0x2A
call DOut
return
§F call §BL
movlw 0x3E
call DOut
movlw 0x0A
call DOut
movlw 0x0A
call DOut
return
§G call §BL
movlw 0x1C
call DOut
movlw 0x22
call DOut
movlw 0x2A
call DOut
movlw 0x1A
call DOut
return
§H call §BL
movlw 0x3E
call DOut
movlw 8
call DOut
movlw 0x3E
call DOut
return
§I call §BL
movlw 0x3E
call DOut
return
§J call §BL
movlw 0x10
call DOut
movlw 0x20
call DOut
movlw 0x1E
call DOut
return
§K call §BL
movlw 0x3E
call DOut
movlw 0x14
call DOut
movlw 0x22
call DOut
return
§L call §BL
movlw 0x3E
call DOut
movlw 0x20
call DOut
movlw 0x20
call DOut
return
§M call §BL
movlw 0x3E
call DOut
movlw 4
call DOut
movlw 8
call DOut
movlw 4
call DOut
movlw 0x3E
call DOut
return
§N call §BL
movlw 0x3E
call DOut
movlw 4
call DOut
movlw 8
call DOut
movlw 0x10
call DOut
movlw 0x3E
call DOut
return
§O call §BL
movlw 0x1C
call DOut
movlw 0x22
call DOut
movlw 0x1C
call DOut
return
§P call §BL
movlw 0x3E
call DOut
movlw 0x0A
call DOut
movlw 4
call DOut
return
§Q call §BL
movlw 0x1C
call DOut
movlw 0x22
call DOut
movlw 0x12
call DOut
movlw 0x2C
call DOut
return
§R call §BL
movlw 0x3E
call DOut
movlw 0x1A
call DOut
movlw 0x24
call DOut
return
§S call §BL
movlw 0x24
call DOut
movlw 0x2A
call DOut
movlw 0x12
call DOut
return
§T call §BL
movlw 2
call DOut
movlw 0x3E
call DOut
movlw 2
call DOut
return
§U call §BL
movlw 0x3E
call DOut
movlw 0x20
call DOut
movlw 0x3E
call DOut
return
§V call §BL
movlw 0x1E
call DOut
movlw 0x20
call DOut
movlw 0x1E
call DOut
return
§W call §BL
movlw 0x3E
call DOut
movlw 0x10
call DOut
movlw 8
call DOut
movlw 0x10
call DOut
movlw 0x3E
call DOut
return
§X call §BL
movlw 0x36
call DOut
movlw 8
call DOut
movlw 0x36
call DOut
return
§Y call §BL
movlw 6
call DOut
movlw 0x38
call DOut
movlw 6
call DOut
return
§Z call §BL
movlw 0x32
call DOut
movlw 0x2A
call DOut
movlw 0x26
call DOut
return
§m call §BL
movlw 0x3C
call DOut
movlw 4
call DOut
movlw 8
call DOut
movlw 4
call DOut
movlw 0x38
call DOut
return
§u call §BL
movlw 0x7C
call DOut
movlw 0x10
call DOut
movlw 0x20
call DOut
movlw 0x1C
call DOut
call §BL
return
§s call §BL
movlw 0x20
call DOut
movlw 0x28
call DOut
movlw 0x14
call DOut
call §BL
call §BL
return
§. call §BL
movlw 0x20
call DOut
return
§sl call §BL ; /
movlw 0x20
call DOut
movlw 0x10
call DOut
movlw 8
call DOut
movlw 4
call DOut
movlw 2
call DOut
return
§ar call §BL
movlw 0x3E
call DOut
movlw 0x1C
call DOut
movlw 8
call DOut
return
§ct call §BL ; continous
movlw 0x3E
call DOut
movlw 0x20
call DOut
movlw 0x3E
call DOut
movlw 0x20
call DOut
movlw 0x3E
call DOut
return
§os call §BL ; one shot
movlw 0x20
call DOut
movlw 0x20
call DOut
movlw 0x3E
call DOut
movlw 0x20
call DOut
movlw 0x20
call DOut
return
§su call §BL ; slope up
movlw 0x20
call DOut
movlw 0x20
call DOut
movlw 0x3E
call DOut
movlw 2
call DOut
movlw 2
call DOut
return
§sd call §BL ; slope down
movlw 2
call DOut
movlw 2
call DOut
movlw 0x3E
call DOut
movlw 0x20
call DOut
movlw 0x20
call DOut
return
§sk call §BL
movlw 0x3E
call DOut
movlw 0x2A
call DOut
movlw 0x3E
call DOut
movlw 0x2A
call DOut
movlw 0x3E
call DOut
return
§SP call §BL
call §BL
call §BL
call §BL
return
§BL movlw 0
call DOut
return
§FL movlw 0xFF
call DOut
return
end


Modifizierte Ausgabe für 2-pin Anschluß:

COut bcf _Fdc
movwf Dtemp1
goto LCDOut
DOut bsf _Fdc
movwf Dtemp1
LCDOut movlw 8
movwf DTemp
SerSend bcf _SDT
btfsc _Fdc
bsf _SDT
bcf _SCK
bcf _SDT
btfsc DTemp1,7
bsf _SDT
bsf _SCK
rlf DTemp1,1
decfsz DTemp,1
goto SerSend
return