Ga naar inhoud


Aanbevolen berichten

Geplaatst:

Hi All,<P>Heeft iemand misschien een Source-code van een PIC (hex)file of weet waar deze te vinden? Bij voorbaat dank!<P>Groet,<P>MacElie<P>------------------<BR>


Geplaatst:

TITLE 'Mastercrd.ASM'<BR> LIST P=16F84<BR> <BR>IO_PIN EQU 007H ;SET INPUT / OUTPUT PIN<BR>;<BR>IO_MASK = 0FFH & ~(1 << IO_PIN)<BR> <BR> <BR>CY EQU 0 ; Carry/borrow bit<BR>DC EQU 1 ; Digit carry<BR>Z EQU 2 ; Zero flag<BR>PD EQU 3 ; Power down<BR>T0 EQU 4 ; Time-out bit<BR>RP0 EQU 5 ; Register page select bits<BR>RP1 EQU 6 ; Not used in 16C84<BR>RP2 EQU 7 ; Not used in 16C84<BR>INDIR EQU 00H ; Indirect pointer<BR>RTCC EQU 01H ; Real time clock / counter<BR>PCL EQU 02H ; Program counter low byte<BR>STATUS EQU 03H ; Status register<BR>FSR EQU 04H ; Indirect pointer<BR>PORTA EQU 05H ; PORT A<BR>PORTB EQU 06H ; PORT B<BR>PORTC EQU 07H ; PORT C<BR>EEDATA EQU 08H ; Eeprom data<BR>EEADR EQU 09H ; Eeprom address<BR>PCLATH EQU 0AH ; Program counter high byte<BR>INTCON EQU 0BH ; Interrupt control<BR>TRISA EQU 085H ; Data direction port A<BR>TRISB EQU 086H ; Data direction port B<BR>EECON1 EQU 088H ; Eeprom control<BR>W EQU 0 ; W reg. as destination<BR>F EQU 1 ; F file as destination<BR> <BR> <BR>SCLK EQU 5 ;SERIAL EEPROM CLOCK LINE<BR>SDATA EQU 4 ;SERIAL EEPROM DATA LINE<BR> <BR>;---------------------------------------------<BR>; Variablen Deffinition<BR>;---------------------------------------------<BR> <BR>rb0 equ 00H ; i/o card 0<BR>rb1 equ 01H ; i/o card 1<BR>rb2 equ 02H ; switch card 1<BR>rb3 equ 03H ; switch card 1<BR>rb4 equ 04H ; i/o card 2<BR>rb5 equ 05H ; usato dal soft originale (mantenuto per compatibilita')<BR>rb6 equ 06H ; switch card 2<BR>rb7 equ 07H ; i/o CAM<BR> <BR> ORG 0000H<BR> <BR> GOTO Start<BR> NOP<BR> NOP<BR> NOP<BR> RETFIE<BR> <BR>L0005 CLRF 0DH<BR> BCF STATUS,CY<BR> MOVLW 08H<BR> MOVWF 0FH<BR>L0009 RLF EEDATA,F<BR> BTFSS STATUS,CY<BR> GOTO L000D<BR> INCF 0DH,F<BR>L000D DECFSZ 0FH,F<BR> GOTO L0009<BR> RLF EEDATA,F<BR> RETURN<BR> <P><BR>L0011 MOVF 017H,W<BR>L0012 MOVWF EEDATA<BR> CALL L0005<BR> MOVLW 07FH<BR> TRIS PORTB<BR> BCF PORTB,rb7<BR> NOP<BR> NOP<BR> MOVLW 09H<BR> MOVWF 0FH<BR> CALL Schleife_A<BR> RRF 0DH,F<BR>L001D RRF EEDATA,F<BR> BTFSC STATUS,CY<BR> GOTO L0023<BR> NOP<BR> BCF PORTB,rb7<BR> GOTO L0026<BR>L0023 BSF PORTB,rb7<BR> NOP<BR> NOP<BR>L0026 CALL Schleife_A<BR> DECFSZ 0FH,F<BR> GOTO L001D<BR> NOP<BR> NOP<BR> NOP<BR> NOP<BR> NOP<BR> BSF PORTB,rb7<BR> MOVLW 0FFH<BR> TRIS PORTB<BR> MOVLW 059H<BR> CALL Schleife_B<BR> RETURN<BR> <P> <BR>;######################################################<BR>; Read Byte from Reciver<BR>;######################################################<BR>Read_Byte BTFSC PORTB,rb7<BR> GOTO Read_Byte<BR> MOVLW 02AH<BR> CALL Schleife_B<BR> MOVLW 08H<BR> MOVWF 0FH<BR>L003D RRF EEDATA,F<BR> BTFSS PORTB,rb7<BR> GOTO L0041<BR> GOTO L0043<BR>L0041 BCF EEDATA,rb7<BR> GOTO L0045<BR>L0043 BSF EEDATA,rb7<BR> NOP<BR>L0045 CALL Schleife_A<BR> DECFSZ 0FH,F<BR> GOTO L003D<BR> MOVLW 051H<BR> CALL Schleife_B<BR> MOVF EEDATA,W<BR> RETURN<BR> <P>;######################################################<BR>; Schleife.... 011H wird runtergezählt<BR>;######################################################<BR>Schleife_A MOVLW 01AH<BR>Schleife_B MOVWF 011H<BR>L004E DECFSZ 011H,F<BR> GOTO L004E<BR> RETURN<BR> <P>;######################################################<BR>; Grosse Schleife.... 011H & 0FH werden runtergezählt<BR>;######################################################<BR>grosse_Schleife MOVLW 02AH<BR> MOVWF 0FH<BR>L0053 CALL Schleife_A<BR> DECFSZ 0FH,F<BR> GOTO L0053<BR> RETURN<BR> <BR>L0072 CALL Read_Byte<BR> CALL Read_Byte<BR> MOVWF 0CH<BR> RLF 0CH,F<BR> CALL Read_Byte<BR> MOVWF EEADR<BR> CALL Read_Byte<BR> MOVWF 01AH<BR> MOVLW 0C3H<BR> CALL L0012<BR>L007C CALL Read_EE1<BR> CALL L0012<BR> DECFSZ 01AH,F<BR> GOTO L007C<BR> GOTO L0092<BR> <P>Start CLRF FSR<BR> BSF STATUS,RP0<BR> BCF RTCC,rb7<BR> BCF STATUS,RP0<BR> MOVLW 0FFH<BR> TRIS PORTA<BR> MOVLW 0FFH<BR> TRIS PORTB<BR> MOVWF PORTA<BR> MOVWF PORTB<BR> CALL grosse_Schleife<BR> CLRF 0CH<BR>;sende ATR-----------------------------------<BR> MOVLW 00H<BR> MOVWF EEADR<BR> MOVLW 0EH<BR> MOVWF 01AH<BR> GOTO send_eedata<BR>;--------------------------------------------<BR> <BR>L0092 MOVLW 090H<BR> CALL L0012<BR> MOVLW 00H<BR> CALL L0012<BR>L0096 CALL Read_Byte<BR> MOVWF 016H<BR> XORLW 0C2H<BR> BTFSC STATUS,Z<BR> GOTO L0092<BR> <BR> MOVF 016H,W<BR> XORLW 0C3H<BR> BTFSC STATUS,Z<BR> GOTO L0072<BR> MOVF 016H,W<BR> XORLW 0C1H<BR> BTFSS STATUS,Z<BR> GOTO L0096<BR> CALL Read_Byte<BR> MOVWF 017H<BR> CALL Read_Byte<BR> MOVWF 018H<BR> CALL Read_Byte<BR> MOVWF 019H<BR> CALL Read_Byte<BR> MOVWF 01AH<BR> CALL Schleife_A<BR> MOVF 017H,W<BR> XORLW 0AH<BR> BTFSC STATUS,Z<BR> GOTO L00E5<BR> <BR> MOVF 017H,W<BR> XORLW 0EH<BR> BTFSC STATUS,Z<BR> GOTO L0100<BR> <BR> MOVF 017H,W<BR> XORLW 01AH<BR> BTFSC STATUS,Z<BR> GOTO L00ED<BR> <BR> MOVF 017H,W<BR> XORLW 012H<BR> BTFSC STATUS,Z<BR> GOTO L0107<BR> <BR> MOVF 017H,W<BR> XORLW 016H<BR> BTFSC STATUS,Z<BR> GOTO L010E<BR> <BR> MOVF 017H,W<BR> XORLW 030H<BR> BTFSC STATUS,Z<BR> GOTO L0115<BR> <BR> MOVF 017H,W<BR> XORLW 032H<BR> BTFSC STATUS,Z<BR> GOTO L0118<BR> <BR> MOVF 017H,W<BR> XORLW 034H<BR> BTFSC STATUS,Z<BR> GOTO L0150<BR> <BR> MOVF 017H,W<BR> XORLW 03AH<BR> BTFSC STATUS,Z<BR> GOTO L0158<BR> <BR> MOVF 017H,W<BR> XORLW 03CH<BR> BTFSC STATUS,Z<BR> GOTO L0161<BR> <BR> MOVF 017H,W<BR> XORLW 040H<BR> BTFSC STATUS,Z<BR> GOTO L017C<BR> <BR> MOVF 017H,W<BR> XORLW 05AH<BR> BTFSC STATUS,Z<BR> GOTO L00F4<BR> <BR> MOVLW 06DH<BR> CALL L0012<BR> MOVLW 00H<BR> CALL L0012<BR> GOTO L0096<BR> <BR>L00E1 CALL Read_Byte<BR> DECFSZ 01AH,F<BR> GOTO L00E1<BR> <BR> RETURN<BR> <BR>L00E5 CALL L0011<BR> MOVLW 02H<BR> MOVWF 0CH<BR> MOVLW 00H<BR> MOVWF EEADR<BR> MOVLW 044H<BR> MOVWF 01AH<BR> GOTO send_eedata<BR> <BR>L00ED CALL L0011<BR> CLRF 0CH<BR> MOVLW 0E0H<BR> MOVWF EEADR<BR> MOVLW 020H<BR> MOVWF 01AH<BR> GOTO send_eedata<BR> <BR>L00F4 CALL L0011<BR> CLRF 0CH<BR> MOVLW 0D0H<BR> MOVWF EEADR<BR> MOVLW 08H<BR> MOVWF 01AH<BR> CALL send_EE_Data<BR> MOVLW 090H<BR> CALL L0012<BR> MOVLW 01DH<BR> CALL L0012<BR> GOTO L0096<BR> <BR>L0100 CALL L0011<BR> CLRF 0CH<BR> MOVLW 020H<BR> MOVWF EEADR<BR> MOVLW 08H<BR> MOVWF 01AH<BR> GOTO send_eedata<BR> <BR>L0107 CALL L0011<BR> MOVLW 020H<BR> MOVWF EEADR<BR> CALL L0240<BR> MOVLW 018H<BR> MOVWF 01AH<BR> GOTO send_eedata<BR> <BR>L010E CALL L0011<BR> CLRF 0CH<BR> MOVLW 040H<BR> MOVWF EEADR<BR> MOVLW 07H<BR> MOVWF 01AH<BR> GOTO send_eedata<BR> <BR>L0115 CALL L0011<BR> CALL L00E1<BR> GOTO L0092<BR> <BR>L0118 CALL L0011<BR> MOVF 044H,W<BR> XORLW 03H<BR> BTFSC STATUS,Z<BR> GOTO L012D<BR> <BR> MOVF 044H,W<BR> XORLW 04H<BR> BTFSC STATUS,Z<BR> GOTO L0143<BR> <BR> MOVLW 00H<BR> MOVWF EEADR<BR> CALL L0240<BR> MOVLW 020H<BR> MOVWF 01AH<BR> GOTO send_eedata<BR> <BR>L0127 CLRF 0CH<BR> MOVLW 060H<BR> MOVWF EEADR<BR> MOVLW 0DH<BR> MOVWF 01AH<BR> GOTO send_eedata<BR> <BR>L012D CLRF 0CH<BR> MOVLW 080H<BR> MOVWF EEADR<BR> MOVLW 020H<BR> MOVWF 01AH<BR> GOTO send_eedata<BR> <BR> MOVLW 0B1H<BR> CALL L0012<BR> DECF 01AH,F<BR> MOVLW 00H<BR> CALL L0012<BR> DECF 01AH,F<BR> MOVF 047H,W<BR> CALL L0012<BR> DECF 01AH,F<BR> MOVF 048H,W<BR> CALL L0012<BR> DECF 01AH,F<BR> CLRF 0CH<BR> MOVLW 0A4H<BR> MOVWF EEADR<BR> GOTO send_eedata<BR> <BR>L0143 MOVF 046H,W<BR> XORLW 01H<BR> BTFSC STATUS,Z<BR> GOTO L0127<BR> <BR> MOVF 046H,W<BR> XORLW 00H<BR> BTFSC STATUS,Z<BR> CLRF 0CH<BR> MOVLW 0C0H<BR> MOVWF EEADR<BR> MOVLW 020H<BR> MOVWF 01AH<BR> GOTO send_eedata<BR> <BR>L0150 CALL L0011<BR> CALL Read_Byte<BR> MOVWF 044H<BR> CALL Read_Byte<BR> MOVWF 045H<BR> CALL Read_Byte<BR> MOVWF 046H<BR> GOTO L0092<BR> <BR>L0158 CALL L0011<BR> MOVLW 01CH<BR> MOVWF FSR<BR>L015B MOVF INDIR,W<BR> CALL L0012<BR> INCF FSR,F<BR> DECFSZ 01AH,F<BR> GOTO L015B<BR> GOTO L0092<BR> <BR>L0161 CALL L0011<BR>L0162 CALL Read_Byte<BR> DECF 01AH,F<BR> XORLW 0D1H<BR> BTFSS STATUS,Z<BR> GOTO L0162<BR> CALL L0171<BR> CALL L00E1<BR> CALL L0268<BR> CALL L0247<BR> CALL L032D<BR> CALL L024F<BR> CALL L024B<BR> CALL L032D<BR> CALL L0253<BR> GOTO L0092<BR> <P>L0171 MOVLW 010H<BR> MOVWF 013H<BR> MOVLW 01CH<BR> MOVWF FSR<BR>L0175 CALL Read_Byte<BR> DECF 01AH,F<BR> MOVWF INDIR<BR> INCF FSR,F<BR> DECFSZ 013H,F<BR> GOTO L0175<BR> RETURN<BR> <P>L017C CALL L0011<BR> MOVLW 081H<BR> XORWF 019H,W<BR> BTFSS STATUS,Z<BR> GOTO L0232<BR> MOVLW 04EH<BR> XORWF 01AH,W<BR> BTFSS STATUS,Z<BR> GOTO L0232<BR> MOVLW 020H<BR> MOVWF 04BH<BR>L0187 CALL Read_Byte<BR> DECF 01AH,F<BR> DECFSZ 04BH,F<BR> GOTO L0187<BR> MOVF 01AH,W<BR> MOVWF 013H<BR> MOVLW 01CH<BR> MOVWF FSR<BR>L018F CALL Read_Byte<BR> MOVWF INDIR<BR> INCF FSR,F<BR> DECFSZ 013H,F<BR> GOTO L018F<BR> MOVF 01AH,W<BR> MOVWF 013H<BR> MOVLW 01CH<BR> MOVWF FSR<BR> CLRF EEADR<BR>L0199 MOVF INDIR,W<BR> MOVWF EEDATA<BR> CALL L03D5<BR> INCF FSR,F<BR> INCF EEADR,F<BR> DECFSZ 013H,F<BR> GOTO L0199<BR> MOVLW 0FH<BR> IORWF 019H,W<BR> MOVWF 04EH<BR> MOVF 018H,W<BR> MOVWF 04FH<BR> MOVLW 05H<BR> MOVWF 04DH<BR> CLRF EEADR<BR>L01A8 MOVF EEADR,W<BR> MOVWF 04CH<BR> MOVLW 08H<BR> MOVWF 04BH<BR> MOVLW 03CH<BR> MOVWF FSR<BR> MOVF 04CH,W<BR> MOVWF EEADR<BR>L01B0 CALL L03E0<BR> MOVWF INDIR<BR> INCF FSR,F<BR> INCF EEADR,F<BR> DECFSZ 04BH,F<BR> GOTO L01B0<BR> MOVF 04FH,W<BR> MOVWF 018H<BR> MOVF 04EH,W<BR> MOVWF 019H<BR> CALL L0268<BR> CALL L032D<BR> MOVLW 08H<BR> MOVWF 04BH<BR> MOVLW 03CH<BR> MOVWF FSR<BR> MOVF 04CH,W<BR> MOVWF EEADR<BR>L01C2 MOVF INDIR,W<BR> MOVWF EEDATA<BR> CALL L03D5<BR> INCF EEADR,F<BR> INCF FSR,F<BR> DECFSZ 04BH,F<BR> GOTO L01C2<BR> DECFSZ 04DH,F<BR> GOTO L01A8<BR> MOVLW 03H<BR> SUBWF EEADR,F<BR> CALL L03E0<BR> XORLW 082H<BR> BTFSS STATUS,Z<BR> GOTO L0233<BR> MOVLW 01H<BR> MOVWF EEADR<BR>L01D3 CALL L03E0<BR> INCF EEADR,F<BR> MOVWF 04BH<BR> XORLW 082H<BR> BTFSC STATUS,Z<BR> GOTO L022D<BR> MOVF 04BH,W<BR> XORLW 090H<BR> BTFSS STATUS,Z<BR> GOTO L0205<BR> CALL L03E0<BR> ANDLW 0FH<BR> MOVWF 04DH<BR> MOVLW 08H<BR> MOVWF 04BH<BR> MOVLW 03CH<BR> MOVWF FSR<BR> INCF EEADR,F<BR>L01E5 CALL L03E0<BR> MOVWF INDIR<BR> INCF FSR,F<BR> INCF EEADR,F<BR> DECFSZ 04BH,F<BR> GOTO L01E5<BR> MOVF EEADR,W<BR> MOVWF 04CH<BR> MOVF 04FH,W<BR> MOVWF 018H<BR> MOVF 04EH,W<BR> MOVWF 019H<BR> CALL L0268<BR> CALL L032D<BR> MOVF 04DH,W<BR> MOVWF 019H<BR> MOVF 04FH,W<BR> MOVWF 018H<BR> CALL L023A<P>;-------Teste ob 8 Byte key nicht 00 sind -----------------------<BR> CLRF 019H<BR> MOVLW 08H<BR> MOVWF 04BH<BR> MOVLW 03CH<BR> MOVWF FSR<BR>Test2 MOVF FSR,W<BR> IORWF 019H,F<BR> INCF FSR,F<BR> DECFSZ 04BH,F<BR> GOTO Test2<BR> MOVF 019H,W<BR> XORWF 00H,W<BR> BTFSC STATUS,Z<BR> GOTO ohne_ee<BR>;----------------------------------------------------------<P>;-------schreibe neuen 8 Byte key ins EEPROM---------------<BR> MOVLW 08H<BR> MOVWF 04BH<BR> MOVLW 03CH<BR> MOVWF FSR<BR>L01FC MOVF INDIR,W<BR> MOVWF EEDATA<BR> CALL Write_EE<BR> INCF FSR,F<BR> DECFSZ 04BH,F<BR> GOTO L01FC<BR>;----------------------------------------------------------<BR>ohne_ee MOVF 04CH,W<BR> MOVWF EEADR<BR> GOTO L01D3<BR> <P>L0205 MOVF 04BH,W<BR> XORLW 021H<BR> BTFSS STATUS,Z<BR> GOTO L0229<BR> MOVLW 02H<BR> MOVWF 04BH<BR> MOVLW 03CH<BR> MOVWF FSR<BR>L020D CALL L03E0<BR> MOVWF INDIR<BR> INCF FSR,F<BR> INCF EEADR,F<BR> DECFSZ 04BH,F<BR> GOTO L020D<BR> MOVF EEADR,W<BR> MOVWF 04CH<BR> MOVF 04DH,W<BR> MOVWF 019H<BR> MOVF 04FH,W<BR> MOVWF 018H<BR>;-------schreibe neues date ins EEPROM---------------------<BR> ;MOVLW 036H<BR> ;MOVWF EEADR<BR> ;CALL L0240<BR> ;MOVLW 02H<BR> ;MOVWF 04BH<BR> ;MOVLW 03CH<BR> ;MOVWF FSR<BR>L0220 ;MOVF INDIR,W<BR> ;MOVWF EEDATA<BR> ;CALL Write_EE<BR> ;INCF FSR,F<BR> ;DECFSZ 04BH,F<BR> ;GOTO L0220<BR>;----------------------------------------------------------<BR> MOVF 04CH,W<BR> MOVWF EEADR<BR> GOTO L01D3<BR> <BR>L0229 SWAPF 04BH,W<BR> ANDLW 0FH<BR> ADDWF EEADR,F<BR> GOTO L01D3<BR> <BR>L022D MOVLW 097H<BR> CALL L0012<BR> MOVLW 03CH<BR> CALL L0012<BR> GOTO L0096<BR> <BR>L0232 CALL L00E1<BR>L0233 MOVLW 090H<BR> CALL L0012<BR> MOVLW 01DH<BR> CALL L0012<BR> GOTO L0096<BR> <BR>send_eedata CALL send_EE_Data<BR> GOTO L0092<BR> <BR>L023A MOVF 019H,W<BR> ANDLW 03H<BR> MOVWF EEADR<BR> SWAPF EEADR,W<BR> ADDLW 040H<BR> MOVWF EEADR<BR>L0240 MOVF 018H,W<BR> ANDLW 06H<BR> IORLW 08H<BR> MOVWF 0CH<BR> BTFSC 018H,rb0<BR> BSF EEADR,rb7<BR> RETURN<BR> <BR>L0247 MOVLW 01CH<BR> MOVWF EEADR<BR> MOVLW 03CH<BR> GOTO L0256<BR> <BR>L024B MOVLW 024H<BR> MOVWF EEADR<BR> MOVLW 03CH<BR> GOTO L0256<BR> <BR>L024F MOVLW 03CH<BR> MOVWF EEADR<BR> MOVLW 01CH<BR> GOTO L0256<BR> <BR>L0253 MOVLW 03CH<BR> MOVWF EEADR<BR> MOVLW 024H<BR>L0256 MOVWF 012H<BR> MOVLW 08H<BR> MOVWF 010H<BR>L0259 CALL L025D<BR> DECFSZ 010H,F<BR> GOTO L0259<BR> <BR> RETURN<BR> <BR>L025D MOVF EEADR,W<BR> MOVWF FSR<BR> MOVF INDIR,W<BR> MOVWF EEDATA<BR> MOVF 012H,W<BR> MOVWF FSR<BR> MOVF EEDATA,W<BR> MOVWF INDIR<BR> INCF EEADR,F<BR> INCF 012H,F<BR> RETURN<BR> <BR>L0268 CALL L023A<BR> MOVLW 02CH<BR> MOVWF FSR<BR> CALL L0275<BR> CALL L023A<BR> BTFSS 018H,rb4<BR> GOTO L0271<BR> <BR> MOVLW 08H<BR> ADDWF EEADR,F<BR>L0271 MOVLW 034H<BR> MOVWF FSR<BR> CALL L0275<BR> RETURN<BR> <BR>L0275 MOVLW 08H<BR> MOVWF 010H<BR> MOVF 0CH,W<BR> MOVWF 049H<BR> MOVF EEADR,W<BR> MOVWF 04AH<BR>L027B MOVF 049H,W<BR> MOVWF 0CH<BR> MOVF 04AH,W<BR> MOVWF EEADR<BR> CALL BSTART<BR> BCF 0CH,rb0<BR> CALL CONTROL_BYTE<BR> MOVF EEADR,W<BR> CALL TX<BR> CALL BSTART<BR> BSF 0CH,rb0<BR> CALL CONTROL_BYTE<BR> CALL RX<BR> MOVF 0EH,W<BR> MOVWF INDIR<BR> INCF FSR,F<BR> CALL BSTOP<BR> INCF 04AH,F<BR> DECFSZ 010H,F<BR> GOTO L027B<BR> RETURN<BR> <P><BR>;######################################################<BR>; Sende Bytes vom EEPROM zum Reciver<BR>; 0CH = High Byte der EEPROM Adresse<BR>; 01AH= Länge des Strings<BR>; EEADR=Low byte der EEPROM Adresse <BR>;######################################################<BR>send_EE_Data MOVF 01AH,W<BR> MOVWF 010H<BR> MOVF 0CH,W<BR> MOVWF 049H<BR> MOVF EEADR,W<BR> MOVWF 04AH<BR>L0296 MOVF 049H,W<BR> MOVWF 0CH<BR> MOVF 04AH,W<BR> MOVWF EEADR<BR> CALL BSTART<BR> BCF 0CH,rb0<BR> CALL CONTROL_BYTE<BR> MOVF EEADR,W<BR> CALL TX<BR> CALL BSTART<BR> BSF 0CH,rb0<BR> CALL CONTROL_BYTE<BR> CALL RX<BR> MOVF 0EH,W<BR> CALL L0012<BR> MOVLW 05DH<BR> CALL Schleife_B<BR> CALL BSTOP<BR> INCF 04AH,F<BR> DECFSZ 010H,F<BR> GOTO L0296<BR> RETURN<BR> <BR>;######################################################<BR>; EEPROM Read ROUTINE 1<BR>;######################################################<BR>Read_EE1 CALL BSTART<BR> BCF 0CH,rb0<BR> CALL CONTROL_BYTE<BR> MOVF EEADR,W<BR> CALL TX<BR> CALL BSTART<BR> BSF 0CH,rb0<BR> CALL CONTROL_BYTE<BR> CALL RX<BR> CALL BSTOP<BR> CALL L02D6<BR> MOVF 0EH,W<BR> RETURN<BR> <BR>L02B8 MOVF EEADR,W<BR> MOVWF 018H<BR> MOVF 0CH,W<BR> MOVWF 017H<BR> CALL Read_EE1<BR> MOVF 018H,W<BR> MOVWF EEADR<BR> MOVF 017H,W<BR> MOVWF 0CH<BR> BCF STATUS,CY<BR> MOVF 0EH,W<BR> XORWF EEDATA,W<BR> BTFSC STATUS,Z<BR> GOTO L02D6<BR> <BR>;######################################################<BR>; EEPROM WRITE ROUTINE<BR>;######################################################<BR>Write_EE MOVF 0CH, W<BR> ANDLW 08H<BR> BTFSC STATUS,Z<BR> RETURN<BR> MOVF EEADR,W<BR> ANDLW 078H<BR> XORLW 040H<BR> BTFSC STATUS,Z<BR> GOTO goon<P> MOVF EEADR,W<BR> ANDLW 078H<BR> XORLW 050H<BR> BTFSC STATUS,Z<BR> GOTO goon<P> MOVF EEADR,W<BR> ANDLW 078H<BR> XORLW 060H<BR> BTFSS STATUS,Z<BR> RETURN<P><BR>goon CALL BSTART<BR> BCF 0CH,rb0<BR> CALL CONTROL_BYTE<BR> MOVF EEADR,W<BR> CALL TX<BR> MOVF EEDATA,W<BR> CALL TX<BR> CALL BSTOP<BR> CALL L02D6<BR> MOVLW 0CH<BR> MOVWF 019H<BR>L02D1 MOVLW 0FFH<BR> CALL Schleife_B<BR> DECFSZ 019H,F<BR> GOTO L02D1<BR> RETURN<BR> <BR>L02D6 BCF STATUS,CY<BR> MOVLW 01H<BR> ADDWF EEADR,F<BR> BTFSS STATUS,CY<BR> RETURN<BR> RRF 0CH,F<BR> INCF 0CH,F<BR> RLF 0CH,F<BR> RETURN<BR> <BR>;**********************************************<BR>; GENERATE CONTROL BYTE<BR>;**********************************************<BR>CONTROL_BYTE MOVF 0CH,W<BR> ANDLW 0FH<BR> IORLW 0A0H<BR>;**********************************************<BR>; TRANSMIT DATA SUBROUTINE<BR>;**********************************************<BR>TX MOVWF 0EH<BR> MOVLW 0CFH<BR> TRIS PORTB<BR> CALL TX4<BR> CALL TX4<BR> GOTO BITIN<BR> <BR>TX4 CALL TXLP<BR> CALL TXLP<BR> CALL TXLP<BR>TXLP RLF 0EH,F<BR> GOTO BITOUT_R<BR> <BR>;**********************************************<BR>; RECEIVE DATA SUBROUTINE<BR>;**********************************************<BR>RX MOVLW 0DFH<BR> TRIS PORTB<BR> CALL RX4<BR> CALL RX4<BR> BSF STATUS,CY<BR> GOTO BITOUT<BR> <BR>RX4 CALL RXLP<BR> CALL RXLP<BR> CALL RXLP<BR>RXLP CALL BITIN_R<BR> RLF 0EH,F<BR> RETURN<BR> <BR>;*********************************************<BR>; START BIT SUBROUTINE<BR>;*********************************************<BR>BSTART BSF PORTB,rb4<BR> MOVLW 0CFH<BR> TRIS PORTB<BR> BSF PORTB,rb5<BR> NOP<BR> BCF PORTB,rb4<BR> GOTO BC_END<BR> <BR>;**********************************************<BR>; STOP BIT SUBROUTINE<BR>;**********************************************<BR>BSTOP BCF PORTB,rb4<BR> MOVLW 0CFH<BR> TRIS PORTB<BR> NOP<BR> BSF PORTB,rb5<BR> NOP<BR> BSF PORTB,rb4<BR>B_END NOP<BR>BC_END BCF PORTB,rb5<BR> RETURN<BR> <BR>;**********************************************<BR>; BITOUT ROUTINE , SEND BIT WHEN CARRY SET<BR>;**********************************************<BR>BITOUT MOVLW 0CFH<BR> TRIS PORTB<BR>BITOUT_R BTFSS STATUS,CY<BR> BCF PORTB,rb4<BR> BTFSC STATUS,CY<BR> BSF PORTB,rb4<BR> BSF PORTB,rb5<BR> GOTO B_END<BR> <BR>;**********************************************<BR>; BITIN ROUTINE<BR>;**********************************************<BR>BITIN MOVLW 0DFH<BR> TRIS PORTB<BR>BITIN_R BSF PORTB,rb5<BR> NOP<BR> BSF STATUS,CY<BR> BTFSS PORTB,rb4<BR> BCF STATUS,CY<BR> GOTO BC_END<BR> <BR>L0320 MOVWF EEADR<BR> MOVLW 04H<BR> GOTO L0325<BR> <BR>L0323 MOVWF EEADR<BR> MOVLW 06H<BR>L0325 MOVWF 0CH<BR> CALL Read_EE1<BR> RETURN<BR> <BR>L0328 MOVF 015H,W<BR>L0329 ANDLW 0FH<BR> ADDLW 02CH<BR> MOVWF FSR<BR> RETURN<BR> <BR>L032D MOVLW 00H<BR> MOVWF 017H<BR>L032F MOVF 017H,W<BR> ANDLW 0FH<BR> MOVWF 015H<BR> MOVF 017H,W<BR> ANDLW 03CH<BR> MOVWF 014H<BR> BCF STATUS,CY<BR> RRF 014H,F<BR> RRF 014H,F<BR> CALL L03C0<BR> INCF 017H,F<BR> BTFSS 017H,rb6<BR> GOTO L032F<BR> MOVLW 0FH<BR> MOVWF 015H<BR> MOVWF 014H<BR>L033F MOVF 040H,W<BR> MOVWF 017H<BR> MOVF 041H,W<BR> MOVWF 018H<BR> MOVF 042H,W<BR> MOVWF 019H<BR> MOVF 043H,W<BR> MOVWF 01AH<BR> CALL L0328<BR> MOVF INDIR,W<BR> XORWF 01AH,W<BR> MOVWF 01AH<BR> CALL L03C0<BR> DECF 015H,F<BR> CALL L0328<BR> MOVF INDIR,W<BR> XORWF 019H,W<BR> MOVWF 019H<BR> CALL L03C0<BR> DECF 015H,F<BR> CALL L0328<BR> MOVF INDIR,W<BR> XORWF 018H,W<BR> MOVWF 018H<BR> CALL L03C0<BR> DECF 015H,F<BR> CALL L0328<BR> MOVF INDIR,W<BR> XORWF 017H,W<BR> MOVWF 017H<BR> CALL L03C0<BR> DECF 015H,F<BR> MOVF 015H,W<BR> ANDLW 0FH<BR> MOVWF 015H<BR> MOVF 017H,W<BR> CALL L0320<BR> MOVWF 017H<BR> MOVF 018H,W<BR> CALL L0320<BR> MOVWF 018H<BR> MOVF 019H,W<BR> CALL L0320<BR> MOVWF 019H<BR> MOVF 01AH,W<BR> CALL L0320<BR> MOVWF 01AH<BR> XORWF 017H,W<BR> MOVWF 017H<BR> SWAPF 01AH,W<BR> ADDWF 019H,W<BR> CALL L0323<BR> MOVWF 019H<BR> XORWF 01AH,W<BR> MOVWF 01AH<BR> SWAPF 019H,W<BR> ADDWF 018H,W<BR> CALL L0323<BR> MOVWF 018H<BR> XORWF 019H,W<BR> MOVWF 019H<BR> SWAPF 018H,W<BR> ADDWF 017H,W<BR> CALL L0323<BR> MOVWF 017H<BR> XORWF 018H,W<BR> MOVWF 018H<BR> SWAPF 017H,W<BR> ADDWF 01AH,W<BR> CALL L0320<BR> MOVWF 01AH<BR> XORWF 017H,W<BR> MOVWF 017H<BR> SWAPF 01AH,W<BR> ADDWF 019H,W<BR> CALL L0320<BR> MOVWF 019H<BR> XORWF 01AH,W<BR> MOVWF 01AH<BR> SWAPF 019H,W<BR> ADDWF 018H,W<BR> CALL L0320<BR> MOVWF 018H<BR> XORWF 019H,W<BR> MOVWF 019H<BR> MOVF 018H,W<BR> XORWF 017H,W<BR> MOVWF 018H<BR> MOVF 018H,W<BR> CALL L0323<BR> XORWF 03CH,F<BR> MOVF 01AH,W<BR> CALL L0323<BR> XORWF 03DH,F<BR> MOVF 017H,W<BR> CALL L0323<BR> XORWF 03EH,F<BR> MOVF 019H,W<BR> CALL L0323<BR> XORWF 03FH,F<BR> DECF 014H,F<BR> BTFSS 014H,rb7<BR> GOTO L03A7<BR> RETURN<BR> <BR>L03A7 MOVF 040H,W<BR> MOVWF 013H<BR> MOVF 03CH,W<BR> MOVWF 040H<BR> MOVF 013H,W<BR> MOVWF 03CH<BR> MOVF 041H,W<BR> MOVWF 013H<BR> MOVF 03DH,W<BR> MOVWF 041H<BR> MOVF 013H,W<BR> MOVWF 03DH<BR> MOVF 042H,W<BR> MOVWF 013H<BR> MOVF 03EH,W<BR> MOVWF 042H<BR> MOVF 013H,W<BR> MOVWF 03EH<BR> MOVF 043H,W<BR> MOVWF 013H<BR> MOVF 03FH,W<BR> MOVWF 043H<BR> MOVF 013H,W<BR> MOVWF 03FH<BR> GOTO L033F<BR> <BR>L03C0 MOVF 015H,W<BR> ADDLW 01H<BR> ANDLW 0FH<BR> MOVWF 01BH<BR> CALL L0329<BR> MOVF INDIR,W<BR> XORWF 014H,W<BR> MOVWF 013H<BR> MOVLW 02H<BR> SUBWF 01BH,W<BR> ANDLW 0FH<BR> CALL L0329<BR> MOVF INDIR,W<BR> XORWF 013H,W<BR> CALL L0320<BR> MOVWF 013H<BR> CALL L0328<BR> MOVF INDIR,W<BR> XORWF 013H,W<BR> MOVWF INDIR<BR> RETURN<BR> <BR>L03D5 BSF STATUS,RP0<BR> BSF EEDATA,rb2<BR> MOVLW 055H<BR> MOVWF EEADR<BR> MOVLW 0AAH<BR> MOVWF EEADR<BR> BSF EEDATA,rb1<BR>L03DC BTFSC EEDATA,rb1<BR> GOTO L03DC<BR> BCF STATUS,RP0<BR> RETURN<BR> <BR>L03E0 BSF STATUS,RP0<BR> BSF EEDATA,rb0<BR> BCF STATUS,RP0<BR> MOVF EEDATA,W<BR> RETURN<BR> <BR> ORG 2007H<BR> DATA 3FF9H<BR> <BR> END<BR>

Geplaatst:

Dank aan Alexje en SatTurk.<P>Groet, MacEllie<P>------------------<BR>

Geplaatst:

het progje icprog kan zowel hex als assembler view weergeven. smile.gifsmile.gif<BR>met de microchip software MPlab en MPasm kun je verder stoeien en compileren.<P> smile.gifsmile.gifsmile.gif suc7<P>------------------<BR>blubblub

Gast
Dit onderwerp is nu gesloten voor nieuwe reacties.
  • Wie is er online   0 leden

    • Er zijn geen geregistreerde gebruikers deze pagina aan het bekijken
×
×
  • Nieuwe aanmaken...