salut pour tous
je suis entrain de programmer un pic 16F877 j'ai crée le programme en mikropascal puis j'ai crée le code assembleur le voilà
Code:; Assembly code generated by mikroVirtualMachine - V. 5.0.0.3 ; Date/Time: 19/11/2011 14:11:12 ; Info: http://www.mikroe.com ; ADDRESS OPCODE ASM ; ---------------------------------------------- $0000 $2804 GOTO _main $00B6 $ _usart_data_ready: ;USART_c67.ppas,48 :: ;USART_c67.ppas,50 :: $00B6 $3020 MOVLW 32 $00B7 $1303 BCF STATUS, RP1 $00B8 $1283 BCF STATUS, RP0 $00B9 $050C ANDWF PIR1, 0 $00BA $00F1 MOVWF STACK_1 $00BB $0871 MOVF STACK_1, 0 $00BC $3A00 XORLW 0 $00BD $30FF MOVLW 255 $00BE $1903 BTFSC STATUS, Z $00BF $3000 MOVLW 0 $00C0 $00F0 MOVWF STACK_0 $00C1 $3001 MOVLW 1 $00C2 $0570 ANDWF STACK_0, 0 $00C3 $00A1 MOVWF _usart_data_ready_local_result $00C4 $ USART_c67_L_18: ;USART_c67.ppas,51 :: $00C4 $0821 MOVF _usart_data_ready_local_result, 0 $00C5 $00F0 MOVWF STACK_0 $00C6 $0008 RETURN $0085 $ _usart_read: ;USART_c67.ppas,54 :: ;USART_c67.ppas,55 :: $0085 $1303 BCF STATUS, RP1 $0086 $1283 BCF STATUS, RP0 $0087 $081A MOVF RCREG, 0 $0088 $00A1 MOVWF _usart_read_local_result ;USART_c67.ppas,61 :: $0089 $3002 MOVLW 2 $008A $0518 ANDWF RCSTA, 0 $008B $00F1 MOVWF STACK_1 $008C $0871 MOVF STACK_1, 0 $008D $3A00 XORLW 0 $008E $30FF MOVLW 255 $008F $1903 BTFSC STATUS, Z $0090 $3000 MOVLW 0 $0091 $00F0 MOVWF STACK_0 $0092 $3001 MOVLW 1 $0093 $0570 ANDWF STACK_0, 0 $0094 $00F1 MOVWF STACK_1 $0095 $0871 MOVF STACK_1, 0 $0096 $3A01 XORLW 1 $0097 $1D03 BTFSS STATUS, Z $0098 $289B GOTO USART_c67_L_21 $0099 $ USART_c67_L_20: ;USART_c67.ppas,63 :: $0099 $1218 BCF RCSTA, 4 $009A $ USART_c67_L_24: ;USART_c67.ppas,64 :: $009A $ USART_c67_L_25: $009A $1618 BSF RCSTA, 4 $009B $ USART_c67_L_26: ;USART_c67.ppas,65 :: $009B $ USART_c67_L_21: $009B $ USART_c67_L_22: $009B $ USART_c67_L_19: ;USART_c67.ppas,66 :: $009B $0821 MOVF _usart_read_local_result, 0 $009C $00F0 MOVWF STACK_0 $009D $0008 RETURN $009E $ _usart_write: ;USART_c67.ppas,40 :: ;USART_c67.ppas,42 :: $009E $ USART_c67_L_14: $009E $3002 MOVLW 2 $009F $1303 BCF STATUS, RP1 $00A0 $1683 BSF STATUS, RP0 $00A1 $0518 ANDWF TXSTA, 0 $00A2 $00F1 MOVWF STACK_1 $00A3 $0871 MOVF STACK_1, 0 $00A4 $3A00 XORLW 0 $00A5 $30FF MOVLW 255 $00A6 $1903 BTFSC STATUS, Z $00A7 $3000 MOVLW 0 $00A8 $00F0 MOVWF STACK_0 $00A9 $3001 MOVLW 1 $00AA $0570 ANDWF STACK_0, 0 $00AB $00F1 MOVWF STACK_1 $00AC $0871 MOVF STACK_1, 0 $00AD $3A00 XORLW 0 $00AE $1D03 BTFSS STATUS, Z $00AF $28B2 GOTO USART_c67_L_15 ;USART_c67.ppas,43 :: $00B0 $0000 NOP $00B1 $289E GOTO USART_c67_L_14 $00B2 $ USART_c67_L_15: ;USART_c67.ppas,44 :: $00B2 $1283 BCF STATUS, RP0 $00B3 $0821 MOVF FARG_USART_Write, 0 $00B4 $0099 MOVWF TXREG $00B5 $ USART_c67_L_12: ;USART_c67.ppas,45 :: $00B5 $0008 RETURN $006A $ _usart_init: ;USART_c67.ppas,22 :: ;USART_c67.ppas,24 :: $006A $ USART_c67_L_1: $006A $1303 BCF STATUS, RP1 $006B $1683 BSF STATUS, RP0 $006C $1698 BSF TXSTA, 5 $006D $ USART_c67_L_2: ;USART_c67.ppas,25 :: $006D $3090 MOVLW 144 $006E $1283 BCF STATUS, RP0 $006F $0098 MOVWF RCSTA ;USART_c67.ppas,31 :: $0070 $ USART_c67_L_3: $0070 $1683 BSF STATUS, RP0 $0071 $1787 BSF TRISC, 7 $0072 $ USART_c67_L_4: ;USART_c67.ppas,32 :: $0072 $1307 BCF TRISC, 6 $0073 $ USART_c67_L_6: ;USART_c67.ppas,35 :: $0073 $ USART_c67_L_8: $0073 $3020 MOVLW 32 $0074 $1283 BCF STATUS, RP0 $0075 $050C ANDWF PIR1, 0 $0076 $00F1 MOVWF STACK_1 $0077 $0871 MOVF STACK_1, 0 $0078 $3A00 XORLW 0 $0079 $30FF MOVLW 255 $007A $1903 BTFSC STATUS, Z $007B $3000 MOVLW 0 $007C $00F0 MOVWF STACK_0 $007D $3001 MOVLW 1 $007E $0570 ANDWF STACK_0, 0 $007F $00F1 MOVWF STACK_1 $0080 $0871 MOVF STACK_1, 0 $0081 $3A01 XORLW 1 $0082 $1903 BTFSC STATUS, Z $0083 $2873 GOTO USART_c67_L_8 ;USART_c67.ppas,36 :: $0084 $ USART_c67_L_9: $0084 $ USART_c67_L_0: ;USART_c67.ppas,37 :: $0084 $0008 RETURN $0004 $ _main: ;khalil.ppas,5 :: begin ;khalil.ppas,6 :: trisa := 0; $0004 $1303 BCF STATUS, RP1 $0005 $1683 BSF STATUS, RP0 $0006 $0185 CLRF TRISA, 1 ;khalil.ppas,7 :: trisb := 0; $0007 $0186 CLRF TRISB, 1 ;khalil.ppas,8 :: trisd := 0; $0008 $0188 CLRF TRISD, 1 ;khalil.ppas,9 :: trise := 0; $0009 $0189 CLRF TRISE, 1 ;khalil.ppas,10 :: porta := 0; $000A $1283 BCF STATUS, RP0 $000B $0185 CLRF PORTA, 1 ;khalil.ppas,11 :: ADCON1 := 7; $000C $3007 MOVLW 7 $000D $1683 BSF STATUS, RP0 $000E $009F MOVWF ADCON1 ;khalil.ppas,12 :: portb := 0; $000F $1283 BCF STATUS, RP0 $0010 $0186 CLRF PORTB, 1 ;khalil.ppas,13 :: portd := 0; $0011 $0188 CLRF PORTD, 1 ;khalil.ppas,14 :: porte := 0; $0012 $0189 CLRF PORTE, 1 ;khalil.ppas,16 :: USART_Init(9600); // Initialize UART module at 9600 bps $0013 $3081 MOVLW 129 $0014 $1683 BSF STATUS, RP0 $0015 $0099 MOVWF SPBRG $0016 $1518 BSF TXSTA, BRGH $0017 $206A CALL _usart_init ;khalil.ppas,17 :: Delay_ms(100); // Wait for UART module to stabilize $0018 $3003 MOVLW 3 $0019 $00FC MOVWF STACK_12 $001A $30FF MOVLW 255 $001B $00FB MOVWF STACK_11 $001C $30FF MOVLW 255 $001D $00FA MOVWF STACK_10 $001E $0BFC DECFSZ STACK_12, F $001F $2821 GOTO $+2 $0020 $2828 GOTO $+8 $0021 $0BFB DECFSZ STACK_11, F $0022 $2824 GOTO $+2 $0023 $2827 GOTO $+4 $0024 $0BFA DECFSZ STACK_10, F $0025 $2824 GOTO $-1 $0026 $2821 GOTO $-5 $0027 $281E GOTO $-9 $0028 $308C MOVLW 140 $0029 $00FB MOVWF STACK_11 $002A $30FF MOVLW 255 $002B $00FA MOVWF STACK_10 $002C $0BFB DECFSZ STACK_11, F $002D $282F GOTO $+2 $002E $2832 GOTO $+4 $002F $0BFA DECFSZ STACK_10, F $0030 $282F GOTO $-1 $0031 $282C GOTO $-5 $0032 $30A1 MOVLW 161 $0033 $00FA MOVWF STACK_10 $0034 $0BFA DECFSZ STACK_10, F $0035 $2834 GOTO $-1 $0036 $0000 NOP ;khalil.ppas,20 :: while (TRUE) do // Endless loop $0037 $ khalil_L_2: ;khalil.ppas,22 :: if (USART_Data_Ready() <> 0) then // If data is received, $0037 $20B6 CALL _usart_data_ready $0038 $0870 MOVF STACK_0, 0 $0039 $3A00 XORLW 0 $003A $1903 BTFSC STATUS, Z $003B $2868 GOTO khalil_L_7 $003C $ khalil_L_6: ;khalil.ppas,24 :: receive := USART_Read(); // read the received data, $003C $2085 CALL _usart_read $003D $0870 MOVF STACK_0, 0 $003E $00A0 MOVWF _receive ;khalil.ppas,25 :: USART_Write('T'); // and send data via UART $003F $3054 MOVLW 84 $0040 $00A1 MOVWF FARG_USART_Write $0041 $209E CALL _usart_write ;khalil.ppas,26 :: if receive = 71 then begin portb := 0xFF; delay_ms (temp_sirene); portb := 0; end; $0042 $0820 MOVF _receive, 0 $0043 $3A47 XORLW 71 $0044 $1D03 BTFSS STATUS, Z $0045 $2868 GOTO khalil_L_10 $0046 $ khalil_L_9: $0046 $30FF MOVLW 255 $0047 $0086 MOVWF PORTB $0048 $30FF MOVLW 255 $0049 $00FC MOVWF STACK_12 $004A $30FF MOVLW 255 $004B $00FB MOVWF STACK_11 $004C $30FF MOVLW 255 $004D $00FA MOVWF STACK_10 $004E $0BFC DECFSZ STACK_12, F $004F $2851 GOTO $+2 $0050 $2858 GOTO $+8 $0051 $0BFB DECFSZ STACK_11, F $0052 $2854 GOTO $+2 $0053 $2857 GOTO $+4 $0054 $0BFA DECFSZ STACK_10, F $0055 $2854 GOTO $-1 $0056 $2851 GOTO $-5 $0057 $284E GOTO $-9 $0058 $30F8 MOVLW 248 $0059 $00FB MOVWF STACK_11 $005A $30FF MOVLW 255 $005B $00FA MOVWF STACK_10 $005C $0BFB DECFSZ STACK_11, F $005D $285F GOTO $+2 $005E $2862 GOTO $+4 $005F $0BFA DECFSZ STACK_10, F $0060 $285F GOTO $-1 $0061 $285C GOTO $-5 $0062 $3089 MOVLW 137 $0063 $00FA MOVWF STACK_10 $0064 $0BFA DECFSZ STACK_10, F $0065 $2864 GOTO $-1 $0066 $0000 NOP $0067 $0186 CLRF PORTB, 1 $0068 $ khalil_L_10: $0068 $ khalil_L_11: ;khalil.ppas,27 :: end; $0068 $ khalil_L_7: $0068 $ khalil_L_8: ;khalil.ppas,28 :: end; $0068 $2837 GOTO khalil_L_2 ;khalil.ppas,33 :: end. $0069 $2869 GOTO $
-----