flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > 8051 and 4 process to led switch

Author
Thread Post new topic Reply to topic
Teodor_Fest



Joined: 19 Dec 2015
Posts: 1
Teodor_Fest 19 Dec 2015, 12:09
i have IAR project for 8051. It`s don`t work property at Proteus ISIS 7.10 SP0.
But code coplile fine and HEX file too.
i alwyas stay at procces 1 and can`t switch to next
Code:
#include "ioAT89C4051.h"
STACK_BEGIN EQU 70H

PROC_1_ACC DEFINE 69H
PROC_1_PSW DEFINE 68H
PROC_1_DPH DEFINE 67H
PROC_1_DPL DEFINE 66H
PROC_1_SP  DEFINE 65H
SP_PROC_1  DEFINE 64H
//SYS_REG_INIT_PROC1 DEFINE 68H
//SYS_REG_SAVE_PROC_1 DEFINE 66H

PROC_2_ACC DEFINE 63H
PROC_2_PSW DEFINE 64H
PROC_2_DPH DEFINE 62H
PROC_2_DPL DEFINE 61H
PROC_2_SP  DEFINE 60H
SP_PROC_2  DEFINE 59H
//SYS_REG_INIT_PROC2 DEFINE 37H
//SYS_REG_SAVE_PROC_2 DEFINE 36H

PROC_3_ACC DEFINE 58H
PROC_3_PSW DEFINE 57H
PROC_3_DPH DEFINE 56H
PROC_3_DPL DEFINE 55H
PROC_3_SP  DEFINE 54H
SP_PROC_3  DEFINE 47H


PROC_4_ACC DEFINE 52H
PROC_4_PSW DEFINE 52H
PROC_4_DPH DEFINE 51H
PROC_4_DPL DEFINE 50H
PROC_4_SP  DEFINE 49H
SP_PROC_4  DEFINE 48H


NUM_DRX DEFINE 41H
FIRST_START     DEFINE 25H

    org 00h
     LJMP START_INIT
      
    org 00bh
     LJMP INT_CALC_ADDR      

     INT_CALC_ADDR:
      MOV TH1, #0E0H
      MOV TL1, #0C0H
      //MOV TH1, #0B1H
      //MOV TL1, #0E0H
      //PUSH ACC
      //PUSH PSW
      MOV A, NUM_DRX
      MOV B, #3
      MUL AB
      //PUSH DPH
      //PUSH DPL
      MOV DPTR, #INT_TABLE_TI
      JMP @A+DPTR
      
     INT_TABLE_TI:
      LJMP PROC_1
      LJMP PROC_2
      LJMP PROC_3
      LJMP PROC_4
      
     SYS_REG_SAVE_PROC_1:
      MOV PROC_1_ACC, ACC
      MOV PROC_1_PSW, PSW
      MOV PROC_1_DPH, DPH
      MOV PROC_1_DPL, DPL
      MOV SP_PROC_1, SP
      LJMP SYS_REG_INIT_PROC2

         
     SYS_REG_SAVE_PROC_2:
      MOV PROC_2_ACC, ACC
      MOV PROC_2_PSW, PSW
      MOV PROC_2_DPH, DPH
      MOV PROC_2_DPL, DPL
      MOV SP_PROC_2, SP
      LJMP SYS_REG_INIT_PROC3

      
     SYS_REG_SAVE_PROC_3:
      MOV PROC_3_ACC, ACC
      MOV PROC_3_PSW, PSW
      MOV PROC_3_DPH, DPH
      MOV PROC_3_DPL, DPL
      MOV SP_PROC_3, SP
      LJMP SYS_REG_INIT_PROC4

         
     SYS_REG_SAVE_PROC_4:
      MOV PROC_4_ACC, ACC
      MOV PROC_4_PSW, PSW
      MOV PROC_4_DPH, DPH
      MOV PROC_4_DPL, DPL
      MOV SP_PROC_4, SP
      LJMP SYS_REG_INIT_PROC1

      
     SYS_REG_INIT_PROC1:
      MOV ACC, PROC_1_ACC 
      MOV PSW, PROC_1_PSW 
      MOV DPH, PROC_1_DPH  
      MOV DPL, PROC_1_DPL 
      MOV SP,  PROC_1_SP
      LJMP PROC_1_HANDLER
      
     SYS_REG_INIT_PROC2:
      MOV ACC, PROC_2_ACC 
      MOV PSW, PROC_2_PSW 
      MOV DPH, PROC_2_DPH  
      MOV DPL, PROC_2_DPL 
      MOV SP,  PROC_2_SP  
      LJMP PROC_2_HANDLER
      
     SYS_REG_INIT_PROC3: 
      MOV ACC, PROC_3_ACC 
      MOV PSW, PROC_3_PSW 
      MOV DPH, PROC_3_DPH  
      MOV DPL, PROC_3_DPL 
      MOV SP,  PROC_3_SP
      LJMP PROC_3_HANDLER
      
     SYS_REG_INIT_PROC4:
      MOV ACC, PROC_4_ACC 
      MOV PSW, PROC_4_PSW 
      MOV DPH, PROC_4_DPH  
      MOV DPL, PROC_4_DPL 
      MOV SP,  PROC_4_SP 
      LJMP PROC_4_HANDLER

     //END_PROC:
      //POP DPL
      //POP DPH
      //POP PSW
      //POP ACC
      //RET
    
     //STOP_PROC:
      //MOV SCON, #01010000b
      //LJMP END_PROC
      //LJMP MAIN_LOOP
       
      //1
     PROC_1:
       JBC FIRST_START, SYS_REG_SAVE_PROC_4
       LJMP SYS_REG_INIT_PROC1
     
      
     PROC_1_HANDLER:
      CPL P1.0
      INC NUM_DRX
      RETI
  
      //2
     PROC_2:
      LJMP SYS_REG_SAVE_PROC_1
      
     PROC_2_HANDLER:
      CPL P1.1
      INC NUM_DRX
      RETI
      
      
     //3
     PROC_3:
      LJMP SYS_REG_SAVE_PROC_2
      
     PROC_3_HANDLER:
      CPL P1.2
      INC NUM_DRX
      RETI
     
     //4
     PROC_4:
      LJMP SYS_REG_SAVE_PROC_3
     
     PROC_4_HANDLER:
      CPL P1.3
      MOV NUM_DRX, #0
      RETI
      
     START_INIT:
      MOV SP, #STACK_BEGIN
      MOV TMOD, #00000001b
      MOV TH1, #0E0H
      MOV TL1, #0C0H
      MOV TCON, #00010000b
      MOV IE, #10000010b
      MOV NUM_DRX, #0
      SETB FIRST_START
      MOV SP_PROC_1, #69H
      MOV SP_PROC_2, #39H
      MOV SP_PROC_3, #47H
      MOV SP_PROC_4, #48H


     MAIN_LOOP:

      SJMP MAIN_LOOP
  
      END
    


Description: proteus file
Download
Filename: p1.rar
Filesize: 13.06 KB
Downloaded: 947 Time(s)

Post 19 Dec 2015, 12:09
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.