• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Who Can Program This ??

Status
Not open for further replies.

khatib

Member
Hi All ;

I Want To Program This Circuit And I Want To Use Pic16f877 Not Pic 16f84 So ...

See The Schematic ...



And Reply Me Please

Thanks
 

Attachments

khatib

Member
battary monitor .. how to do that , and if you see the schematic you see that only analog is battary
 

khatib

Member
#;----------------------------------------------------
; UPS.ASM
; Program for Blaster Control Board (INTROMARIN-C).
;----------------------------------------------------

LIST p=16F84 ; PIC16F84 is the target processor

#include p16f84.inc

;#define PROC16C71

; variables definition

; ًهمèًٌٍû
T EQU 10H ; ٌ÷هٍ÷èê ïهًèîنà ىàêٌ=200
LEN EQU 11H ; نëèٍ. àêٍèâي. ٌîٌٍîےيèے ىàêٌ=100
PP EQU 12H ; ٌ÷هٍ÷èê ïîëَïهًèîنà
BAT EQU 13H ; ïًèçيàê ًàلîٍû îٍ لàٍàًهé
FRONT EQU 14H ; ïًèçيàê ïهًهنيهمî ôًîيٍà ٌèيًُîيèçàِèè
SIN_OK EQU 15H ; ïًèçيàê ٌèيًُîيèçàِèè
SHORT EQU 16H ; êًàٍêîâًهىهييûé لَôهً
FLAG_F EQU 17H ; ôëàم ôًîيٍà ٌèيًُîيèçàِèè
PWcnt EQU 18H ; ٌ÷هٍ÷èê نëèٍ. ٌهٍهâîمî ïèٍàيèے
SINcnt EQU 19H ; ٌ÷هٍ÷èê ïهًèîنà ٌهٍهâîمî ïèٍàيèے
t EQU 20H ; âيًٍَهييèé ٌ÷هٍ÷èê ïهًèîنà
BATime EQU 21H ;
time EQU 22H ; ٌ÷هٍ÷èê 20ىٌ ىàêٌ=5.12ٌهê
zumm EQU 23H ; ïًèçيàê âêë‏÷هيèے çَىىهًà

; êîيٌٍàيٍû
period EQU .165 ; ïهًèîن
len EQU .80

; لèٍû ïîًٍà A
OS EQU 2 ; âُîن خر ïًهîلًàçîâàٍهëے
LOWBAT EQU 3 ; âُîن LOW BATTERY
; EQU 4 ; âُîن


; لèٍû ïîًٍà B
SINH EQU 0 ; âُîن ٌèيًُîيèçàِèè
PWGOOD EQU 1 ; âُîن POWER_GOOD
; EQU 2 ; âûُîن
RELAY EQU 3 ; âûُîن َïًàâëهيèه ًهëه
BASE0 EQU 4 ; âûُîن لàçà ًٍàيçèٌٍîًà
BASE1 EQU 5 ; âûُîن لàçà ًٍàيçèٌٍîًà
; EQU 6 ; âûُîن
ZUMM EQU 7 ; âûُîن çَىىهً



GOTO Start
;------------------------------------------;
; MAIN ;
;------------------------------------------;
ORG 200

; حà÷àëüيûه ٌٍَàيîâêè
Start: ; حà÷àëüيûه ٌٍَàيîâêè

; Initialize PORTA by
BCF STATUS, RP0
CLRF PORTA
BSF STATUS, RP0
MOVLW 0x1f ; Set RA0-RA4 as inputs
MOVWF TRISA
#ifdef PROC16C71
MOVLW 0x00 ; Set RA0-RA4 as analog
MOVWF ADCON1
#endif

; Initialize PORTB by
BCF STATUS, RP0
CLRF PORTB
BSF STATUS, RP0
MOVLW 0x03 ; Set RB0,Rb1 as inputs, all other as output
MOVWF TRISB

; TIMER INTERRUPT ENABLE
BSF STATUS, RP0
MOVLW 0xA0
MOVWF INTCON

; SET_TIMER
BSF STATUS, RP0 ; çàïًîمًàىىèًîâàٍü ٍàéىهً
; NEW !!!! WDT
movlw 0x58
movwf OPTION_REG ; èٌٍî÷يèê âيًٍَهييèé,
; ïîنêë‏÷èٍü نهëèٍهëü ê WDT,
; êî‎ôôèِèهيٍ نهëèٍهëے 1
; NEW !!! WDT
BCF STATUS, RP0
BCF INTCON, T0IF ; ٌلًîٌèٍü ôëàم
;MOVF period ;
MOVLW period
MOVWF TMR0

; PRESET REGISTERS
BCF STATUS, RP0
MOVLW .199
MOVWF T
MOVLW .80
MOVWF LEN
BSF BAT, 0
CLRF FRONT
CLRF BATime
CLRF time
CLRF zumm


; رàىîٍهٌٍèًîâàيèه
;BCF PORTB, 3
;CALL ZUMM
;CALL ZUMM
;CALL ZUMM
;BSF PORTB, 3

; خئبؤہحبإ دذإذغآہحبك
GOTO $



;------------------------------------------;
; خلًàلîٍêà ïًهًûâàيèé ;
;------------------------------------------;
ORG 4
;__interrupt{
;------------------------------__SET_TIMER ------------------
BCF STATUS, RP0
btfss TMR0, 0 ; êîًًهêِèے
goto $+1
BCF INTCON, T0IF ; ٌلًîٌèٍü ôëàم
MOVLW period ; êàê êîيٌٍàيٍَ
MOVWF TMR0
;-------------------------------------------------------------
INCF T, 1 ; حہذہظبآہحبإ ر×إز×بتہ دإذبخؤہ
MOVF T, 0
SUBLW .199
BTFSS STATUS, C
CLRF T ; رءذخر ر×إز×بتہ دإذبخؤہ
;-------------------------------------------------------------
INCF t, 1
MOVF T, 1 ; رءذخر آحسزذإححإأخ ر×. دإذبخؤہ
BTFSC STATUS, Z
CLRF t
;-------------------------------------------------------------
clrwdt ; !!!! NEW WDT !!!!
;-------------------------------------------------------------
;__if(t==0)||(t==99) { PP++
MOVF t, 0
SUBLW .0
BTFSS STATUS, Z
GOTO INT1
CLRF PP ; رءذخر دذباحہتہ دخثسدإذبخؤہ
MOVLW len ; دإذإسرزہحخآتہ LEN
MOVWF LEN
GOTO INT2
INT1: MOVF t, 0
SUBLW .99
BTFSS STATUS, Z
GOTO INT2
BSF PP, 0 ; سرزہحخآتہ دذباحہتہ دخثسدإذبخؤہ
MOVLW len ; دإذإسرزہحخآتہ LEN
MOVWF LEN
INT2: MOVF LEN, 1 ; ؤإتذإجإحز LEN
BTFSS STATUS, Z
DECF LEN, 1
;__}

;******************* دذبحكزبإ ذإطإحبة ************************
;-------------------------- دإذإصخؤ حہ ءہزہذإب ---------------
BTFSC PORTB, PWGOOD
GOTO POWER
BSF BAT, 0
CLRF PWcnt
CLRF SIN_OK
POWER:
;-------------------------- دإذإصخؤ حہ رإزـ ------------------
BTFSS PORTB, PWGOOD
GOTO DESIGN
BTFSS PWcnt, 7
GOTO DESIGN
BTFSS SIN_OK, 0
GOTO DESIGN
CLRF BAT
DESIGN:
;*************************************************************

;-------------------------- آتثق×بزـ ذإثإ --------------------
BTFSC BAT, 0
BCF PORTB, RELAY
BTFSS BAT, 0
BSF PORTB, RELAY
;-------------------------- سدذہآثإحبإ زذہحابرزخذہجب -------
;__if(BAT==1){
BTFSS BAT, 0
GOTO INT4
;__if(LEN!=0){
MOVF LEN, 1
BTFSC STATUS, Z
GOTO INT4
;__if(PP==0){
BTFSC PP, 0
GOTO INT3
BSF PORTB, BASE0
BCF PORTB, BASE1
GOTO INT5
INT3: BCF PORTB, BASE0
BSF PORTB, BASE1
GOTO INT5
;__}
;__}
;__else{}
INT4: BCF PORTB, BASE0
BCF PORTB, BASE1
INT5:
;__}
;------------------------- ربأحہث دذب دذخدہؤہحبب رإزب --------
MOVF t, 0
BTFSS STATUS, Z
GOTO Z1
INCF time, 1
INCF BATime, 1
BTFSC BAT, 0
GOTO Z2
CLRF BATime
BCF zumm, 0
GOTO Z1
Z2: MOVF BATime, 0 ; if(BATime>64) BATime=64
SUBLW .255
BTFSS STATUS, Z
GOTO $+5
MOVLW .254
MOVWF BATime
BCF zumm, 0
GOTO $+2
BSF zumm, 0 ; آتثق×بزـ اسججإذ
Z1:
;------------------------- اسججإذ ----------------------------
BTFSS zumm, 0
GOTO NOZUMM
BTFSS time, 5
GOTO NOZUMM
BTFSC t, 1
BSF PORTB, 7
BTFSS t, 1
NOZUMM: BCF PORTB, 7

;------------- دذخآإذتہ حہثب×بك رإزإآخأخ حہدذكئإحبك ----------
; if(T==0){
MOVF T, 0
BTFSS STATUS, Z
GOTO NO_PW
; if(!PWGOOD) {
BTFSS PORTB, PWGOOD
CLRF PWcnt ;}
INCF PWcnt, 1
; if(PWcnt>128) PWcnt=128 {
MOVF PWcnt, 0
SUBLW .128
BTFSC STATUS, C
GOTO $+3
MOVLW .128
MOVWF PWcnt ;}
; }
NO_PW:

;-------------------------- ربحصذخحباہضبك دخ شہاإ ----------
; if(رإزإآخإ حہدذكئإحبإ){
BTFSS PWcnt, 7
GOTO NO_SIN
; }
INCF SINcnt, 1
;_if(نëèيà èىï. > 0.5 ىٌ){
BTFSS PORTB, SINH
CLRF FRONT
INCF FRONT, 1
MOVF FRONT, 0
SUBLW .5
BTFSS STATUS, Z
GOTO INT6
;_ôًîيٍ îليàًَوهي
; ïًîâهًêà ïهًèîنà ٌهٍهâîمî يàïًےوهيèے
MOVF SINcnt, 0
MOVWF SHORT
CLRF SINcnt
SUBLW .195 ; >195
BTFSC STATUS, C
GOTO NO_SIN
MOVF SHORT, 0
SUBLW .205 ; >205
BTFSS STATUS, C
GOTO NO_SIN
; رخءرزآإححخ ربحصذخحباہضبك
MOVF T, 0
SUBLW .5
BTFSC STATUS, C
GOTO SIN1
MOVF T, 0
SUBLW .194
BTFSS STATUS, C
GOTO SIN1
MOVF T, 0
ADDLW 3
MOVWF T
GOTO NO_SIN
SIN1: MOVLW .199
MOVWF T
BSF SIN_OK, 0
GOTO $+2
NO_SIN: CLRF SIN_OK
;__}
INT6:



RETFIE
;__}




END
#
 

blueroomelectronics

Well-Known Member
Why would you want to change it to a 16F877? A 16F628 would be a better match. Also use code tags and it would be helpful if the comments were in English.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top