-
 

  - >

,

 
16.01.2009, 23:50   #1
floke
Member
 
: 30.11.2008
: 28
: 55
: 100/34
floke will become famous soon enoughfloke will become famous soon enough
 pic 16f877 + spi... ?

.
: spi ( 8 ).
. , . , :
:
 
#INCLUDE P16F877.INC
#INCLUDE MACROS.INC
I0 EQU H'20'
I1 EQU H'21'
I2 EQU H'22'
I3 EQU H'23'
I4 EQU H'24'
I5 EQU H'25'
I6 EQU H'26'
I7 EQU H'27'
I8 EQU H'28'
I9 EQU H'29'
I10 EQU H'2A'
I11 EQU H'2B'
I12 EQU H'2C'
I13 EQU H'2D'
I14 EQU H'2E'
I15 EQU H'2F'
ADDR EQU H'30'
COUNT1 EQU H'31'
COUNT2 EQU H'32'
COUNT3 EQU H'33'
RECORD EQU H'34'
H_BYTE1 EQU H'35'
L_BYTE1 EQU H'36'
INFO11 EQU H'37'
INFO12 EQU H'38'
INFO13 EQU H'39'
INFO14 EQU H'3A'
INFO15 EQU H'3B'
INFO16 EQU H'3C'
INFO17 EQU H'3D'
INFO18 EQU H'3E'
READING EQU H'3F'
H_BYTE2 EQU H'40'
L_BYTE2 EQU H'41'
INFO21 EQU H'42'
INFO22 EQU H'43'
INFO23 EQU H'44'
INFO24 EQU H'45'
INFO25 EQU H'46'
INFO26 EQU H'47'
INFO27 EQU H'48'
INFO28 EQU H'49'
RECEI_BYTE EQU H'4A'
DELIV_BYTE EQU H'4B'
N EQU H'4C'
N1 EQU H'4D'
N2 EQU H'4E'
;*******************
ORG H'0000' ; 
GOTO BEGIN
 
PAUSE ;   1 
MOVLW H'0A' ;10(DEC)=A(HEX)
MOVWF N
LOOP_N
MOVLW H'C8' ;200(DEC)=C8(HEX) 
MOVWF N1
NOP
LOOP_N1 
MOVLW H'F9' ;249(DEC)=F9(HEX)
MOVWF N2 
LOOP_N2
DECFSZ N2,F
GOTO LOOP_N2 
DECFSZ N1,F
GOTO LOOP_N1
DECFSZ N,F
GOTO LOOP_N
RETURN
 
INIT_PIC
MOVLW H'20' ;W=H'20'
MOVWF ADDR ;     
CALL INITDIS ; 
BSF STATUS,RP0 ;   
MOVLW H'06' ;W=H'06'
MOVWF ADCON1 ;ADCON1=W, -
MOVLW H'29' ;W=H'29'
MOVWF TRISA ;TRISA=W, RA0,RA3,RA5 -  , RA1,RA2,RA4 -  
MOVLW H'FD' ;W=H'FD'
MOVWF TRISB ;TRISB=W, RB1 -  
MOVLW H'D7' ;W=H'D7'
MOVWF TRISC ;TRISC=W, RC3,RC5 -  
MOVLW H'FF' ;W=H'FF'
MOVWF TRISD ;TRISD=W,  -  
MOVLW H'00' ;W=H'00'
MOVWF TRISE ;TRISE=W,  -  
BCF STATUS,RP0 ;   
MOVLW H'21' ;W=H'21'=B'00100001'
MOVWF SSPCON ;SSPCON=W,   SPI,   Fosc/16, MSSP 
BSF STATUS,RP0
MOVLW H'C0' ;W=H'C0'=B'11000000'
MOVWF SSPSTAT ;SSPSTAT=W, CKE='1',CKP='0',SMP='1'
BCF STATUS,RP0 ;   
BCF INTCON,GIE ; 
BCF PIR1,SSPIF ; SSPIF='0'
RETURN
 
SENDING
MOVLW H'34' ;W=H'34' 
MOVWF FSR ;FSR=W,  
MOVLW H'0B' ;W=H'0B' 
MOVWF N ;N=W,   (11 )
MOVLW H'02' ;W=H'02'
MOVWF RECORD ;RECORD=W,   
MOVLW H'00' ;W=H'00'
MOVWF H_BYTE1 ;H_BYTE1=W,     
MOVLW H'00' ;W=H'00' 
MOVWF L_BYTE1 ;L_BYTE1=W,     
MOVLW H'31' ;W=H'31',    
MOVWF INFO11 ;INFO11=W,  
MOVLW H'32' ;W=H'32',    
MOVWF INFO12 ;INFO12=W,  
MOVLW H'33' ;W=H'33',    
MOVWF INFO13 ;INFO13=W,  
MOVLW H'34' ;W=H'34',    
MOVWF INFO14 ;INFO14=W,  
MOVLW H'35' ;W=H'35',    
MOVWF INFO15 ;INFO15=W,  
MOVLW H'36' ;W=H'36',    
MOVWF INFO16 ;INFO16=W,  
MOVLW H'37' ;W=H'37',    
MOVWF INFO17 ;INFO17=W,  
MOVLW H'38' ;W=H'38',    
MOVWF INFO18 ;INFO18=W,  
MOVF INFO11,W
MOVWF I0
MOVF INFO12,W
MOVWF I1
MOVF INFO13,W
MOVWF I2
MOVF INFO14,W
MOVWF I3
MOVF INFO15,W
MOVWF I4
MOVF INFO16,W
MOVWF I5
MOVF INFO17,W
MOVWF I6
MOVF INFO18,W
MOVWF I7
CALL LINE1 ;    
BCF PORTB,1 ;RB1='0' ; 
MOVLW H'06' ;W=H'06'
MOVWF SSPBUF ;SSPBUF=W,   
 
L1 
BTFSS PIR1,SSPIF ;SSPIF=1?,   ?
GOTO L1 ;
BSF PORTB,1 ;, RB1='1'
 
BCF PORTB,1 ;RB1='0'
LABEL1
MOVF INDF,W ;W=INDF
MOVWF SSPBUF ;SSPBUF=W
 
L2
BTFSS PIR1,SSPIF ;SSPIF=1?,   ?
GOTO L2 ;
INCF FSR,f ;, FSR=FSR+1
DECFSZ N,F ;N=N-1 N=0?
bcf PIR1,SSPIF ;
GOTO LABEL1 ;
BSF PORTB,1 ;, RB1='1'
RETURN ;
 
RECEIVING
MOVLW H'3F' ;W=H'3F' 
MOVWF FSR ;FSR=W,  
MOVLW H'0B' ;W=H'11'
MOVWF N ;N=W,  
MOVLW H'03' ;W=H'03'
MOVWF READING ;READING=W,   
MOVLW H'31' ;W=H'31'
MOVWF H_BYTE2 ;H_BYTE2=W,     
MOVLW H'31' ;W=H'31'
MOVWF L_BYTE2 ;H_BYTE2=W,     
MOVLW H'30' ;W=H'30'
MOVWF INFO21 ;INFO2=W,  -   
MOVWF INFO22 ;INFO2=W,  -   
MOVWF INFO23 ;INFO2=W,  -   
MOVWF INFO24 ;INFO2=W,  -   
MOVWF INFO25 ;INFO2=W,  -   
MOVWF INFO26 ;INFO2=W,  -   
MOVWF INFO27 ;INFO2=W,  -   
MOVWF INFO28 ;INFO2=W,  -   
BCF PORTB,1 ;RB1='0'
 
LABEL2
bcf PIR1,SSPIF ;
MOVF INDF,W ;W=INDF
MOVWF SSPBUF ;SSPBUF=W
 
L3
BTFSS PIR1,SSPIF ;SSPIF=1?  ?
GOTO L3 ;
MOVF SSPBUF,W ;, W=SSPBUF
MOVWF INDF ;INDF=W
INCF FSR,f ;FSR=FSR+1
DECFSZ N,F ;N=N-1 N=0?
GOTO LABEL2 ;
BSF PORTB,1 ;, RB1='1
CALL OBNI
MOVF INFO21,W
MOVWF I0
MOVF INFO22,W
MOVWF I1
MOVF INFO23,W
MOVWF I2
MOVF INFO24,W
MOVWF I3
MOVF INFO25,W
MOVWF I4
MOVF INFO26,W
MOVWF I5
MOVF INFO27,W
MOVWF I6
MOVF INFO28,W
MOVWF I7
CALL LINE2 ;    
RETURN
M_DISPLAY ADDR,COUNT1,COUNT2,COUNT3
 
BEGIN
CLRF STATUS ;   
CALL INIT_PIC
CALL SENDING
CALL RECEIVING
END
floke   
17.01.2009, 00:16   #2
floke
Member
 
: 30.11.2008
: 28
: 55
: 100/34
floke will become famous soon enoughfloke will become famous soon enough
 : pic 16f877 + spi... ?

: ( I1 - I16). ( initdis, line1, line2... , ). , , - ( , - info21-INFO28)
floke   
17.01.2009, 11:32   #3
Greg
Super Moderator
 
: 25.02.2007
: Moscow, ODBS
: 6,652
: 5137/157
Greg has a reputation beyond reputeGreg has a reputation beyond reputeGreg has a reputation beyond reputeGreg has a reputation beyond reputeGreg has a reputation beyond reputeGreg has a reputation beyond reputeGreg has a reputation beyond reputeGreg has a reputation beyond reputeGreg has a reputation beyond reputeGreg has a reputation beyond reputeGreg has a reputation beyond repute

:
floke
: ( I1 - I16). ( initdis, line1, line2... , ). , , - ( , - info21-INFO28)
?
, - , . - , .
.. . .
Greg   
17.01.2009, 15:21   #4
Bill
Senior Member
 
  Bill
 
: 26.02.2007
:
: 67
: 2,215
: 1898/80
Bill has a brilliant futureBill has a brilliant futureBill has a brilliant futureBill has a brilliant futureBill has a brilliant futureBill has a brilliant futureBill has a brilliant futureBill has a brilliant futureBill has a brilliant futureBill has a brilliant futureBill has a brilliant future
 .

:
floke
: ( I1 - I16). ( initdis, line1, line2... , ). , , - ( , - info21-INFO28)
RECEIVING?
:
BEGIN
CLRF STATUS ;   
CALL INIT_PIC
CALL SENDING
CALL RECEIVING
END
Bill   

« | »

: 1 (: 0 , : 1)
 


.
HTML .



PIC 16F877 SD Card AlexWonder MICROCHIP 26 11.02.2011 13:14
SPI dsPIC33FJ33GP202 MICROCHIP 6 28.11.2008 17:29
PIC ? - PIC18F452 :) DRoVik MICROCHIP 7 12.02.2008 01:51
GPS BR-304 PIC ? MICROCHIP 20 02.11.2007 01:01
CLIP-FSK PIC ? an-sver MICROCHIP 3 20.03.2007 09:33


GMT +3, : 20:36.

- -

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd. : zCarot