Aus RN-Wissen.de
Wechseln zu: Navigation, Suche
Rasenmaehroboter Test

(MAX7456)
(MAX7456 (S/W OSD))
Zeile 68: Zeile 68:
  
 
== MAX7456 (S/W OSD) ==
 
== MAX7456 (S/W OSD) ==
 +
 +
Variabeln und I/0:
 +
<pre>
 +
cblock 0x70 ; Variabeln ab 0x70 setzen alle Register max 16stk.
 +
SPI_DATA_WRITE ; Zu Sendene SPI Daten
 +
SPI_DATA_READ ; Gelesend SPI Daten
 +
ZählerA ; Zähler für delay.inc
 +
ZählerB
 +
ZählerC
 +
m_char ; Maxim7456 und sda5708 Zeichen
 +
m_pos ; Maxim7456 Position
 +
endc ; Variabeln setzen beenden
 +
 +
#define SPI_CS PORTC, 7; SPI Slave Select max7456
 +
</pre>
 +
 +
Config:
 +
<pre>
 +
; PORTC
 +
banksel TRISC ; auf Bank 1 umschalten
 +
movlw B'10010000' ; PortC I/O setzen (1=In, 0=Out) (Reinfolge RC7,RC6...)
 +
movwf TRISC ; PortC I/O setzen
 +
banksel PORTC
 +
clrf PORTC ; PortC auf 0 setzen
 +
; SPI
 +
banksel SSPSTAT
 +
movlw B'11000000' ; Mitlere Geschwindigkeit Output Time
 +
movwf SSPSTAT
 +
banksel SSPCON
 +
movlw B'00100001' ; MODE 1,1, SPI MASTER, 1/16 Tosc SSP ON
 +
movwf SSPCON
 +
banksel PORTC
 +
bsf SPI_CS ; SPI Slave Select aus (high)
 +
return
 +
</pre>
 +
 +
SPI  Sende/Enfangs Rotinen:
 +
<pre>
 +
SPI_Send
 +
banksel PORTC
 +
bcf SPI_CS ; Chip Select an (Low)
 +
nop
 +
nop
 +
nop
 +
banksel SSPBUF
 +
movf SPI_DATA_WRITE, W
 +
movwf SSPBUF
 +
banksel SSPSTAT
 +
SPI_Wait
 +
btfss SSPSTAT, BF ; Ist das Senden Komplet ?
 +
goto SPI_Wait ; Wen nicht gehe zu SPIWait
 +
nop
 +
nop
 +
nop
 +
banksel PORTC
 +
bsf SPI_CS ; Chip Select aus (High)
 +
return
 +
SPI_Read
 +
banksel PORTC
 +
bcf SPI_CS
 +
nop
 +
nop
 +
nop
 +
banksel SSPBUF
 +
movf SSPBUF, W
 +
movwf SPI_DATA_READ
 +
banksel PORTC
 +
nop
 +
nop
 +
nop
 +
banksel PORTC
 +
bsf SPI_CS
 +
return
 +
</pre>
 +
 +
Defines ASCII to MAX7456 Charset und Config und Schreibrotienen:
 +
<pre>
 +
max7456_define ; Defines für den max7456 Zeichensatz
 +
#define m_sp 0x00 ; Space
 +
#define m_1 0x01
 +
#define m_2 0x02
 +
#define m_3 0x03
 +
#define m_4 0x04
 +
#define m_5 0x05
 +
#define m_6 0x06
 +
#define m_7 0x07
 +
#define m_8 0x08
 +
#define m_9 0x09
 +
#define m_0 0x0A
 +
#define m_A 0x0B
 +
#define m_B 0x0C
 +
#define m_C 0x0D
 +
#define m_D 0x0E
 +
#define m_E 0x0F
 +
#define m_F 0x10
 +
#define m_G 0x11
 +
#define m_H 0x12
 +
#define m_I 0x13
 +
#define m_J 0x14
 +
#define m_K 0x15
 +
#define m_L 0x16
 +
#define m_M 0x17
 +
#define m_N 0x18
 +
#define m_O 0x19
 +
#define m_P 0x1A
 +
#define m_Q 0x1B
 +
#define m_R 0x1C
 +
#define m_S 0x1D
 +
#define m_T 0x1E
 +
#define m_U 0x1F
 +
#define m_V 0x20
 +
#define m_W 0x21
 +
#define m_X 0x22
 +
#define m_Y 0x23
 +
#define m_Z 0x24
 +
#define m_a 0x25
 +
#define m_b 0x26
 +
#define m_c 0x27
 +
#define m_d 0x28
 +
#define m_e 0x29
 +
#define m_f 0x2A
 +
#define m_g 0x2B
 +
#define m_h 0x2C
 +
#define m_i 0x2D
 +
#define m_j 0x2E
 +
#define m_k 0x2F
 +
#define m_l 0x30
 +
#define m_m 0x31
 +
#define m_n 0x32
 +
#define m_o 0x33
 +
#define m_p 0x34
 +
#define m_q 0x35
 +
#define m_r 0x36
 +
#define m_s 0x37
 +
#define m_t 0x38
 +
#define m_u 0x39
 +
#define m_v 0x3A
 +
#define m_w 0x3B
 +
#define m_x 0x3C
 +
#define m_y 0x3D
 +
#define m_z 0x3E
 +
#define m_KLa 0x3F ; (
 +
#define m_KLz 0x40 ; )
 +
#define m_. 0x41
 +
#define m_? 0x42
 +
#define m_sem 0x43 ; ;
 +
#define m_: 0x44
 +
#define m_ko 0x45 ; ,
 +
#define m_ag 0x46 ; Agostroff
 +
#define m_bs 0x47 ; Backslasch
 +
#define m_as 0x48 ; Anfürungsstriche
 +
#define m_minus  0x49 ; Minus
 +
#define m_ka 0x4A ; <
 +
#define m_ga 0x4B ; >
 +
#define m_at 0x4C ; @ oder at
 +
#define m_wait 0xfb ; Wartezeichen
 +
#define m_ls 0xf9 ; Lautsprecher
 +
#define m_lso 0xfa ; Tonsignal
 +
#define m_ff 0xff ; Ausgefültes feld
 +
return
 +
 +
max7456_conf ; Max7456 Config
 +
movlw 0x00 ; VM0 Video Mode Register 0 (Write)
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw B'01001000' ; 0 , 1=PAL, 00=Auto Sync, 1=Enable OSD, 0=Enable OSD immer, 0=SW RST, 0=Enable Video Buffer
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw 0x01 ; VM1 Video Mode Register 1
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw B'00000100' ; 0 = NA, 000=Background MODE Brightness 100%, 11=Blinking Time 160ms, 00=Blinking Duty Cycle BT:BT
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw 0x02 ; HOS Horizontal Offset Register
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw B'00101111' ; 00 = NA, 100000 = Horitzontal Offset
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw 0x03 ; VOS Vertical Offset Register
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw B'00010111' ; 000 = NA, 10000 = Vertical Offset
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
return
 +
 +
max7456_cls ; max7456 ausgabe Löschen
 +
movlw 0x00 ; VM0 Video Mode Register 0 (Write)
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw B'01001010' ; 0 , 1=PAL, 00=Auto Sync, 1=Enable OSD, 0=Enable OSD immer, 1=SW RST, 0=Enable Video Buffer
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
call max7456_conf
 +
return
 +
 +
max7456_add_high ; High adressbereich
 +
movlw 0x05 ; Ersten 256 zeichen Low = 0x00, Letzten 256 Zeichen High=0xff
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw 0xFF
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
return
 +
 +
max7456_add_low ; Low Adressbereich
 +
movlw 0x05 ; Ersten 256 zeichen Low = 000, Letzten 256 Zeichen High=225
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw 0x00
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
return
 +
 +
max7456_send_char
 +
movlw 0x06 ; Zeichen Position links nach rechts erste reihe 0-29, 30-......
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movf m_pos, W
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movlw 0x07 ; Zeichen Sonderzeichen sihe Define in max7456.inc
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
movf m_char, W
 +
movwf SPI_DATA_WRITE
 +
call SPI_Send
 +
return
 +
</pre>
 +
 +
Zeichen Senden:
 +
<pre>
 +
movlw D'12' ; Position
 +
movwf m_pos
 +
movlw m_e ; Zeichen (hier das kleine e)
 +
movwf m_char
 +
call max7456_send_char; Schreiben
 +
</pre>
 +
 +
High/low Adressbereich (low = ersten 256 Zeichen, High die letzten 128 Zeichen);
 +
 +
<pre>
 +
call max7456_add_low ; Low Adressbereich
 +
;call max7456_add_high; Low Adressbereich
 +
</pre>
  
 
= PIC18(F/LF)xxxx =
 
= PIC18(F/LF)xxxx =

Version vom 15. September 2009, 22:10 Uhr

PIC16(F/LF)XXX

Schieberegister (z.b. CD4094)

	; Datenleitungen Schiberegister alles Ausgänge
	#define		CLK		PORTB, 0
	#define		D	 	PORTB, 1
	#define		STR		PORTB, 2
	#define		T1		PORTB, 6
 cd4094_send
	banksel	PORTB
	bcf		STR
	btfsc	cdsend, 0
	bsf		D
	btfss		cdsend, 0
	bcf		D
	bsf		CLK
	bcf		CLK
	btfsc	cdsend, 1
	bsf		D
	btfss		cdsend, 1
	bcf		D
	bsf		CLK
	bcf		CLK
	btfsc	cdsend, 2
	bsf		D
	btfss		cdsend, 2
	bcf		D
	bsf		CLK
	bcf		CLK
	btfsc	cdsend, 3
	bsf		D
	btfss		cdsend, 3
	bcf		D
	bsf		CLK
	bcf		CLK
	btfsc	cdsend, 4
	bsf		D
	btfss		cdsend, 4
	bcf		D
	bsf		CLK
	bcf		CLK
	btfsc	cdsend, 5
	bsf		D
	btfss		cdsend, 5
	bcf		D
	bsf		CLK
	bcf		CLK
	btfsc	cdsend, 6
	bsf		D
	btfss		cdsend, 6
	bcf		D
	bsf		CLK
	bcf		CLK
	btfsc	cdsend, 7
	bsf		D
	btfss		cdsend, 7
	bcf		D
	bsf		CLK
	bcf		CLK
	bsf		STR
	return

MAX7456 (S/W OSD)

Variabeln und I/0:

	cblock	0x70		; Variabeln ab 0x70 setzen alle Register max 16stk.
	SPI_DATA_WRITE		; Zu Sendene SPI Daten
	SPI_DATA_READ		; Gelesend SPI Daten
	ZählerA			; Zähler für delay.inc
	ZählerB
	ZählerC
	m_char			; Maxim7456 und sda5708 Zeichen
	m_pos			; Maxim7456 Position
	endc 			; Variabeln setzen beenden

	#define	SPI_CS	PORTC, 7; SPI Slave Select max7456

Config:

	; PORTC
	banksel	TRISC			; auf Bank 1 umschalten
	movlw	B'10010000'		; PortC I/O setzen (1=In, 0=Out) (Reinfolge RC7,RC6...)
	movwf	TRISC			; PortC I/O setzen
	banksel	PORTC
	clrf	PORTC			; PortC auf 0 setzen
	; SPI
	banksel	SSPSTAT
	movlw	B'11000000'		; Mitlere Geschwindigkeit Output Time 
	movwf	SSPSTAT
	banksel	SSPCON
	movlw	B'00100001'		; MODE 1,1, SPI MASTER, 1/16 Tosc SSP ON
	movwf	SSPCON
	banksel	PORTC
	bsf	SPI_CS			; SPI Slave Select aus (high)
	return

SPI Sende/Enfangs Rotinen:

SPI_Send
	banksel	PORTC
	bcf		SPI_CS			; Chip Select an (Low)
	nop
	nop
	nop
	banksel	SSPBUF
	movf	SPI_DATA_WRITE, W
	movwf	SSPBUF
	banksel	SSPSTAT
SPI_Wait
	btfss	SSPSTAT, BF		; Ist das Senden Komplet ?
	goto	SPI_Wait			; Wen nicht gehe zu SPIWait
	nop
	nop
	nop
	banksel	PORTC
	bsf 		SPI_CS			; Chip Select aus (High)
	return 
SPI_Read
	banksel	PORTC
	bcf		SPI_CS
	nop
	nop
	nop
	banksel	SSPBUF
	movf	SSPBUF, W
	movwf	SPI_DATA_READ
	banksel	PORTC
	nop
	nop
	nop
	banksel	PORTC
	bsf		SPI_CS
	return

Defines ASCII to MAX7456 Charset und Config und Schreibrotienen:

max7456_define				; Defines für den max7456 Zeichensatz
	#define	m_sp	0x00		; Space
	#define	m_1		0x01
	#define	m_2		0x02
	#define	m_3		0x03
	#define	m_4		0x04
	#define	m_5		0x05
	#define	m_6		0x06
	#define	m_7		0x07
	#define	m_8		0x08
	#define	m_9		0x09
	#define	m_0		0x0A
	#define	m_A		0x0B
	#define	m_B		0x0C
	#define	m_C		0x0D
	#define	m_D		0x0E
	#define	m_E		0x0F
	#define	m_F		0x10
	#define	m_G		0x11
	#define	m_H		0x12
	#define	m_I		0x13
	#define	m_J		0x14
	#define	m_K		0x15
	#define	m_L		0x16
	#define	m_M	0x17
	#define	m_N		0x18
	#define	m_O		0x19
	#define	m_P		0x1A
	#define	m_Q		0x1B
	#define	m_R		0x1C
	#define	m_S		0x1D
	#define	m_T		0x1E
	#define	m_U		0x1F
	#define	m_V		0x20
	#define	m_W	0x21
	#define	m_X		0x22
	#define	m_Y		0x23
	#define	m_Z		0x24
	#define	m_a		0x25
	#define	m_b		0x26
	#define	m_c		0x27
	#define	m_d		0x28
	#define	m_e		0x29
	#define	m_f		0x2A
	#define	m_g		0x2B
	#define	m_h		0x2C
	#define	m_i		0x2D
	#define	m_j		0x2E
	#define	m_k		0x2F
	#define	m_l		0x30
	#define	m_m		0x31
	#define	m_n		0x32
	#define	m_o		0x33
	#define	m_p		0x34
	#define	m_q		0x35
	#define	m_r		0x36
	#define	m_s		0x37
	#define	m_t		0x38
	#define	m_u		0x39
	#define	m_v		0x3A
	#define	m_w		0x3B
	#define	m_x		0x3C
	#define	m_y		0x3D
	#define	m_z		0x3E
	#define	m_KLa	0x3F	; (
	#define	m_KLz	0x40		; )
	#define	m_.		0x41
	#define	m_?		0x42
	#define	m_sem	0x43		; ;
	#define	m_:		0x44
	#define	m_ko	0x45		; ,
	#define	m_ag	0x46		; Agostroff
	#define	m_bs	0x47		; Backslasch
	#define	m_as	0x48		; Anfürungsstriche
	#define	m_minus  0x49		; Minus
	#define	m_ka	0x4A		; <
	#define	m_ga	0x4B	; >
	#define	m_at	0x4C	; @ oder at
	#define	m_wait	0xfb		; Wartezeichen
	#define	m_ls		0xf9		; Lautsprecher
	#define	m_lso	0xfa		; Tonsignal
	#define	m_ff		0xff		; Ausgefültes feld
	return

max7456_conf					; Max7456 Config
	movlw	0x00				; VM0 Video Mode Register 0 (Write)
	movwf	SPI_DATA_WRITE	
	call		SPI_Send
	movlw	B'01001000'		; 0 , 1=PAL, 00=Auto Sync, 1=Enable OSD, 0=Enable OSD immer, 0=SW RST, 0=Enable Video Buffer
	movwf	SPI_DATA_WRITE	
	call		SPI_Send	
	movlw	0x01				; VM1 Video Mode Register 1
	movwf	SPI_DATA_WRITE	
	call		SPI_Send
	movlw	B'00000100'		; 0 = NA, 000=Background MODE Brightness 100%, 11=Blinking Time 160ms, 00=Blinking Duty Cycle BT:BT
	movwf	SPI_DATA_WRITE
	call		SPI_Send	
	movlw	0x02				; HOS Horizontal Offset Register
	movwf	SPI_DATA_WRITE	
	call		SPI_Send
	movlw	B'00101111'		; 00 = NA, 100000 = Horitzontal Offset
	movwf	SPI_DATA_WRITE
	call		SPI_Send	
	movlw	0x03				; VOS Vertical Offset Register
	movwf	SPI_DATA_WRITE	
	call		SPI_Send
	movlw	B'00010111'		; 000 = NA, 10000 = Vertical Offset
	movwf	SPI_DATA_WRITE
	call		SPI_Send	
	return

max7456_cls					; max7456 ausgabe Löschen
	movlw	0x00				; VM0 Video Mode Register 0 (Write)
	movwf	SPI_DATA_WRITE	
	call		SPI_Send
	movlw	B'01001010'		; 0 , 1=PAL, 00=Auto Sync, 1=Enable OSD, 0=Enable OSD immer, 1=SW RST, 0=Enable Video Buffer
	movwf	SPI_DATA_WRITE	
	call		SPI_Send	
	call		max7456_conf
	return

max7456_add_high				; High adressbereich
	movlw	0x05				; Ersten 256 zeichen Low = 0x00, Letzten 256 Zeichen High=0xff 
	movwf	SPI_DATA_WRITE	
	call		SPI_Send
	movlw	0xFF
	movwf	SPI_DATA_WRITE	
	call		SPI_Send	
	return

max7456_add_low				; Low Adressbereich
	movlw	0x05				; Ersten 256 zeichen Low = 000, Letzten 256 Zeichen High=225 
	movwf	SPI_DATA_WRITE	
	call		SPI_Send
	movlw	0x00
	movwf	SPI_DATA_WRITE	
	call		SPI_Send	
	return

max7456_send_char
	movlw	0x06				; Zeichen Position links nach rechts erste reihe 0-29, 30-......
	movwf	SPI_DATA_WRITE	
	call		SPI_Send
	movf	m_pos, W
	movwf	SPI_DATA_WRITE	
	call		SPI_Send	
	movlw	0x07				; Zeichen Sonderzeichen sihe Define in max7456.inc
	movwf	SPI_DATA_WRITE	
	call		SPI_Send
	movf	m_char, W
	movwf	SPI_DATA_WRITE	
	call		SPI_Send	
	return

Zeichen Senden:

	movlw	D'12'			; Position
	movwf	m_pos
	movlw	m_e			; Zeichen (hier das kleine e)
	movwf	m_char
	call	max7456_send_char; Schreiben

High/low Adressbereich (low = ersten 256 Zeichen, High die letzten 128 Zeichen);

	call		max7456_add_low	; Low Adressbereich
	;call		max7456_add_high; Low Adressbereich

PIC18(F/LF)xxxx


LiFePO4 Speicher Test