v1.01
;PORT
LED_ERROR EQU 0A4H; P2.4
GOT_BOCH EQU 094H;P1.4 готовность БОЧ вход
GOT_BNCH EQU 093H;P1.3 готовность БНЧ вход
RES_BOCH EQU 092H;P1.2
RES_BNCH EQU 091H;P1.1
DONE EQU 0A6H;P2.6
PROGRAM EQU 0A7H;P2.7
BYTE_ERR_IN EQU 02AH
ERR_56M REG BYTE_ERR_IN.0
ERR_G1_4 REG BYTE_ERR_IN.1
ERR_SNPR56M REG BYTE_ERR_IN.2
SNPR_GHM REG BYTE_ERR_IN.3
ERR_SNPRK56M REG BYTE_ERR_IN.4
ERR_SNPRB56M REG BYTE_ERR_IN.5
ERR_OG REG BYTE_ERR_IN.6
ERR_NLCHM REG BYTE_ERR_IN.7
BYTE_ERR_IN2 EQU 02BH
ERR_G1 REG BYTE_ERR_IN2.0
ERR_G2 REG BYTE_ERR_IN2.1
ERR_BP REG BYTE_ERR_IN2.2
BYTE_ERR_OUT EQU 02CH
KVITANCIA8 REG BYTE_ERR_OUT.1;OUT ERROR
LED_IND REG BYTE_ERR_OUT.2
WR_SETKA REG BYTE_ERR_OUT.6;USTANOVKA SETOK T = 1MS
WR_DDS REG BYTE_ERR_OUT.7;PEREZAPUSK DDS T = 1MS
BYTE_ERR EQU 02EH
ERR_BNCH REG BYTE_ERR.0; ERROR BNCH
ERR_BOCH REG BYTE_ERR.1; ERROR BOCH
START_BYTE EQU 02FH;;
BIT_START REG START_BYTE.0
BIT_START2 REG START_BYTE.1
BIT_ST_DDS REG START_BYTE.2
BIT_ST_SETKA REG START_BYTE.3
BIT_RESTART REG START_BYTE.4
MEM EQU 030H
CNT_56M EQU 06DH
TIMER1_BUF EQU 06EH
ERROR_CNT1 EQU 070H;CNT ERROR
ERROR_CNT2 EQU 071H;CNT ERROR
TMP_CNT EQU 072H
BYTE_CNT EQU 073H
CNT_START_H EQU 074H
CNT_START_L EQU 075H
CNT_DDS_START EQU 076H; * 50MS
CNT_SETKA_START EQU 077H; * 50MS
ERR_EXT_ADDR_OUT EQU 001H
ERR_EXT_ADDR_IN EQU 011H
TIME EQU 65535 - 200; T = 50000MKS
;====================================================
ORG 00H
MAIN:
JMP START_PROG
ORG 01BH;T = 50MS
PUSH PSW
PUSH ACC
MOV TH1,TIMER1_BUF+0
MOV TL1,TIMER1_BUF+1
JB BIT_ST_DDS,T1_1
DJNZ CNT_DDS_START,T1_1
SETB BIT_ST_DDS
T1_1:
JB BIT_ST_SETKA,T1_2
DJNZ CNT_SETKA_START,T1_2
SETB BIT_ST_SETKA
T1_2:
JNB DONE,T1_3
CALL INIT_ERROR;RD_ERROR XILINX
CALL OUT_ERROR
T1_3:
MOV 096H,#11100011B;WDI 2048ms
JB ERR_56M,T1_4
CLR BIT_RESTART
MOV CNT_56M,#250;10 SEC
JNB ERR_56M,T1_5
T1_4:
DJNZ CNT_56M,T1_5
SETB BIT_RESTART
T1_5:
POP ACC
POP PSW
RETI
ORG 0100H
ORG 0200H
START_PROG:
INIT:
MOV PSW,#00H
MOV SP,#07H
MOV R0,#07FH
CLR A
INIT_LOOP:
MOV @R0,A
DJNZ R0,INIT_LOOP
CLR LED_ERROR
MOV CNT_DDS_START,#40;; * 50MS
MOV CNT_SETKA_START,#100;; * 50MS
MOV BYTE_ERR_IN,#00H
MOV BYTE_ERR_IN2,#00H
MOV BYTE_ERR_OUT,#00H
MOV TIMER1_BUF+0,#03CH
MOV TIMER1_BUF+1,#0AFH
MOV TH1,TIMER1_BUF+0
MOV TL1,TIMER1_BUF+1
MOV CNT_56M,#250;12,5 SEC
SETB IE.7
SETB IE.3;INT T1
MOV TMOD,#00010000B
SETB TCON.6;START T1
CALL INIT_XILINX;;400MS
CLR WR_DDS;WR DDS
CLR WR_SETKA;WR SETKA
CALL OERR
CLR RES_BOCH
JNB BIT_ST_DDS,$; 2SEC
CLR IE.7
SETB WR_DDS
CALL OERR
CALL DELL_1MS
CLR WR_DDS
CALL OERR
SETB IE.7
CLR RES_BNCH
JNB BIT_ST_SETKA,$; 5SEC
CLR IE.7
SETB WR_SETKA
CALL OERR
CALL DELL_1MS
CLR WR_SETKA
CALL OERR
SETB IE.7
NOP
NOP
NOP
NOP
CLR IE.7
CALL RESET_BOCH
CALL RESET_BNCH
SETB IE.7
L301:
JNB BIT_RESTART,L300
CLR IE.7
JMP START_PROG
L300:
JMP L301
JMP $
;====================================================
INIT_XILINX:
SETB LED_ERROR
JB DONE,DONE_OK
CLR PROGRAM
CALL DELL_10MS
SETB PROGRAM
CALL DELL_100MS
CALL DELL_100MS
CALL DELL_100MS
CALL DELL_100MS
JB DONE,DONE_OK
MOV BYTE_CNT,#100
IXL_LOOP:
CALL DELL_100MS
JB DONE,DONE_OK
DJNZ BYTE_CNT,IXL_LOOP
JMP INIT
DONE_OK:
CALL DELL_100MS
JB ERR_56M,INIT_XILINX
CLR LED_ERROR
RET
;====================================================
RESET_BNCH:
JNB GOT_BNCH,RES_BNCH_END
MOV BYTE_CNT,#100
IBNCH_LOOP:
JNB GOT_BNCH,RES_BNCH_END
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
JNB GOT_BNCH,RES_BNCH_END
SETB RES_BNCH
CALL DELL_10MS
CLR RES_BNCH
DJNZ BYTE_CNT,IBNCH_LOOP
RES_BNCH_END:
RET
;----------------------------------------------------
RESET_BOCH:
JNB GOT_BOCH,RES_BOCH_END
MOV BYTE_CNT,#100
IBOCH_LOOP:
JNB GOT_BOCH,RES_BOCH_END
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
JNB GOT_BOCH,RES_BOCH_END
SETB RES_BOCH
CALL DELL_10MS
CLR RES_BOCH
DJNZ BYTE_CNT,IBOCH_LOOP
RES_BOCH_END:
RET
;====================================================
INIT_ERROR:
MOV R0,#ERR_EXT_ADDR_IN
MOVX A,@R0
MOV BYTE_ERR_IN2,A
INC R0
MOVX A,@R0
MOV BYTE_ERR_IN,A
RET
OUT_ERROR:
SETB KVITANCIA8
SETB LED_IND;;;; REG DYTE_ERR_OUT.2
SETB LED_ERROR
JB ERR_56M,OERR1
JB ERR_OG,OERR1
JB ERR_G1,OERR1
JB ERR_G2,OERR1
JB ERR_G1_4,OERR1
JB ERR_NLCHM,OERR1
JB ERR_SNPRB56M,OERR1
JB ERR_SNPR56M,OERR1
JB GOT_BOCH,OERR1
JB GOT_BNCH,OERR1
CLR KVITANCIA8
CLR LED_ERROR
CLR LED_IND;;;; REG DYTE_ERR_OUT.2
OERR1:
OERR:
JNB SNPR_GHM,OERR2;;;; REG BYTE_ERR_IN.3
SETB LED_IND;;;; REG DYTE_ERR_OUT.2
SETB LED_ERROR
OERR2:
MOV R0,#ERR_EXT_ADDR_OUT
MOV A,BYTE_ERR_OUT
MOVX @R0,A
RET
;====================================================
DELL_1SEC:
CALL DELL_100MS
CALL DELL_100MS
CALL DELL_100MS
CALL DELL_100MS
CALL DELL_100MS
DELL_500MS:
CALL DELL_100MS
CALL DELL_100MS
CALL DELL_100MS
CALL DELL_100MS
DELL_100MS:
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
CALL DELL_10MS
DELL_10MS:
CALL DELL_1MS
CALL DELL_1MS
CALL DELL_1MS
CALL DELL_1MS
CALL DELL_1MS
CALL DELL_1MS
CALL DELL_1MS
CALL DELL_1MS
CALL DELL_1MS
DELL_1MS:
MOV 096H,#11100011B;WDI 2048ms
MOV TMP_CNT,#250
DJNZ TMP_CNT,$
MOV TMP_CNT,#250
DJNZ TMP_CNT,$
RET
ORG 8000
JMP START_PROG
;======================