|
|
View previous topic :: View next topic |
Author |
Message |
jorden Guest
|
pic 16f877a |
Posted: Tue May 06, 2008 9:27 am |
|
|
hello i need some help.
Iam still writing on the source code to conect the matrix driver max6952 with the pic 16f877a spi bus
I try to show a one on the matrix
but it doesnt work
could anybody help me
Thats the source code
list p=16f877a
;**************************************************************
;*
;* Pinbelegung
;* ----------------------------------
;* PORTA: 0
;* 1
;* 2
;* 3
;* 4
;* PORTB: 0
;* 1
;* 2
;* 3
;* 4
;* 5
;* 6
;* 7
;*
;**************************************************************
;
;
;
;
;
;**************************************************************
; Includedatei für den 16F84a einbinden
;
; #include <P16f877A.INC>
;
; Configuration festlegen
;
; bis 4 MHz: Power on Timer, kein Watchdog, XT-Oscillator
; __CONFIG _BODEN_OFF & _PWRTE_OFF & _CP_OFF & _WDT_OFF & _XT_OSC
;
;**************************************************************
; Variablennamen vergeben
#define SS PORTA,2 ; Clock Select 0
CONFIGU Equ 0x21
CONFIGL Equ 0x22
INTENSIU10 Equ 0x23
INTENSIL10 Equ 0x24
INTENSIU32 Equ 0x25
INTENSIL32 Equ 0x26
DISPLU Equ 0x27
DISPLL Equ 0x28
TRISA Equ 0x85
TRISC Equ 0x87
STATUS Equ 0x03
RP0 Equ 5
PORTA Equ 0x05
PCLATH Equ 0x0A
INTCON Equ 0x0B
SSPCON Equ 0x14
SSPBUF Equ 0x13
SSPSTAT Equ 0x94
BF Equ 0
ADCON1 Equ 0x9F
ORG 0x00
;**************************************************************
;
; los gehts mit dem Programm
; Ausgaenge einstellen
Init
bsf STATUS, RP0 ; auf Bank 1 umschalten
movlw b'00000000' ; PortB und C alle output
movwf TRISA
movlw 0x06
movwf ADCON1
movlw 0x10
movwf TRISC
movlw b'01000000'
movwf SSPSTAT
bcf STATUS, RP0 ; auf Bank 0 zurückschalten
movlw b'0011001'
movwf SSPCON
movlw 0x04
movwf CONFIGU
movlw 0x01
movwf CONFIGL
movlw 0x01
movwf INTENSIU10
movlw 0xFF
movwf INTENSIL10
movlw 0x02
movwf INTENSIU32
movlw 0xFF
movwf INTENSIL32
movlw 0x20
movwf DISPLU
movlw 0x31
movwf DISPLL
;*************************************************************
Hauptrogramm
bcf SS
movf CONFIGL,0
call Transmit
movf CONFIGU,0
call Transmit
bsf SS
bcf SS
movf INTENSIL10,0
call Transmit
movf INTENSIU10,0
call Transmit
bsf SS
bcf SS
movf INTENSIL32,0
call Transmit
movf INTENSIU32,0
call Transmit
bsf SS
bcf SS
movf DISPLL,0
call Transmit
movf DISPLU,0
call Transmit
bsf SS
Finish
goto Finish
Transmit
movwf SSPBUF
bsf STATUS,RP0
LOOP btfss SSPSTAT, BF
goto LOOP
bcf STATUS, RP0
return
end |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|