; This file was generated by C2C-plus compiler version 3.27.8e include "p16F877.inc" ;Variables ***************************************** _intr_tmp_0000 equ 0x70 __int_save_cont_W equ 0x71 __int_save_cont_STATUS equ 0x72 __int_save_cont_FSR equ 0x73 __int_save_cont_PCLATH equ 0x74 _Opt equ 0x75 _zero_bits equ 0x76 _BufferIndex equ 0x77 _chcount equ 0x78 _cnt equ 0x79 param00_SendChar equ 0x7a param00_buf_char equ 0x7b _BufIndex_main equ 0x7c _i_interrupt equ 0x7d _flag_interrupt equ 0x7e _RxFifo equ 0x20 _SSPSTAT equ 0x94 _SSPCON equ 0x14 _SSPCON2 equ 0x91 _SSPBUF equ 0x13 _SSPADD equ 0x93 _PORTC equ 0x07 _PORTD equ 0x08 _PORTE equ 0x09 _TXREG equ 0x19 _RCREG equ 0x1a _TXSTA equ 0x98 _RCSTA equ 0x18 _SPBRG equ 0x99 _TRISC equ 0x87 _TRISD equ 0x88 _TRISE equ 0x89 _PIE1 equ 0x8c _PIE2 equ 0x8d _PIR1 equ 0x0c _PIR2 equ 0x0d _PCON equ 0x8e _ADCON0 equ 0x1f _ADCON1 equ 0x9f ORG 0 clrf PCLATH goto start__code ORG 4 _interrupt _interrupt__code movwf __int_save_cont_W swapf __int_save_cont_W, F swapf STATUS, W movwf __int_save_cont_STATUS swapf FSR, W movwf __int_save_cont_FSR swapf PCLATH, W movwf __int_save_cont_PCLATH clrf PCLATH bcf STATUS, RP0 bcf STATUS, RP1 movf _PIR1, W andlw D'32' andlw 0xFF sublw 0 btfsc STATUS, Z goto label_0006 call _RxChars bcf PCLATH, 3 bcf PCLATH, 4 bcf INTCON, D'2' bcf STATUS, RP0 bcf STATUS, RP1 bcf _PIR1, D'5' label_0006 movf INTCON, W andlw D'2' andlw 0xFF sublw 0 btfsc STATUS, Z goto label_0007 L2; nop ; bcf INTCON, D'1' movlw D'128' subwf _Opt, W btfss STATUS, Z goto label_0008 movlw D'192' bsf STATUS, RP0 bcf STATUS, RP1 movwf OPTION_REG movlw D'192' movwf _Opt goto label_0009 label_0008 movlw D'128' bsf STATUS, RP0 bcf STATUS, RP1 movwf OPTION_REG movlw D'128' movwf _Opt label_0009 movlw D'59' bcf STATUS, RP0 bcf STATUS, RP1 movwf TMR0 bcf INTCON, D'2' bsf INTCON, D'5' goto label_0010 label_0007 movf INTCON, W andlw D'4' andlw 0xFF sublw 0 btfsc STATUS, Z goto label_0011 bcf INTCON, D'2' bcf INTCON, D'5' ; // i = input_pin_port_D( Rx ); // Sample the pin clrw ; // ;//bcf STATUS, RP0 ; ;//bcf STATUS, RP1 ; bcf STATUS, RP0 bcf STATUS, RP1 btfsc PORTD, D'0' ; movlw D'1' ; movwf _i_interrupt ; movlw D'7' subwf _zero_bits, W btfss STATUS, C incf _cnt, F label_0012 movlw D'1' subwf _i_interrupt, W btfsc STATUS, Z goto label_0013 label_0014 clrf _zero_bits movlw D'49' movwf param00_buf_char call _buf_char bcf PCLATH, 3 bcf PCLATH, 4 goto label_0015 label_0013 movlw D'6' subwf _zero_bits, W btfsc STATUS, C goto label_0016 incf _zero_bits, F movlw D'48' movwf param00_buf_char call _buf_char bcf PCLATH, 3 bcf PCLATH, 4 goto label_0017 label_0016 movlw D'6' subwf _zero_bits, W btfss STATUS, Z goto label_0018 movf _cnt, W andlw D'1' movwf _flag_interrupt movf _flag_interrupt, F btfss STATUS, Z goto label_0019 incf _zero_bits, F movlw D'13' movwf param00_buf_char call _buf_char bcf PCLATH, 3 bcf PCLATH, 4 movlw D'10' movwf param00_buf_char call _buf_char bcf PCLATH, 3 bcf PCLATH, 4 clrf _cnt goto label_0020 label_0019 movlw D'48' movwf param00_buf_char call _buf_char bcf PCLATH, 3 bcf PCLATH, 4 label_0020 label_0018 label_0017 label_0015 bcf INTCON, D'2' label_0011 label_0010 swapf __int_save_cont_PCLATH, W movwf PCLATH swapf __int_save_cont_FSR, W movwf FSR swapf __int_save_cont_STATUS, W movwf STATUS swapf __int_save_cont_W, W retfie _interrupt__end _Setup goto _Setup__code _ConfigureComms goto _ConfigureComms__code _SendChar goto _SendChar__code _RxChars goto _RxChars__code _buf_char goto _buf_char__code start__code _main__code clrf _chcount clrf _BufferIndex movlw D'7' movwf _zero_bits clrf _cnt call _Setup bcf PCLATH, 3 bcf PCLATH, 4 clrf _BufIndex_main movlw D'42' movwf param00_SendChar call _SendChar bcf PCLATH, 3 bcf PCLATH, 4 movlw D'13' movwf param00_SendChar call _SendChar bcf PCLATH, 3 bcf PCLATH, 4 movlw D'10' movwf param00_SendChar call _SendChar bcf PCLATH, 3 bcf PCLATH, 4 label_0000 label_0002 movf _chcount, W btfsc STATUS, Z goto label_0000 movf _BufIndex_main, W incf _BufIndex_main, F addlw _RxFifo movwf FSR bcf STATUS, IRP movf INDF, W movwf param00_SendChar call _SendChar bcf PCLATH, 3 bcf PCLATH, 4 movlw D'20' subwf _BufIndex_main, W movlw 1 btfsc STATUS, C clrw andlw 0xFF movlw 1 btfss STATUS, Z movlw 0 sublw 0 btfss STATUS, Z clrf _BufIndex_main label_0004 movf _chcount, W btfss STATUS, Z decf _chcount, F label_0005 goto label_0002 label_0003 goto label_0000 label_0001 _main__end _Setup__code clrf INTCON movlw D'128' movwf _Opt movlw D'128' bsf STATUS, RP0 bcf STATUS, RP1 movwf OPTION_REG bcf STATUS, RP0 clrf _ADCON0 movlw D'6' bsf STATUS, RP0 movwf _ADCON1 movlw D'1' movwf TRISA bcf STATUS, RP0 clrf PORTA ; movlw D'241' bsf STATUS, RP0 movwf TRISB bcf STATUS, RP0 clrf PORTB ; movlw D'153' bsf STATUS, RP0 movwf _TRISC bcf STATUS, RP0 clrf PORTC ; movlw D'1' bsf STATUS, RP0 movwf _TRISD bcf STATUS, RP0 clrf PORTD ; movlw D'1' bsf STATUS, RP0 movwf _TRISE bcf STATUS, RP0 clrf PORTE ; clrf _PIR1 call _ConfigureComms bcf PCLATH, 3 bcf PCLATH, 4 movlw D'208' movwf INTCON return _Setup__end _ConfigureComms__code bcf STATUS, RP0 bcf STATUS, RP1 bsf _RCSTA, D'7' bcf _RCSTA, D'6' bsf STATUS, RP0 bcf _TXSTA, D'6' movlw D'25' movwf _SPBRG bsf _TXSTA, D'2' bcf _TXSTA, D'4' bsf _TXSTA, D'5' bsf _PIE1, RCIE bcf STATUS, RP0 bsf _RCSTA, D'4' bcf _PIR1, D'5' bsf INTCON, PEIE bsf INTCON, GIE return _ConfigureComms__end _SendChar__code label_0021 bsf STATUS, RP0 bcf STATUS, RP1 movf _TXSTA, W andlw D'2' sublw D'0' btfss STATUS, Z goto label_0022 goto label_0021 label_0022 movf param00_SendChar, W bcf STATUS, RP0 bcf STATUS, RP1 movwf _TXREG return _SendChar__end _RxChars__code bcf STATUS, RP0 bcf STATUS, RP1 movf _RCSTA, W andlw D'6' sublw D'0' btfss STATUS, Z goto label_0023 movf _RCREG, W movwf param00_buf_char call _buf_char bcf PCLATH, 3 bcf PCLATH, 4 bcf STATUS, RP0 bcf STATUS, RP1 bsf _RCSTA, D'4' goto label_0024 label_0023 bcf STATUS, RP0 bcf STATUS, RP1 bcf _RCSTA, D'4' bsf _RCSTA, D'4' label_0024 bcf STATUS, RP0 bcf STATUS, RP1 movf _RCREG, W return _RxChars__end _buf_char__code movlw D'20' subwf _BufferIndex, W movlw 1 btfsc STATUS, C clrw andlw 0xFF movlw 1 btfss STATUS, Z movlw 0 sublw 0 btfss STATUS, Z clrf _BufferIndex label_0025 movf param00_buf_char, W movwf _intr_tmp_0000 movf _BufferIndex, W incf _BufferIndex, F addlw _RxFifo movwf FSR movf _intr_tmp_0000 , W bcf STATUS, IRP movwf INDF movf _chcount, W sublw D'20' movlw 1 btfss STATUS, Z clrw andlw 0xFF movlw 1 btfss STATUS, Z movlw 0 sublw 0 btfss STATUS, Z incf _chcount, F label_0026 return _buf_char__end END