bcf INTCON,GIE and bsf INTCON,GIE are not nessesary as the PIC make it automatically.
bcf PIR1,TMR1IF - better to arrange just before retfie.
thanks for ur reply, i have write asm for 16f72 , when i convert it proton its need more space for code, so 16f873 is better. so forget it to go for 16f873. but i have learn proton is powerfull. when proton goes to dspic then it will more powerfull, like proteus.
thanks
Posted on: March 25, 2008, 03:14:02 15:14 - Automerged
how can i convert it to basic
math conversion. and convert %
CONVERT
CLRF TEMPA
MOVLW .8 ;0x08
MOVWF LOOP_COUNTER
SAMUN
RLF LOW_VALUE,W
RLF TEMPA,F
MOVF SHIFT,W
SUBWF TEMPA,F
BTFSC STATUS,C ;IF BIT C =1 THEN
GOTO RANA
ADDWF TEMPA,F
BCF STATUS,C
RANA
RLF LOW_VALUE,F
DECFSZ LOOP_COUNTER,F
GOTO SAMUN
;======================================
CLRF TEMPB
MOVLW .8 ;0x08
MOVWF LOOP_COUNTER
RUMAN
RLF HIGH_VALUE,W
RLF TEMPA,F
RLF TEMPB,F
MOVF SHIFT,W
SUBWF TEMPA,F
CLRF MOZIBOR
CLRW
BTFSS STATUS,C ;IF C = 0 THEN ;IF BIT C =0 THEN
INCFSZ MOZIBOR,W
SUBWF TEMPB,F
BTFSC STATUS,C ;IF BIT C =1 THEN
GOTO CONVERT_LOOP
MOVF SHIFT,W
ADDWF TEMPA,F
CLRF MOZIBOR
CLRW
BTFSC STATUS,C ;IF BIT C =1 THEN
INCFSZ MOZIBOR,W
ADDWF TEMPB,F
BCF STATUS,C
CONVERT_LOOP
RLF HIGH_VALUE,F
DECFSZ LOOP_COUNTER,F
GOTO RUMAN
MOVF TEMPA,W
RETURN
;==========================================================
MITHUN
CLRF TEMPC
MOVF LOW_VALUE,W
MOVWF TEMPD
MOVF HIGH_VALUE,W
MOVWF LCD_LOOP1
MOVLW 0x08
MOVWF LOOP_COUNTER
HANNAN
RRF SHIFT,F
BTFSC STATUS,C ;IF BIT C =1 THEN
GOTO SAKIB
DECFSZ LOOP_COUNTER,F
GOTO HANNAN
CLRF LOW_VALUE
CLRF HIGH_VALUE
RETLW 0x00
;==========================================================
SAKIB
BCF STATUS,C
GOTO TUSHAR
BARKAT
RRF SHIFT,F
BTFSS STATUS,C ;IF BIT C =0 THEN
GOTO TUSHAR
MOVF LCD_LOOP1,W
ADDWF HIGH_VALUE,F
MOVF TEMPD,W
BTFSC STATUS,C ;IF BIT C =1 THEN
INCFSZ TEMPD,W
ADDWF LOW_VALUE,F
TUSHAR
RRF LOW_VALUE,F
RRF HIGH_VALUE,F
RRF TEMPC,F
DECFSZ LOOP_COUNTER,F
GOTO BARKAT
RETLW 0x00
;=======================================================
INIT_VALUE
MOVF MAIN_VALUE,W
ADDWF MAINS_H,F
BTFSC STATUS,C ;IF BIT[STATUS:C]= 1 THEN
INCF MAINS_L,F
MOVF CHARG_LOAD_VER,W
ADDWF CHARGE_LOAD_H,F
BTFSC STATUS,C ;IF BIT[STATUS:C]= 1 THEN
INCF CH_LOD_L,F
INCF RAM_1,F ;0x7C,F
MOVLW 0xF0 ;.240
SUBWF RAM_1,W ; RAM_1 - W = ?
BTFSS STATUS,C ;IF BIT C =0 THEN
RETURN
MOVF MAINS_H,W
MOVWF MAINS_H_VALUE
MOVF MAINS_L,W
MOVWF MAINS_L_VALUE
MOVF CHARGE_LOAD_H,W
MOVWF CHARGE_LOAD_VALUE_H
MOVF CH_LOD_L,W
MOVWF CHARGE_LOAD_VALUE
CLRF RAM_1 ;0x7C
CLRF MAINS_H
CLRF MAINS_L
CLRF CHARGE_LOAD_H
CLRF CH_LOD_L
RETURN
;==========================================================
CONVERT_CHAR_LOAD_PER
MOVLW .240 ;0xF0 ;
MOVWF SHIFT
MOVF CHARGE_LOAD_VALUE_H,W
MOVWF HIGH_VALUE
MOVF CHARGE_LOAD_VALUE,W
MOVWF LOW_VALUE
CALL CONVERT
MOVLW .100 ;0x64
MOVWF SHIFT
CALL MITHUN
MOVLW .150 ;0x96
BTFSC INV_ON ;IF UPS = 1 THEN
MOVLW .22 ;0x16
MOVWF SHIFT
MOVF HIGH_VALUE,W
MOVWF LOW_VALUE
MOVF TEMPC,W
MOVWF HIGH_VALUE
GOTO CONVERT