打印

变频器程序

[复制链接]
3920|16
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
avocationA|  楼主 | 2008-5-22 10:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
*FILE: BLDC05_mat.ASM
*日期:2005年9月28日*  
*******************************************
*******************************************
*   无位置和有位置通用,input=20MHZ,T1周期=10us启动AD中断* 
*   24LC16B读写
*   CAN通信 
*   18b20通信
*   温度设置:-19C--+40C 
*   ERR-1: 起动失败
*   ERR-2   电源电压<150VDC         
*   ERR-3   过流 
*   ERR-4   电源电压>350VDC 
*   ERR-5   24LC16B W/R错误
*   ERR-6   电机温度过高(转头设置错误) 
*   ERR-7   没有负载
*   ERR-8   功率管保护  
*   DATT46:  15-0=1 18B20_RUN    15-1=1  LCD_RUN
*            15-2=1 CAN_RUN  
*   DATT30:  =112,两秒步进测试;  =114,两极电机.再起动
*            =119,自动再起动  ;  =120 不计时.
*   DATT31:  DATT30=114 速度加减量
*   DATT32:  DATT30=114  速度加减量
*   DATT33:  DATT30=114 速度最大值
*   DATT34:  DATT30=114  速度最大值
*
*
*
*******************************************              
*******************************************
;AS1    .usect      "cur_mod",10     
;AS2    .usect      "cur_mod",10
;       .ref        CAN_F
;       .ref        CAN_J
;       .ref        CAN_INIT      
;       .ref        WR_EEPROM
;       .ref        I2C,I2C_WRITE,I2C_COUNT, 
;       .ref        DISPLAY1          ;LCD  
;       .ref        LCD_PLAY
;       .ref        LCD_INT        
;       .ref        DISPLAY2
;       .ref        LCD_CN 
;       .ref        LCD_DARW 
;       .ref        LCD_DASX  
;       .ref        LCD_CLEAR
;       .ref        LCD_CL  
       .ref        REST_18B20;,RD_DAT6,DS1820CRC1   
       .ref        I2C_R,I2C_W,I2C_W_INT,I2C_R_INT 
       .ref        PID,PID_INT
       .ref        RK,U,UK,UF,COMP
       .ref        PID_COUNT2,PID_COUNT4 
       .ref        R_MUN,READ,W_CNT
       .def        T3PRSET,BLDCTABLE1,OFFOUT
******************************************* 
*******************************************
       .sect    "VECTORS" 
*******************************************        
int0        B        _c_int0        
int1        B        ADC_INT
int2        B        BEGIN
int3        B        BEGIN 
int4        B        BEGIN
int5        B        SPIINT 
int6        B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN    
            B        BEGIN 
            B        BEGIN                                       
*******************************************                
          .include "lf2407a.H"          
******************************************* 
DAT_SET   .set  0H
*版本编号:
VAR       .set  50922 ;5=2005;06=6月;26=26日
*T1 周期
T1PRSET   .set  400   ;400=100KHZ 
*PWM调制频率
T3PRSET   .set  2000  ;2000=20KHZ 
*低速起动运行时间设置:
LSRUN     .set  0     ;2500*2MS=5S   
*加减速时间常数设置:  
ASTIME    .set  5
*转头判别时间设置: 
ZHUANTOU1 .set  10  
ZHUANTOU2 .set  1300
ZHUANTOU3 .set  4600
ZHUANTOU4 .set  5600   
ZHUANTOU5 .set  8500  
ZHUANTOU6 .set  9500
ZHUANTOU7 .set  9600
ZHUANTOU8 .set  9700 
 
*初始时间设置:
FEN       .set  2     ;分   
MIAO      .set  30    ;秒  
*初始转速设置:  
SPEED0    .set  5000  ;转/分      
*最低转速设置:
SPEED1    .set  5000  ;转/分    1#类电机
SPEED2    .set  4000  ;转/分    2#类电机
SPEED3    .set  3000  ;转/分    3#类电机
SPEED4    .set  2000  ;转/分    4#类电机
*1#电机最高转速设置:
SP1_MAX1  .set  25000 ;转/分    1#转头
SP1_MAX2  .set  25000 ;转/分    2#转头
SP1_MAX3  .set  25000 ;转/分    3#转头
SP1_MAX4  .set  25000 ;转/分    4#转头   
SP1_MAX5  .set  25000 ;转/分    5#转头
SP1_MAX6  .set  25000 ;转/分    6#转头
SP1_MAX7  .set  25000 ;转/分    7#转头
SP1_MAX8  .set  25000 ;转/分    8#转头

*定位电流:          
I1MIX     .set  550   ;1#类电机
I2MIX     .set  550   ;2#类电机
I3MIX     .set  550   ;3#类电机
I4MIX     .set  550   ;4#类电机 
*切换点以下运行电流:          
I1MAX     .set  650   ;1#类电机
I2MAX     .set  650   ;2#类电机
I3MAX     .set  650   ;3#类电机
I4MAX     .set  650   ;4#类电机
*切换点以上运行电流:          
I1MAXUP   .set  1000  ;1000
I2MAXUP   .set  1000
I3MAXUP   .set  1000 
I4MAXUP   .set  1100  ;1000=3A(AC)    

*定位时间
T1SP      .set  500   ;1000=2秒
T2SP      .set  10000       
T3SP      .set  10000 
T4SP      .set  10000    
*1#电机同步起动初始转速设置
T1ST1     .set  1000   ;1#转头     
T1ST2     .set  2500  ;2#转头
T1ST3     .set  3000  ;3#转头
T1ST4     .set  3500  ;4#转头 3000=75 转/分           
*2#电机同步起动初始转速设置
T2ST1     .set  6000       
T2ST2     .set  6000
T2ST3     .set  6000
T2ST4     .set  6000  
*3#电机同步起动初始转速设置
T3ST1     .set  6000       
T3ST2     .set  6000
T3ST3     .set  6000
T3ST4     .set  6000  
*4#电机同步起动初始转速设置
T4ST1     .set  6000       
T4ST2     .set  6000
T4ST3     .set  6000
T4ST4     .set  6000  
************************************************
************************************************
     .text     
************************************************
       
 .word   0FFFFh,0FFFFh,0FFFFh,0FFFFh  ;写保密区0040H-0043H 
 
********************************************  
  
_c_int0:
        CLRC        XF
        CLRC        CNF
        CLRC        OVM          
        CLRC        SXM  
        SETC        INTM            ;关中      
        
        LDP         #224
        SPLK        #0068H,WDCR     ;#002BH

******************清DRAM*********************

CLEAR1:    MAR         *,AR6
        LAR         AR6,#60H
        LACL        #0
        RPT         #01FH
        SACL        *+,0,AR6
        LAR         AR7,#0FFH
        LAR         AR6,#300H
        MAR         *,AR6
CLEAR2:    SPLK        #0H,*+,AR7
        BANZ        CLEAR2,AR6      
             
        LAR         AR7,#0FFH
        LAR         AR6,#200H
        MAR         *,AR6
CLEAR3:    SPLK        #0H,*+,AR7
        BANZ        CLEAR3,AR6   
        
        LAR         AR7,#07FH
        LAR         AR6,#800H
        MAR         *,AR6
CLEAR4:    SPLK        #DAT_SET,*+,AR7
        BANZ        CLEAR4,AR6  
        
        LAR         AR7,#780H
        LAR         AR6,#880H
        MAR         *,AR6
CLEAR5:    SPLK        #0H,*+,AR7
        BANZ        CLEAR5,AR6                                    
*********************************************  

******************系统初始化*****************
SYSINIT:
        LDP         #0
        SPLK        #0FFFFH,IFR
        SPLK        #00011H,IMR
        LAR         AR4,#060H
        LDP         #6 
        SPLK        #VAR,IN7            ;版本编号5=2005;05=5月;18=18日
        SPLK        #00H,TEMP           ;#00H
        OUT         TEMP,WSGR            ;等待
        LDP         #224             
        SPLK        #002ACH,SYSCR        ;#00ACH ,PLL=*4 , #02ACH ,PLL=*2, 
                                        ;#02ACH:SCLK
                                        ;BIT7-ADC,BIT6-SCI,BIT5-SPI,BIT4-CAN
                                        ;BIT3-EVB,BIT2-EVA,BIT1-NC,BIT0-NC 
        LDP         #225                
        SPLK        #00038H,MCRA        ;除CAP1,CAP2,CAP3外,置为I/O方式
        SPLK        #00014H,MCRB        ;#000D4H 除SPICLK,SPISOMO外,置为I/O方式
        SPLK        #0007EH,MCRC          ;除PWM7-12外,置为I/O方式
        SPLK        #00300H,PADATDIR    ;除PA0PA1外 输入,低
        SPLK        #000FFH,PBDATDIR    ;PB输入,高
        SPLK        #0FF00H,PCDATDIR    ;PC输出,低
        SPLK        #0FF00H,PDDATDIR    ;PD输出,低
        SPLK        #0FF00H,PEDATDIR     ;PE输出, 低
        SPLK        #0FF00H,PFDATDIR     ;PF输出, 低    
        
        LDP         #232
        SPLK        #00100H,GPTCONA     ;#00000H  OFF T1PIN,T2PIN
        SPLK        #0A600H,COMCONA        ;#0CA07H 
        SPLK        #00000H,T1CNT
        SPLK        #T1PRSET,T1PR       ; 

        SPLK        #00000H,ATCRA        ;全关断     
        SPLK        #00FFFH,ATCRB        ;全关断  
        SPLK        #09046H,T1CON       ;#9046H,
        SPLK        #0FFFFH,EVAIFRA        ;清中断标志
        SPLK        #0FFFFH,EVAIFRB
        SPLK        #0FFFFH,EVAIFRC
        SPLK        #00000H,EVAIMRA        ;#0180H,允许T1周期,比较中断,其余屏蔽
        SPLK        #00000H,EVAIMRB        ;不允许T2T3中断,屏蔽 
         
        LDP         #232                ;捕捉
        SPLK        #00000H,EVAIMRC     ;允许CAP1,CAP2,CAP3中断,其余屏蔽
        SPLK        #00000H,T2CNT       ;T2
        SPLK        #0FFFFH,T2PR        ;   
        SPLK        #007FFH,T2CMPR
        SPLK        #0D740H,T2CON       ;#0D740H
        SPLK        #030FCH,CAPCONA     ;
        SPLK        #00000H,CAPFIFOA    ; 
        
        LDP         #234 
        SPLK        #09046H,T3CON        ;T3CON      
        SPLK        #00000H,T3CNT        ;T3CNT       
        SPLK        #T3PRSET,T3PR        ;#3000=10KHZ 30MHZ
        SPLK        #00041H,GPTCONB        ;#00041H  OPEN T3PIN
        SPLK        #0A600H,COMCONB        ;#0A600H   
        
        SPLK        #09646H,T4CON         ;#09646H 1/64 CLOCK      
        SPLK        #00000H,T4CNT         ;T4CNT       
        SPLK        #0FFFFH,T4PR         ;                 
        
        SPLK        #0FFFFH,EVBIFRA        ;EVBIFRA清中断标志
        SPLK        #0FFFFH,EVBIFRB        ;EVBIFRB
        SPLK        #0FFFFH,EVBIFRC        ;EVBIFRC
        SPLK        #00000H,EVBIMRA        ;EVBIMRA不允许T3周期中断,其余屏蔽
        SPLK        #00000H,EVBIMRB        ;EVBIMRB允许T4周期中断,其余屏蔽
        SPLK        #00000H,EVBIMRC        ;EVBIMRC   

*SPI_INIT:
        LDP         #224
        SPLK        #0007H,SPICCR
        SPLK        #0006H,SPICTL
        SPLK        #0013h,SPIBRR       ;#07h
        SPLK        #0040H,SPIPRI
        SPLK        #00C7H,SPICCR       ;#00C7h
        SPLK        #8000H,XINT1CR 
        SPLK        #8000H,XINT2CR    

*DACINIT:
        LDP         #225
        SPLK        #04000H,ADCTRL1        ;ADCTRL1
        NOP
        NOP
        NOP
        SPLK        #03200H,ADCTRL1        ;#03200H:4*Tclk  #3000H:2*Tclk  
        SPLK        #00500H,ADCTRL2
        SPLK        #00032H,MAXCONV        ;#00032H  #7
        SPLK        #00D3CH,CHSELSEQ1    ;#00D3CH  
        SPLK        #0BB22H,CHSELSEQ3    ;#0BBBBH  
        
        CALL        OFFOUT     

*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                          
HEL00:
        LDP         #0
        LACL        #W_CNT
        SACL        I2C_CNT
        LAR         AR0,#R_MUN       ;AR0:读写的字节数(16BIT)?
        LAR            AR3,#READ        ;AR3:输入数据缓冲区
                 
        CALL        I2C_R            ;读24LC16B   
        CALL        DATTQT           ;数据范围较对 
        
        LDP         #6
        BIT         S2,15-4          ;读24LC16B错误?   
        BCND        HEL01,NTC               
        SPLK        #0,S2   
        
        LDP         #0
        LACL        #W_CNT
        SACL        I2C_CNT
        LAR         AR0,#R_MUN       ;AR0:读写的字节数(16BIT)?
        LAR            AR3,#READ        ;AR3:输入数据缓冲区
                
        CALL        I2C_R            ;读24LC16B   
        CALL        DATTQT           ;数据范围较对   

        LDP         #6
        BIT         S2,15-4          ;读24LC16B错误?  
        BCND        HEL01,NTC         
            
        CALL        LOADDATX         ;则调出默认参数  
HEL01:   
******************DAT初始数据*********************** 
  
*DATSET:  
        LDP          #6 
        SPLK         #50,INK
        SPLK         #1,INNK  
        SPLK         #1,TDATT32       ;电机类型设置1-4 
        SPLK         #55,IN13  
        SPLK         #16,IN15
        LDP          #7
        SPLK         #600,INN2      
        SPLK         #1,DAT6           ;温度显示    
        SPLK         #18750,SPEEDA0    ;#18750 
        SPLK         #200,SPEEDA1   
        LT           SPEEDA0
        MPYU         SPEEDA1
        PAC       
        SACH         SP_H
        SACL         SP_L 
                                                  
        LDP         #7 
        SPLK        #1,DATT0
        SPLK        #1000,DA20        ;清除密码989 
        SPLK        #2000,DA21        ;清除密码1875           
        LDP         #224
        SPLK        #002fH,WDCR     ;#002BH  
         
        KICK_DOG                       
        
        CALL        PID_INT
        CALL        WUWEI       ;  
        
        LDP         #7
        BIT         DATT46,15-1
        BCND        CLRC_INTM,NTC
        LDP         #225
        SPLK        #00014H,MCRB 
               
;        call        DISPLAY1     
        
        CLRC        INTM
        B           TEST
CLRC_INTM: 
        LDP         #7
        BIT         DATT46,15-2
        BCND        CLRC_INTM1,NTC
        LDP         #225
        SPLK        #000D4H,MCRB                
        
;        CALL        CAN_INIT            ;CANINIT  
        
CLRC_INTM1:   
             
        CLRC        INTM                ;开中       

***********************************************        
****************  主程序  *********************
***********************************************
TEST:            
        LDP         #6
        LACL        S1
        BCND        TEST0,EQ
        LACL        #0
        SACL        S1           
            
*************        2ms程序    ******************  

        KICK_DOG                ;REST看门狗  
        
;       CALL        LCD_PLAY    
         CALL        BLINKPL        ;每秒闪灯
        CALL        INA            ;扫描输入   
        CALL        TIMECNT        ;起动定位     
        CALL        ZHUANDOU    ;转头判别    
        CALL        ERR1START   ;再起动
        CALL        FENGMING    ;蜂鸣
        CALL        PDPINT_DL   ;功率管保护延迟 
        CALL        SPI_LED      ;显示扫描 
         
         B           TEST
TEST0:
        LDP         #7 
        LACL        SPD_CNT
        BCND        TEST1,EQ
        SPLK        #0,SPD_CNT 
        
        CALL        SPEED_CNT 

TEST1:  
        LDP         #4
        LACL        SETH
        BCND        TEST,EQ 
        SPLK        #0,SETH 
         
        CALL        I2C_W      
        
        LDP         #7
        LACL        INN2
        SUB         #500
        BCND        TEST,LT 
                 
        CALL        PID            
        
        B           TEST          
*************************************************                  
************************************************* 
PDPINT_DL:
        LDP         #4
        LACL        PBDR_DL 
        SUB         #600
        BCND        PDPINT_DL1,GT 
        LACL        PBDR_DL          
        ADD         #1
        SACL        PBDR_DL
        SUB         #500
        BCND        PDPINT_DL1,LT  
        SPLK        #600,PBDR_DL
        LDP         #234          
        SPLK        #01H,EVBIFRA        ;清中断标志 
        SPLK        #00001H,EVBIMRA         
        SPLK        #08200H,COMCONB
PDPINT_DL1:
        RET
******************************************************** 
*****************速度计算*******************************            
SPEED_CNT: 
        LDP         #6
        LACL        IN11
        SUB         #1111
        BCND        SPD_END1,EQ 
        LDP         #7  
        BIT         CT,15-0 
        BCND        SPD_END1,NTC
        LDP         #7 
        LACC        SP_H,16
        ADD         SP_L
        RPT         #15
        SUBC        SP_TIME0  
        SACL        SPEEDA0
        LACC        SPEEDA0
        ADD         SPEEDA1
        ADD         SPEEDA2
        ADD         SPEEDA3
        ADD         SPEEDA4

        SACL        SPEEDA             ;平均速 

        DMOV        SPEEDA3
        DMOV        SPEEDA2
        DMOV        SPEEDA1
        DMOV        SPEEDA0  
        
        RET                 
SPD_END1: 
        LDP         #7 
        SPLK        #0FFFFH,SP_TIME
        SPLK        #0,SPEEDA0 
        SPLK        #0,SPEEDA1
        SPLK        #0,SPEEDA2
        SPLK        #0,SPEEDA3
        SPLK        #0,SPEEDA4
        RET                
**************************************************
**************************************************  
FENGMING:
        ldp         #7
        LACL        DATT35
        SUB         #110 
        BCND        FENGMING_1,EQ
        LDP         #6  
        LACL        FMDAT2   
        BCND        FENGMING0,LEQ
        SUB         #1
        SACL        FMDAT2   
        LACL        #08h            
        LDP         #225        
        OR             PFDATDIR          
        SACL        PFDATDIR         
        RET 
FENGMING0:    
        LDP         #6                
        BIT         S2,15-15
        BCND        FENGMING1,NTC 
        BIT         CTT0,15-0
        BCND        FENGMING1,NTC
        LACL        #08h            
        LDP         #225        
        OR             PFDATDIR          
        SACL        PFDATDIR          
        RET  
FENGMING1:  
        LACL        #0FFF7h            
        LDP         #225        
        AND         PFDATDIR          
        SACL        PFDATDIR     
        RET   
FENGMING_1:
        LDP         #6  
        LACL        FMDAT2   
        BCND        FENGMING_10,LEQ
        SUB         #1
        SACL        FMDAT2   
        LACL        #0FFF7h            
        LDP         #225        
        AND         PFDATDIR          
        SACL        PFDATDIR   
        RET 
FENGMING_10:    
        LDP         #6                
        BIT         S2,15-15
        BCND        FENGMING_11,NTC 
        BIT         CTT0,15-0
        BCND        FENGMING_11,NTC 
        LACL        #0FFF7h            
        LDP         #225        
        AND  

相关帖子

沙发
avocationA|  楼主 | 2008-5-22 10:23 | 只看该作者

2

************************************************          
****************数码显示输出********************  
************************************************

****************24位数码显示********************  
SPI_LED: 
        LDP         #4  
        LACL        DARW15
        ADD         #1
        SACL        DARW15
        sub         #47
        RETC        LT
        SPLK        #0,DARW15
        LACL        DARW10
        ADD         #1
        SACL        DARW10
        SUB         #25        ;#1000
        BCND        PP_8,LT
        SPLK        #25,DARW10 ;#1000  

        LDP         #7
        LACL        DA20
        SUB         #1024
        BCND        PP_11,EQ

        LDP         #6
        SPLK        #0,IN15
        SPLK        #0,IN16
        B           PP_12 
PP_11:  
        LDP         #4
        SPLK        #0,DARW10 
        LDP         #6
        LACL        IN15
        ADD         #1
        SACL        IN15
        SUB         #23
        BCND        PP_11_0,LEQ
        SPLK        #0,IN15 
PP_11_0:
        RET
PP_12:                     
        LDP         #6   
        LACL        INNK
        BCND        PINKK1,EQ
        SACL        DTA6 
        B           PINKK2
PINKK1: 
        LACL        INKK
        SACL        DTA6
PINKK2:        
        LDP         #6
        BIT         S2,15-15
        BCND        PDAT4_0,NTC  
             
        CALL        ERRSP      
        
        B           P_0
PDAT4_0:  
        LDP         #6         
        LACL        INNK
        BCND        PDAT4_1,EQ  
        SUB         #1           ;=1
        BCND        PDAT4,EQ
        SUB         #1           ;=2
        BCND        PDATT1,EQ
        SUB         #1           ;=3
        BCND        PDAT6,EQ
        SUB         #1           ;=4
        BCND        PDAT_6,EQ
        SUB         #1           ;=5
        BCND        P_DATT21,EQ      
        SUB         #1           ;=6
        BCND        P_TIME,EQ          
        SUB         #1           ;=7
        BCND        P_TIME,EQ  
        SUB         #1           ;=8
        BCND        P_TIME,EQ 
        SUB         #1           ;=9
        BCND        P_TIME_1,EQ  
PDAT4_1:                                   
        LACL        INKK
        SUB         #24
        BCND        PINK,EQ 
        B           PDATTX
P_TIME_1:  
        LDP         #7
        LACC        DAT0_ERR
        CALL        PPDTA5_1
        B           P_0      
P_TIME:
        CALL        PPDTA4_2
        B           P_0
PINK:
        LDP         #6
        LACC        INK
        CALL        PPDTA5_1
        B           P_0
PDAT_6:        
        LDP         #7
        LACC        DATT7
        CALL        PPDTA5_1  
        CALL        CLRC_DTA5_1
        B           P_0        
PDAT6:        
        LDP         #7
        LACC        DAT6
        CALL        PPDTA5_1
        B           P_0        
PDATT1:        
        LDP         #7
        LACC        DATT1   
        CALL        PPDTA5_1 
        CALL        CLRC_DTA5_1
        B           P_0
PDAT4:  
        LDP         #6
        LACL        IN13
        SUB         #55
        BCND        PHELLO,EQ                       
        LDP         #7         
        LACC        DAT4          
        CALL        PPDTA5_1
        B           P_0
P_DATT21:  
        LDP         #7
        LACC        DATT21
        CALL        PPDTA5_1 
        CALL        CLRC_DTA5_1
        B           P_0  
PHELLO:     
        LDP         #7
        LACC        V_MAX1
        CALL        PPDTA5_1
        B           P_0
        
        LDP            #6
        SPLK        #21,DTA5       ;H
        SPLK        #14,DTA4       ;E
        SPLK        #22,DTA3       ;L
        SPLK        #22,DTA2       ;L
        SPLK        #00,DTA1       ;O   
        B           P_0
PDATTX: 
        LDP         #6
        LACL        INK
        BCND        PDATTX_END,LT 
        SUB         #60
        BCND        PDATTX_END,GT
        LACC        #PDATTXXX
        ADD         INK
        TBLR        TEMP
        LACC        TEMP
        BACC  
PDATTX_END:
        RET           
                                                                                                                                  
PDAT3:  LDP         #7
        LACL        DATT47              ;#0  DAT3 0-5000rpmTIME
        B           PPDTA11_0         
PDATT12: LDP         #7
        LACL        DATT12              ;#1
        B           PPDTA11
PDATT13: LDP         #7
        LACL        DATT13              ;#2
        B           PPDTA11        
PDATT14: LDP         #7
        LACL        DATT14              ;#3
        B           PPDTA11
PDATT15: LDP         #7
        LACL        DATT15              ;#4
        B           PPDTA11
PDATT16: LDP         #7
        LACL        DATT16              ;#5
        B           PPDTA11
PDATT17: LDP         #7
        LACL        DATT17              ;#6
        B           PPDTA11  
PDATT18: LDP         #7
        LACL        DATT18              ;#7
        B           PPDTA11  
PDATT19: LDP         #7
        LACL        DATT19              ;#8
        B           PPDTA11  
PDA20: LDP         #7
        LACL        DA20                ;#9
        B           PPDTA11      
PDATT22:
        LDP         #7
        LACL        DATT22        ;DATT22   #10
        B           PPDTA11      
PDATT23:
        LDP         #7
        LACL        DATT23        ;DATT23   #11
        B           PPDTA11      
PDATT24:
        LDP         #7
        LACL        DATT24        ;DATT24   #12
        B           PPDTA11      
PDATT25:
        LDP         #7
        LACL        DATT25        ;DATT25   #13
        B           PPDTA11              
PDATT26:
        LDP         #7
        LACL        DATT26        ;DATT26   #14
        B           PPDTA11     
PDATT27:
        LDP         #7
        LACL        DATT27        ;DATT27   #15
        B           PPDTA11      
PDATT28:
        LDP         #7
        LACL        DATT28        ;DATT28   #16
        B           PPDTA11  
PDATT29:
        LDP         #7
        LACL        DATT29         ;DATT29   #17
        B           PPDTA11  
PDA21:  LDP         #7
        LACL        DA21            ; #18  
        B           PPDTA11                
PDATT5: LDP         #7
        LACL        DATT5           ; #19  
        B           PPDTA11  
PDATT6: LDP         #7
        LACL        DATT6           ; #20  
        B           PPDTA11 
PDATT7: LDP         #7
        LACL        DATT7           ; #21  
        B           PPDTA11  
PDATT8: LDP         #7
        LACL        DATT8           ; #22  
        B           PPDTA11  
PDATT9:
        LDP         #7
        LACL        DATT9           ; #23  
        B           PPDTA11  
PDATT10:
        LDP         #7
        LACL        DATT10          ; #24  
        B           PPDTA11  
PV_MAX: 
        LDP         #7              
        LACL        V_MAX1          ; #25  
        B           PPDTA11_0        
PDATT11: 
        LDP         #7              
        LACL        DATT11          ; #26  
        B           PPDTA11       
PDATT20:
        LDP         #7
        LACL        DATT20         ;DATT20   #27
        B           PPDTA11                 
PDATT30:
        LDP         #7
        LACL        DATT30         ;DATT30   #28
        B           PPDTA11      
PDATT31:
        LDP         #7
        LACL        DATT31         ;DATT31   #29
        B           PPDTA11      
PDATT32:
        LDP         #7
        LACL        DATT32         ;DATT32   #30
        B           PPDTA11       
PDATT33:
        LDP         #7
        LACL        DATT33         ;DATT33   #31
        B           PPDTA11      
PDATT34:
        LDP         #7
        LACL        DATT34         ;DATT34   #32
        B           PPDTA11    
PDATT35:
        LDP         #7
        LACL        DATT35         ;DATT35   #33
        B           PPDTA11   
PDATT36:
        LDP         #7
        LACL        DATT36          ;DATT36   #34
        B           PPDTA11   
PDATT37:
        LDP         #7
        LACL        DATT37          ;DATT37   #35
        B           PPDTA11   
PDATT38:
        LDP         #7
        LACL        DATT38          ;DATT38  #36
        B           PPDTA11       
PDATT39:
        LDP         #7
        LACL        DATT39          ;DATT39   #37   
        B           PPDTA11   
PDATT40:
        LDP         #7
        LACL        DATT40          ;DATT40   #38      
        B           PPDTA11   
PDATT41:
        LDP         #7
        LACL        DATT41           ;DATT41   #39
        B           PPDTA11   
PDATT42:
        LDP         #7
        LACL        DATT42           ;DATT42   #40   
        B           PPDTA11      
PDATT43:
        LDP         #7
        LACL        DATT43           ;DATT43   #41  
        B           PPDTA11   
PDATT44:
        LDP         #7
        LACL        DATT44           ;DATT44   #42
        B           PPDTA11   
PDATT45:
        LDP         #7
        LACL        DATT45           ;DATT45   #43
        B           PPDTA11   
PDATT46:
        LDP         #7
        LACL        DATT46           ;DATT46   #44
        B           PPDTA11      
PDATT47:
        LDP         #7
        LACL        DATT47           ;DATT47   #45
        B           PPDTA11   
PDATT21:
        LDP         #7
        LACL        DATT21           ;DATT21   #46
        B           PPDTA11                             
PDAT21:
        LDP         #7
        LACL        DAT21             ;#47    
        B           PPDTA11_0         
PSPEEDA:
        LDP         #7
        LACL        SPEEDA           ;#48    
        B           PPDTA11_0           
PIN7:
        LDP         #6                         
        LACL        IN7               ;#49   
        B           PPDTA11_0
PIN5:
        LDP         #6
        LACL        IN5               ;#50
        B           PPDTA11_0                       
PVA:
        LDP         #7
        LACL        V_A               ;#51
        B           PPDTA11_0                                
PVB:
        LDP         #7
        LACL        V_B               ;#52
        B           PPDTA11_0                                
PVC:
        LDP         #7
        LACL        V_C               ;#53
        B           PPDTA11_0                                
PVM:
        LDP         #7
        LACL        V_M               ;#54
        B           PPDTA11_0                                
PIDD:
        LDP         #7
        LACL        IDD               ;#55
        B           PPDTA11_0                            
PCAN1:
        LDP         #4
        LACL        DARW20            ;#56
        B           PPDTA11_0              
PCAN2:
        LDP         #4
        LACL        DARW21            ;#57
        B           PPDTA11_0      
PCAN3:
        LDP         #4
        LACL        DARW22            ;#58
        B           PPDTA11_0      
PCAN4:
        LDP         #4
        LACL        DARW23            ;#59
        B           PPDTA11_0                              
PCAN5:
        LDP         #4
        LACL        DARW24            ;#60
PPDTA11_0: 
;        LDP         #4 
;        SACL        LCD_DAT   
        CALL        PPDTA5_1
        B           P_0
PPDTA11: 
;        LDP         #4 
;        SACL        LCD_DAT   
        CALL        PPDTA5_1
        CALL        CLRC_DTA5_1   
P_0:
        LAR         AR6,#5
        LAR         AR7,#DTA1
        MAR         *,AR7
P_1:     LACC        #SPITABLE
        ADD         *
        TBLR        *+,AR6
        BANZ        P_1,AR7  
        
        LDP         #6
        LACL        S2
        BCND        PP4,NEQ
        LACL        INNK
        SUB         #6
        BCND        PP1,NEQ  
PP0:    
        LDP         #225
        BIT         PEDATDIR,15-0
        BCND        PP4,NTC
        LDP         #6
        LACL        DTA3
        XOR         #0200H 
        SACL        DTA3  
        B           PP4
PP1:    
        LDP         #6 
        LACL        INNK
        SUB         #7
        BCND        PP2,NEQ 
        BIT         CTT0,15-0
        BCND        PP4,NTC        
        SPLK        #0FF00H,DTA5
        SPLK        #0FF00H,DTA4
        SPLK        #0FD00H,DTA3
        B           PP4
PP2:    
        LDP         #6 
        LACL        INNK
        SUB         #8
        BCND        PP3,NEQ 
        BIT         CTT0,15-0
        BCND        PP4,NTC   
        SPLK        #0FD00H,DTA3     
        SPLK        #0FF00H,DTA2
        SPLK        #0FF00H,DTA1 
        
        B           PP4
PP3:      
        LDP         #6
        BIT         CTT0,15-0
        BCND        PP4,TC
        LACL        DTA6
        XOR         #0100H 
        SACL        DTA6                    
PP4:    
        LDP         #224
        SPLK        #007H,SPICCR    ;#007H
        SPLK        #0C7H,SPICCR    ;#0C7H
        LAR         AR6,#5          ;#23
        LAR         AR7,#DTA1       ;#DTA19
        MAR         *,AR7
        LACL        *+,AR6
        LDP         #224
        SACL        SPITXBUF
        SPLK        #07H,SPICTL      ;#07H
        RET                                           
*******************************************
 
PPDTA4_1: 
        LDP         #7
        LACC        DAT2
        LDP         #6   
        SPLK        #10,TEMP
        RPT         #15
        SUBC        TEMP
        SACL        DTA5
        SACH        DTA4  
        LACL        DTA5
        BCND        PPDTA4_10,NEQ 
        SPLK        #17,DTA5
PPDTA4_10:        
        SPLK        #17,DTA3
        LDP         #7
        LACC        DAT1        
        LDP         #6   
        SPLK        #10,TEMP
        RPT         #15
        SUBC        TEMP
        SACL        DTA2
        SACH        DTA1 
        LACL        DTA2
        BCND        PPDTA4_11,NEQ 
        SPLK        #17,DTA2
PPDTA4_11:                                         
        RET  
*******************************************         
PPDTA4_2: 
        LDP         #7
        LACC        DAT2
        LDP         #6   
        SPLK        #10,TEMP
        RPT         #15
        SUBC        TEMP
        SACL        DTA5
        SACH        DTA4  
        LACL        DTA5
        BCND        PPDTA4_20,NEQ 
        SPLK        #17,DTA5
PPDTA4_20:        
        LDP         #7
        LACC        DAT1        
        LDP         #6   
        SPLK        #10,TEMP
        RPT         #15
        SUBC        TEMP
        SACL        DTA2
        SACH        DTA1 
        LACL        DTA2
        BCND        PPDTA4_21,NEQ 
        SPLK        #17,DTA2
PPDTA4_21:
        LDP         #7
        LACL        DAT2
        SUB         #12
        BCND        PPDTA4_22,GT 
        LDP         #6
        SPLK        #23,DTA6
        SPLK        #17,DTA3
        RET  
PPDTA4_22:    
        LDP         #6
        SPLK        #17,DTA6
        SPLK        #17,DTA3
  &nbs

使用特权

评论回复
板凳
avocationA|  楼主 | 2008-5-22 10:31 | 只看该作者

3

*******************************************         
*****************闪电源灯****************** 
******************************************* 
*DY*
BLINKPL:
        LDP         #6
        LACL        COUNT4
        ADD         #1
        SACL        COUNT4 
        SUB         #500        ;2MS*500=1S  
        BCND        BLINKPL1,LT
        SPLK        #0,COUNT4  
;        CLRC        XF   
******************************************    
        
        LDP         #7          
        BIT         CT,15-15
        BCND        SSST,NTC
        LACC        DAT14
        SACL        DAT4  
        SPLK        #0,DAT14        ;测速           
        
        CALL        STARTJS         ;起动失败检测   
        
***************************************** 
SSST:    
        LACL        #01h            ;
        LDP         #225        
        XOR         PEDATDIR          
        SACL        PEDATDIR         ;闪电源灯    
******************************************* 
        LDP         #7  
        LACC        V_MAX 
        RPT         #15
        SUBC        DATT36
        SACL        V_MAX1
        
        CALL        ADJTEMP
        CALL        VERR 
        CALL        JS_INNK
        RET

DD0:     
        LDP         #7
        LACL        DAT0 
        ADD         #1
        SACL        DAT0 
        SUB         #60    
        BCND        DD1,LT
        SPLK        #0,DAT0 
        LDP         #6
        LACL        INNK
        SUB         #7
        BCND        DD2,GEQ
        LDP         #7 
        LACL        DAT1  
        ADD         #1
        SACL        DAT1  
        SUB         #60    
        BCND        DD1,LT
        SPLK        #0,DAT1 
        LACL        DAT2  
        ADD         #1
        SACL        DAT2 
        SUB         #24    
        BCND        DD1,LT 
        SPLK        #0,DAT2 
DD1:    
        LACL        DAT0_ERR
        ADD         #1
        SACL        DAT0_ERR
        SUB         DATT45
        RETC        LT  
        SPLK        #0,DAT0_ERR
        LACL        DAT0
        ADD         #1
        SACL        DAT0
        SUB         #60
        BCND        DD2,LT
        SPLK        #0,DAT0
        LACL        DAT1
        ADD         #1
        SACL        DAT1
DD2:    
        RET  

******************************************             
BLINKPL1:
        LDP         #6
        LACL        COUNT6
        ADD         #1
        SACL        COUNT6 
        SUB         #250        ;2MS*250=0.5S  
        BCND        BL1END,LT           
        SPLK        #0,COUNT6   
        LACL        #01H
        XOR         CTT0
        SACL        CTT0    
        LACL        COUNT12
        ADD         #1
        SACL        COUNT12
        SUB         #10
        RETC        LT   
        SPLK        #0,COUNT12 
        BIT         CTT0,15-15
        BCND        BL1END,NTC         
        SPLK        #200,FMDAT2
BL1END: 
        RET          

******************************************

************************************************
JS_INNK:
        LDP           #6
        LACL        INNK
        BCND        JS_INNK_END,EQ 
        SUB         #6   
        BCND        JS_INNK_END,GEQ
        LACL        IN17
        ADD         #1
        SACL        IN17
        SUB         #15
        BCND        JS_INNK_END,LT 
        SPLK        #15,IN17
        SPLK        #1,INNK
JS_INNK_END:
        RET
***************电源电压检测*********************   

VERR:   
        LDP         #6
        LACL        COUNT13
        ADD         #1
        SACL        COUNT13
        SUB         #3
        BCND        VERR1,LT
        SPLK        #0,COUNT13 
        LDP         #7   
        LACL        V_MAX1
        SUB         DATT11          ;电源电压检测
        BCND        VERR0,LT        ;<150VDC****STOP     
        LACL        V_MAX1
        SUB         DATT20    
        BCND        VERREND,LT      ;>350VDC****STOP   
        
        call        STOP
        
        LDP         #6
        LACL        S2
        OR          #08008H
        SACL        S2                
        SPLK        #0,CTT0    
        RET        
VERR0:  
        
        call        STOP

        LDP         #6
        LACL        S2
        OR          #08002H
        SACL        S2                
        SPLK        #0,CTT0    
VERREND: 
        RET              
VERR1:
        LDP         #7  
        BIT         CT,15-15
        BCND        VERR1END,NTC         
        LACL        INN2
        SUB         #500
        BCND        VERR1END,LT         
        BIT         CT,15-2
        BCND        VERR1END,TC   
        BIT         CT,15-1
        BCND        VERR1END,NTC        
        LACL        IDD
        SUB         DATT35
        BCND        VERR1END,GT
        LDP         #6
        LACL        S2
        OR          #08040H
        SACL        S2
        
        CALL        STOP
        
VERR1END:            
        RET         
***************温度调整*******************    
    
ADJTEMP:                          
        LDP         #7 
        lacl        DAT6
        sub         #85
        bcnd        OFFXF,geq
        LDP         #7       
        LACL        DATT7               
        SUB         DAT6
        BCND        OFFXF,GT 
ADJ:        
        LDP         #4
        LACL        DARW5
        ADD         #1
        SACL        DARW5
        SUB         #5
        BCND        OFFXFEND,LT 
        SPLK        #0,DARW5
        LDP         #225
        LACL        PCDATDIR 
        AND         #0FFFEH
        SACL        PCDATDIR  
        SETC        XF  
        LDP         #6
        SPLK        #08020H,S2            
        RET              
OFFXF:  
        LDP         #4
        SPLK        #0,DARW5
        CLRC        XF  
        LDP         #225
        LACL        PCDATDIR
        OR          #001H            
        SACL        PCDATDIR 
OFFXFEND:        
        RET              

************起动失败检测**************************
        
STARTJS: 
        LDP          #7  
        BIT          CT,15-0
        BCND         WUWEI4,NTC   
        LACL         COUNT
        ADD          #1
        SACL         COUNT
        SUB          #3
        BCND         WUWEI2,LT
        SPLK         #0,COUNT
        LACL         DAT4
        SUB          #100        ;起动失败最低转速设置
        BCND         WUWEI3,LT 
WUWEI2: 
        LACL         DAT4
        SUB          SPEED_MAX     ;起动失败最高转速设置
        BCND         WUWEI4,LT   
WUWEI3:  
        call        STOP
                
        LDP          #6      
        SPLK         #0,CTT0        
        LACL         S2
        OR           #08001H
        SACL         S2         
WUWEI4:
        RET  

使用特权

评论回复
地板
avocationA|  楼主 | 2008-5-22 10:31 | 只看该作者

4

********************************************* 
****************外部开关输入*****************   
*********************************************
INA:    
        LDP         #6    
        LACL        COUNT8
        ADD         #1
        SACL        COUNT8
        SUB         #50            ;2MS*50=100MS
        RETC        LT
        SPLK        #0,COUNT8  

INA0:    LDP         #225
        LACL        PBDATDIR      
        AND         #00FFH
         LDP         #6 
        SACL        INAC  
        LACL        INAC
        SUB         #0FFH
        BCND        INAR0,NEQ  
        SPLK        #0FFH,INAA 
        SPLK        #0,INAB 
        LDP         #7
        LACL        DATT47
        BCND        INPA0,NEQ        
        LDP         #225
        BIT         PBDATDIR,15-7
        BCND        INPA0,NTC
        LDP         #6
        SPLK        #0FH,INF11
        CALL        STOP
        B           INPA0
INAR0:    LDP         #6 
        LACL        INAC
        SUB         INAA
        BCND        INA1,EQ  
        LACL        INAC        
        SACL        INAA
        B           IND0         ;IND0
INA1:   
        LDP         #6
        LACL        INNK
        SUB         #9
        BCND        INA2,EQ
        LACL        INAB 
        ADD         #1 
        SACL        INAB    
        SUB         #15
        BCND        INAD,LT      ;INAD
INA2:   
        LDP         #6
        LACL        INAA  
        AND         #0FH
        SUB         #12          ;#12
        BCND        INDAT7,EQ    ;INDAT7   
        LACL        INAA  
        AND         #0FH
        SUB         #13          ;#13
        BCND        IND02,EQ     ;IND02
        LACL        INAA  
        AND         #0FH
        SUB         #14          ;#14
        BCND        IND01,EQ     ;IND01 
INAD:    
        LDP         #7
        LACL        DATT47
        BCND        INPA0,NEQ
        LDP         #6
        LACC        INAA,12 
        SACH        INF10
        LACL        INF10
        SUB         INF11
        BCND        INPA0,EQ
        LACL        INF10
        SACL        INF11  
        SUB         #07H 
        BCND        INAD0,GT
        SPLK        #200,FMDAT2 
        
        CALL        RUN
        
INAD0:   

        LDP         #6  
        LACL        INF10
        AND         #07H
        SACL        INF12  
        
        CALL        SET_DATT1 
         
        B           INPA0
        
SET_DATT1:
        LDP         #6 
        LACL        FMDAT2
        BCND        SET_DATT10,NEQ
        SPLK        #40,FMDAT2
SET_DATT10:        
        LACL        INF12
        BCND        LOAD_DATT19,EQ      ;#0
        SUB         #1
        BCND        LOAD_DATT17,EQ      ;#1
        SUB         #1
        BCND        LOAD_DATT18,EQ      ;#2
        SUB         #1
        BCND        LOAD_DATT16,EQ      ;#3
        SUB         #1
        BCND        LOAD_DATT15,EQ      ;#4
        SUB         #1
        BCND        LOAD_DATT13,EQ      ;#5
        SUB         #1
        BCND        LOAD_DATT14,EQ      ;#6
        SUB         #1
        BCND        LOAD_DATT12,EQ      ;#7
        RET  
LOAD_DATT12:
        LDP         #7
        LACL        DATT12
        SACL        DATT1
        RET
LOAD_DATT13:
        LDP         #7
        LACL        DATT13
        SACL        DATT1
        RET
LOAD_DATT14:
        LDP         #7
        LACL        DATT14
        SACL        DATT1
        RET
LOAD_DATT15:
        LDP         #7
        LACL        DATT15
        SACL        DATT1
        RET
LOAD_DATT16:
        LDP         #7
        LACL        DATT16
        SACL        DATT1
        RET                        
LOAD_DATT17:
        LDP         #7
        LACL        DATT17
        SACL        DATT1
        RET
LOAD_DATT18:
        LDP         #7
        LACL        DATT18
        SACL        DATT1
        RET  
LOAD_DATT19:
        LDP         #7
        LACL        DATT19
        SACL        DATT1
        RET                                                                    
IND0:    LDP         #6        
        BIT         INAA,15-0
        BCND        IND02,TC 
IND01:  
        LDP         #6
        SPLK        #0,IN17
        LACL        INKK
        SUB         #24
        BCND        INKADD,EQ
        LACL        INNK
        SUB         #2
        BCND        ADD_DATT1,EQ 
        LACL        INNK
        SUB         #4
        BCND        ADD_DATT7,EQ  
        LACL        INNK
        SUB         #5
        BCND        DATT21ADD,EQ        
        LACL        INNK
        SUB         #7
        BCND        ADD_DAT2,EQ  
        LACL        INNK
        SUB         #8
        BCND        ADD_DAT1,EQ   
        
        B           DATTADD      
    
ADD_DATT1: 
        LDP         #7
        LACL        DATT47
        BCND        INAR,EQ
        LACL        DATT1
        ADD         ADD_SUB
        SACL        DATT1 
        ADD         #5000
        SUB         SPEED_MAX
        BCND        INARN,LEQ 
        LACL        SPEED_MAX
        SUB         #5000
        SACL        DATT1
        B           INARN
ADD_DATT7:
        LDP         #7
        LACL        DATT7
        ADD         #1
        SACL        DATT7
        SUB         #120
        BCND        INARN,LEQ
        SPLK        #120,DATT7
        B           INARN        
ADD_DAT2:
        LDP         #7
        LACL        DAT2
        ADD         #1
        SACL        DAT2
        SUB         #23
        BCND        INARN,LEQ
        SPLK        #0,DAT2
        B           INARN    
ADD_DAT1:
        LDP         #7
        LACL        DAT1
        ADD         #1
        SACL        DAT1
        SUB         #59
        BCND        INARN,LEQ
        SPLK        #0,DAT1
        B           INARN                    
IND02:  
        LDP         #6   
        BIT         INAA,15-1
        BCND        IND03,TC         
        SPLK        #0,IN17
        LACL        INKK
        SUB         #24
        BCND        INKSUB,EQ 
        LACL        INNK
        SUB         #2
        BCND        SUB_DATT1,EQ 
        LACL        INNK
        SUB         #4
        BCND        SUB_DATT7,EQ 
        LACL        INNK
        SUB         #5
        BCND        DATT21SUB,EQ           
        LACL        INNK
        SUB         #7
        BCND        SUB_DAT2,EQ  
        LACL        INNK
        SUB         #8
        BCND        SUB_DAT1,EQ 
        
        B           DATTSUB      
IND03:  LDP         #6  
        BIT         INAA,15-2
        BCND        IND04,TC 
        SPLK        #40,FMDAT2
        RET 
IND04:  LDP         #6  
        BIT         INAA,15-3
        BCND        INPA0,TC
        SPLK        #40,FMDAT2
        RET                                                                                                                                                                                          
IND05:  LDP         #6  
        BIT         INAA,15-4
        BCND        IND06,TC            
        SPLK        #40,FMDAT2
        RET
IND06:  LDP         #6  
        BIT         INAA,15-5
        BCND        IND07,TC
        SPLK        #40,FMDAT2
        RET 

IND07:  LDP         #6  
        BIT         INAA,15-6
        BCND        IND08,TC 
        SPLK        #40,FMDAT2
        RET 
IND08:  LDP         #6  
        BIT         INAA,15-7
        BCND        INPA0,TC 
        SPLK        #40,FMDAT2
        LDP         #7
        BIT         CT,15-15
        BCND        IND080,TC
        
        CALL        RUN

        RET 
IND080:
        RET                       
SUB_DATT1:
        LDP         #7
        LACL        DATT47
        BCND        INAR,EQ
        LACL        DATT1
        SUB         ADD_SUB
        SACL        DATT1
        SUB         #5000
        BCND        INARN,GEQ
        SPLK        #5000,DATT1
        B           INARN
SUB_DATT7:
        LDP         #7
        LACL        DATT7
        SUB         #1
        SACL        DATT7
        SUB         #10
        BCND        INARN,GEQ
        SPLK        #10,DATT7
        B           INARN    
SUB_DAT2:
        LDP         #7
        LACL        DAT2
        SUB         #1
        SACL        DAT2
        BCND        INARN,GEQ
        SPLK        #23,DAT2
        B           INARN        
SUB_DAT1:
        LDP         #7
        LACL        DAT1
        SUB         #1
        SACL        DAT1
        BCND        INARN,GEQ
        SPLK        #59,DAT1
        B           INARN                            

DATTADD: 
        LDP         #6
        LACL        INK 
        BCND        ADDEND,LT
        SUB         #50
        BCND        ADDEND,GEQ
        LACC        #DATTADDX
        ADD         INK
        TBLR        TEMP
        LACC        TEMP
        BACC
ADDEND:                                                             
        RET       
             
;DAADD    
DATT5ADD:
        LDP         #7
        LACL        DATT5
        ADD            #500
        SACL        DATT5 
        SUB         #15000
        BCND        INARN,LEQ
        SPLK        #15000,DATT5    
        RET
   
DATT6ADD:
        LDP         #7
        LACL        DATT6
        ADD            #500
        SACL        DATT6  
        SUB         #5000
        BCND        INARN,LEQ
        SPLK        #5000,DATT6          
        RET
  
DATT7ADD:
        LDP         #7
        LACL        DATT7
        ADD            #1
        SACL        DATT7  
        SUB         #120
        BCND        INARN,LEQ
        SPLK        #120,DATT7     
        RET        
  
DATT8ADD:
        LDP         #7
        LACL        DATT8
        ADD            #5
        SACL        DATT8  
        SUB         #1000
        BCND        INARN,LEQ
        SPLK        #1000,DATT8      
        RET
  
DATT9ADD:
        LDP         #7
        LACL        DATT9
        ADD            #10
        SACL        DATT9 
        SUB         #2000
        BCND        INARN,LEQ  
        SPLK        #2000,DATT9    
        RET
              
DATT10ADD:
        LDP         #7
        LACL        DATT10
        ADD            #10
        SACL        DATT10
        SUB         #3000
        BCND        INARN,LEQ
        SPLK        #3000,DATT10    
        RET
          
DATT11ADD:
        LDP         #7
        LACL        DATT11
        ADD            #1
        SACL        DATT11
        SUB         #250
        BCND        INARN,LEQ
        SPLK        #250,DATT11   
        RET
     
DATT12ADD:
        LDP         #7
        LACL        DATT12
        ADD            ADD_SUB
        SACL        DATT12
        SUB         DATT22
        BCND        INARN,LEQ
        LACL        DATT22
        SACL        DATT12      
        RET
  
DATT13ADD:
        LDP         #7
        LACL        DATT13
        ADD            ADD_SUB
        SACL        DATT13
        SUB         DATT23
        BCND        INARN,LEQ 
        LACL        DATT23
        SACL        DATT13      
        RET
      
DATT14ADD:
        LDP         #7
        LACL        DATT14
        ADD            ADD_SUB
        SACL        DATT14
        SUB         DATT24
        BCND        INARN,LEQ 
        LACL        DATT24
        SACL        DATT14    
        RET
         
DATT15ADD:
        LDP         #7
        LACL        DATT15
        ADD            ADD_SUB
        SACL        DATT15
        SUB         DATT25
        BCND        INARN,LEQ
        LACL        DATT25
        SACL        DATT15  
        RET
   
DATT16ADD:
        LDP         #7
        LACL        DATT16
        ADD            ADD_SUB
        SACL        DATT16
        SUB         DATT26
        BCND        INARN,LEQ
        LACL        DATT26
        SACL        DATT16 
        RET
      
DATT17ADD:
        LDP         #7
        LACL        DATT17
        ADD            ADD_SUB
        SACL        DATT17
        SUB         DATT27
        BCND        INARN,LEQ 
        LACL        DATT27
        SACL        DATT17  
        RET
       
DATT18ADD:
        LDP         #7
        LACL        DATT18
        ADD            ADD_SUB
        SACL        DATT18
        SUB         DATT28
        BCND        INARN,LEQ
        LACL        DATT28
        SACL        DATT18 
        RET
    
DATT19ADD:
        LDP         #7
        LACL        DATT19
        ADD            ADD_SUB
        SACL        DATT19
        SUB         DATT29
        BCND        INARN,LEQ 
        LACL        DATT29
        SACL        DATT19 
        RET
      
DA20ADD:
        LDP         #7
        LACL        DA20
        ADD            #1
        SACL        DA20
        SUB         #1100
        BCND        INARN,LT
        SPLK        #1100,DA20   
        RET
DA21ADD:
        LDP         #7
        LACL        DA21
        ADD            #1
        SACL        DA21
        SUB         #9999
        BCND        INARN,LT
        SPLK        #9999,DA21   
        RET          
DATT20ADD:
        LDP         #7
        LACL        DATT20
        ADD            #1
        SACL        DATT20
        SUB         #250
        BCND        INARN,LT
        SPLK        #250,DATT20     
        RET
         
DATT21ADD:
        LDP         #7 
        LACL        CT
        BCND        INAR,NEQ
        LACL        DATT21
        ADD            #1
        SACL        DATT21
        SUB         #100
        BCND        INARN,LEQ
        SPLK        #100,DATT21  
        RET
    
DATT22ADD:
        LDP         #7
        LACL        DATT22
        ADD            ADD_SUB
        SACL        DATT22
        SUB         DAT23
        BCND        INARN,LEQ  
        LACL        DAT23
        SACL        DATT22   
        RET
         
DATT23ADD:
        LDP         #7
        LACL        DATT23
        ADD            ADD_SUB
        SACL        DATT23
        SUB         DAT23
        BCND        INARN,LEQ 
        LACL        DAT23
        SACL        DATT23 
        RET
        
DATT24ADD:
        LDP         #7
        LACL        DATT24
        ADD            ADD_SUB
        SACL        DATT24
        SUB         DAT23
        BCND        INARN,LEQ 
        LACL        DAT23
        SACL        DATT24 
        RET
      
DATT25ADD:
        LDP         #7
        LACL        DATT25
        ADD            ADD_SUB
        SACL        DATT25
        SUB         DAT23
        BCND        INARN,LEQ 
        LACL        DAT23
        SACL        DATT25 
        RET
DATT26ADD:
        LDP         #7
        LACL        DATT26
        ADD            ADD_SUB
        SACL        DATT26
        SUB         DAT23
        BCND        INARN,LEQ 
        LACL        DAT23
        SACL        DATT26 
        RET
             
DATT27ADD:
        LDP         #7
        LACL        DATT27
        ADD            ADD_SUB
        SACL        DATT27
        SUB         DAT23
        BCND        INARN,LEQ 
        LACL        DAT23
        SACL        DATT27 
        RET
          
DATT28ADD:
        LDP         #7
        LACL        DATT28
        ADD            ADD_SUB
        SACL        DATT28
        SUB         DAT23
        BCND        INARN,LEQ 
        LACL        DAT23
       &n

使用特权

评论回复
5
avocationA|  楼主 | 2008-5-22 10:33 | 只看该作者

5

***************RUN********************** 
IND09: 
        LDP         #6 
        BIT         INPAA,15-7
        BCND        IND0A,TC
            
        LDP         #6      
        BIT         S2,15-15
        BCND        CLRC_S2,TC          
        LDP         #7
        LACL        DATT47
        BCND        IND0A,EQ 
        BIT         CT,15-15
        BCND        stop_,TC  ;CLEARFM        
        LDP         #6
        LACL        RUNDLTIME
        ADD         #1
        SACL        RUNDLTIME
        SUB         #2    
        RETC        LT 
RUN:    
        LDP         #6      
        BIT         S2,15-15
        BCND        RUN_END,TC   
        LDP         #7 
        BIT         CT,15-15
        BCND        RUN_END,TC  ;CLEARFM
               
        CALL        SS0
        CALL        WUWEI       ; 
        CALL        STARTSET    
        
        LDP         #7 
        splk        #0,DAT26            
        splk        #0,DAT18   
        LACL        #0   
        SACL        DAT5
        SACL        DAT3
        SACL        INN2         
        SACL        INN3
        SACL        COUNT
        LACC        #BLDCTABLE1
        ADD         #7
        LDP            #234
        TBLR        ATCRB           ;OFF  
        
        LDP         #7           
        LACL        CT
        OR          #08000H
        SACL        CT  
        LDP            #6        
        LACL        CTT0
        OR          #08000H
        SACL        CTT0 
        splk        #0,COUNT12   
        SPLK        #0,IN13 
        SPLK        #200,FMDAT2   
        
        CALL        I2C_W_INT  
                              
RUN_END:
           RET                       
CLRC_S2: 
        LDP         #234           
         BIT         COMCONB,15-8
         BCND        STOP_1,NTC
         SPLK        #08200H,COMCONB 
STOP_1:        
        LDP            #6
        SPLK        #0,S2  
        SPLK        #40,FMDAT2
        RET
************STOP*****************

stop_:    
        LDP         #6   
         SPLK        #0,S2  
         SPLK        #0,IN6 
         SPLK        #50,FMDAT2 
             
STOP:    
        LDP         #7
        BIT         CT,15-15
        BCND        STOP_END,NTC
;        LDP         #4
;        SPLK        #0,LCD_ERR   
;        LDP         #5 
;        SPLK        #0,LCD_CN        
        LDP         #7        
        LACL        #0
        SACL        CT 
        LDP         #6  
          SPLK        #55,IN13            
        SPLK        #0,CTT0
        SPLK        #0,COUNT3 
        SPLK        #0,COUNT5  
        CALL        OFFOUT
STOP_END:        
        RET
INDAT7:   
        LDP         #7  
        LACL        DAT8
        SUB         #22334
        BCND        ENDDAT7,EQ
        LACL        DAT7
        ADD         #1
        SACL        DAT7
        SUB         #30
        BCND        INAR,LT
        SPLK        #22334,DAT8 
;        LDP         #5
;        SPLK        #0,LCD_CN        
        LDP         #6  
        LACL        INNK
        SUB         #6
        BCND        INDAT70,EQ
        SPLK        #0,INK
        SPLK        #0,INNK 
        SPLK        #25,INKK
        SPLK        #100,FMDAT2
        RET
INDAT70:
        SPLK        #7,INNK 
        SPLK        #100,FMDAT2
        RET                                
ENDDAT7: 
        LDP         #6
        LACL        INKK 
        SUB         #24
        BCND        ENDDAT70,NEQ 
        SPLK        #300,FMDAT2 
        SPLK        #50,INK
        SPLK        #1,INNK 
        SPLK        #0,INKK        
;        LDP         #5
;        SPLK        #0,LCD_CN        
;        SPLK        #0,LCD_DASX  
        LDP         #7
        SPLK        #0,DAT8                  
        SPLK        #1000,DA20       ;清除密码989 
        SPLK        #2000,DA21       ;清除密码1875 
        RET
ENDDAT70:
        LDP         #6
        LACL        INNK
        SUB         #9
        BCND        INAR,NEQ
        SPLK        #300,FMDAT2
        SPLK        #6,INNK          
;        LDP         #5
;        SPLK        #0,LCD_CN        
;        SPLK        #0,LCD_DASX  
        LDP         #7
        SPLK        #0,DAT0  
        SPLK        #0,DAT0_ERR
        SPLK        #0,DAT8 
        RET
IND0A: 
        LDP         #6 
        BIT         INPAA,15-6       ;15-6
        BCND        INAR,TC
        SPLK        #40,FMDAT2 
        LDP         #7
        LACL        DAT8
        SUB         #22334
        BCND        INNK_ADD,EQ
        LDP         #6
        LACL         INNK  
        ADD         #1
        SACL        INNK
        SUB         #6
        BCND        IND0A_END,LEQ 
        SPLK        #1,INNK
        RET
IND0A_END:
        SPLK        #0,IN17
        RET  

INNK_ADD:
        LDP         #6  
        LACL        INNK
        SUB         #7
        BCND        INNK_0,LT
        LACL        INNK
        ADD         #1
        SACL        INNK
        SUB         #9
        BCND        INNK_ADD0,LEQ
        SPLK        #7,INNK  
INNK_ADD0:    

        RET
INNK_0: 
        LDP         #6 
        LACL        INKK
        ADD         #1  
        SACL        INKK 
        SUB         #25
        BCND        INNK_0_END,LEQ
        SPLK        #24,INKK
INNK_0_END:
        
        RET
INAR1:   
        LDP         #7      
        CALL        PWM       
        RET                    
INARN:     
        LDP         #0
        LACL        #1234           ; 写24LC16B
        SACL        WRITEDAT 
        LDP         #6
        SPLK        #40,FMDAT2       
;        LDP         #5  
;        SPLK        #0,LCD_DASX  
;        LACL        LCD_CN  
;        SUB         #321
;        BCND        INAR,EQ 
;        LACL        LCD_CN  
;        SUB         #456
;        BCND        INAR,EQ 
;        LACL        LCD_CN  
;        SUB         #789
;        BCND        INAR,EQ         
               
;        SPLK        #0,LCD_CN 
INAR:  
        RET                  

*****************************************************
*****************速度计算**************************** 
OFFOUT: 
        LDP         #7  
        SPLK        #0,DAT10  
        SPLK        #0,INN1  
        LACC        #BLDCTABLE1
        ADD         #7
        LDP            #234
        TBLR        ATCRB           ;OFF 
        RET
********************************************        
*******************DAT21SET*****************
   
*同步起动转速设置:                              

DAT21SET:
        LDP          #7  
        LACL         DATT0
        SUB          #1
        BCND         DAT21SET1_1,EQ
        SUB          #1
        BCND         DAT21SET1_2,EQ  
        SUB          #1
        BCND         DAT21SET1_3,EQ 
        SUB          #1
        BCND         DAT21SET1_4,GEQ    
        RET   
DAT21SET1_1:
         LDP          #7
         LACL         DATT41
         SACL         DAT21 ;1#类电机-1#转头同步起动初始转速设置         
         RET
DAT21SET1_2: 
         LDP          #7
         LACL         DATT42
         SACL         DAT21 ;1#类电机-2#转头同步起动初始转速设置
         RET
DAT21SET1_3: 
         LDP          #7
         LACL         DATT43
         SACL         DAT21 ;1#类电机-3#转头同步起动初始转速设置
         RET
DAT21SET1_4 
         LDP          #7
         LACL         DATT44 
         SACL         DAT21 ;1#类电机-4#转头同步起动初始转速设置
         RET

使用特权

评论回复
6
avocationA|  楼主 | 2008-5-22 10:33 | 只看该作者

5

************************************************        
****************STARTSET************************

*起动电流设置: 
                               
STARTSET:  
        LDP          #7
        LACC         DATT10,1
        ADD          DATT10
        SACL         IMAX
        LACL         DATT5
        SACL         DAT28 
        RET

***************************************** 
*                                       *  
********     系统中断程序     *********** 
*                                       *
*****************************************
                                         
***************CAP中断*******************        
CAPINT:
        MAR        *,AR4               ;AR4保存现场
        SST        #1,*+               ;保存ST1
        SST        #0,*+               ;保存ST0
        SACH       *+                  ;保存ACC高16位
        SACL       *                   ;保存ACC低16位  
        LDP         #7   
        LACL        DATT30
        SUB         #111
        BCND        CAPINT1,NEQ                  
        CALL        PWM
CAPINT1:LDP         #232          ;CAPINT中断返回
        SPLK        #0007H,EVAIFRC ;清中断标志 
        MAR         *, AR4               ;AR4恢复现场
        LACL        *-
        ADDH        *-
        LST         #0,*- 
        LST         #1,* 
        CLRC        INTM                 ;开中断
        RET                                         
******************有位置PWM驱动****************** 

PWM:    
        LDP         #225       ; 
        LACL        PADATDIR         
        CMPL
        AND         #0038H  
        LDP         #7 
        SACL        DAT12         
        LACC        DAT12,13
        SACH        DAT11    
        LACL        DAT11  
        BCND        PWM1,EQ
        SUB         #07H
        BCND        PWM1,EQ
        LACL        DAT14        ; SPEED
        ADD         #5           ;
        SACL        DAT14        ;
        LDP         #6
        LACL        COUNT1        ;读时间T1H0
        SACL        T1H0
        LACL        NM1
        ADD         #1
        SACL        NM1  
        LDP         #7    
        BIT         CT,15-15 
        BCND        PWM0,NTC
        LACC        #BLDCTABLE
        ADD         DAT11
        LDP            #234
        TBLR        ATCRB  
PWM0:        
        RET
PWM1:   
        LDP            #7   
        SPLK        #0,DAT11           ;OFF
        LACC        #BLDCTABLE
        ADD         DAT11
        LDP            #234
        TBLR        ATCRB             
        LDP         #6   
        LACL        S3
        ADD         #1
        SACL        S3
        SUB         #5
        BCND        PWM2,LT
        LDP         #7
        LACL        CT
        AND         #03H
        SACL        CT
        LDP         #6
        SPLK        #0,CTT0    
        LACL        S2
        OR          #08040H
        SACL        S2                  
PWM2:        
        RET                            
************************************************        
        
****************** SPI中断**********************     

SPIINT:
        MAR         *,AR4               ;AR4保存现场
        SST         #1,*+               ;保存ST1
        SST         #0,*+               ;保存ST0
        SACH        *+                  ;保存ACC高16位
        SACL        *                   ;保存ACC低16位  
         
        LDP         #224
        LACL        PIVR
        SUB         #040H 
        BCND        CANRT_INT,EQ               
        LDP         #224
        LACL        SPIBUF
        MAR         *,AR7
        LACL        *+,AR6
        BANZ        PPA1,AR7
        LDP         #224
        SPLK        #06H,SPICTL
        B           PPA2
PPA1:    SACL        SPITXBUF
PPA2:
        MAR         *,AR4               ;AR4恢复现场
        LACL        *-
        ADDH        *-
        LST         #0,*- 
        LST         #1,* 
        CLRC        INTM                 ;开中断
        RET  
********************************************                                        
CANRT_INT:  

        LDP           #4
        SPLK        #01h,CANF_CNT     
        LDP           #226
        SPLK        #01000h,TCR                        

        MAR         *,AR4               ;AR4恢复现场
        LACL        *-
        ADDH        *-
        LST         #0,*- 
        LST         #1,*
        CLRC        INTM                 ;开中断
        RET                                 
        
**********    T1中断主程序    **************    

ADC_INT:
        MAR         *,AR4               ;AR4保存现场
        SST         #1,*+               ;保存ST1
        SST         #0,*+               ;保存ST0
        SACH        *+                  ;保存ACC高16位
        SACL        *                   ;保存ACC低16位 
        
        LDP         #224
        LACL        PIVR
        SUB         #019H 
        BCND        PDPNBINT,EQ        
        
        LDP         #4
        SPLK        #1,SETH
           
        LDP         #6
        LACL        COUNT2
        ADD         #1
        SACL        COUNT2
        SUB         #200            ;200*10US=2MS
        BCND        AD_1,LT         ;AD 
        SPLK        #0,COUNT2
        SPLK        #1,S1    
        LDP         #7
        LACL        DAT13
        ADD         #1
        SACL        DAT13
        SUB         #500            ;#500
        BCND        AD_1,LT 
        SPLK        #0,DAT13 
        
        CALL        DD0
AD_1:        
        LDP         #225    
        LACC        RESULT0,14
        LDP         #7
        SACH        V_A          ;V_A  
        LDP         #225
        LACC        RESULT1,14     ; 
        LDP         #7
        SACH        V_B          ;V_B 
        LDP         #225
        LACC        RESULT2,14
        LDP         #7
        SACH        V_C          ;V_C 
        LDP         #225
        LACC        RESULT8,12   ;12
        LDP         #7
        SACH        ID0          ; 
        LDP         #225 
        LACC        RESULT10,16
        LDP         #7
        SACH        V_MAX

        LDP         #7 
        BIT         CT,15-15
        BCND        TTD0,NTC 
        LACC           ID0,2
        SUB         IMAX  
        BCND        TTD0,LT  
        LACL        CONT0
        ADD         #1
        SACL        CONT0
        SUB         DATT37  
        BCND        TTD1,LT
        SPLK        #0,CONT0
        
        CALL        IDDGL
                
        B           TR
TTD0:    
        LDP         #7
        SPLK        #0,CONT0                          
TTD1:                
        LDP         #7       ;
        LACC        V_A   
        ADD         V_B
        ADD         V_C  
        SACL        V_M     

        LDP         #6
        LACL        IN11
        SUB         #1111
        BCND        TR,EQ
        
        LDP         #7
        LACL        DAT20      ;计数
        ADD         #1
        SACL        DAT20 
          
        LDP         #7 
        LACL        DATT21
        BCND        SHZH,GT
        LACL        DAT16  
        SUB         #1          ;1
        BCND        JBDW,EQ   
        SUB         #1          ;2
        BCND        JAUP,EQ
        SUB         #1          ;3
        BCND        JCDW,EQ      
        SUB         #1          ;4
        BCND        JBUP,EQ 
        SUB         #1          ;5
        BCND        JADW,EQ 
        SUB         #1          ;6
        BCND        JCUP,EQ
        B           TR
SHZH:                                    
        LDP         #7         
        LACL        DAT16  
        SUB         #1          ;1
        BCND        JBUP,EQ   
        SUB         #1          ;2
        BCND        JADW,EQ
        SUB         #1          ;3
        BCND        JCUP,EQ      
        SUB         #1          ;4
        BCND        JBDW,EQ 
        SUB         #1          ;5
        BCND        JAUP,EQ 
        SUB         #1          ;6
        BCND        JCDW,EQ
        B           TR
***************************        
JADW:   
        LDP         #7    
        BIT         CT,15-1
        BCND        JADW1,NTC
        LACC        V_A,1
        ADD         V_A
        SUB         V_M
        BCND        JM0,GT  
JADW1:        
        CALL        DEL      
        B           TR0      
***************************            
JAUP:                     
        LDP         #7    
        SPLK        #999,DN0   
        BIT         CT,15-1
        BCND        JAUP1,NTC
        LACC        V_A,1
        ADD         V_A
        SUB         V_M
        BCND        JM0,LT  
JAUP1:        
        CALL        DEL     
        B           TR0  
***************************                
JBDW:    
        LDP         #7    
        BIT         CT,15-1
        BCND        JBDW1,NTC
        LACC        V_B,1
        ADD         V_B
        SUB         V_M
        BCND        JM0,GT 
JBDW1:          
        CALL        DEL   
        B           TR0     
***************************        
JBUP:    
        LDP         #7    
        BIT         CT,15-1
        BCND        JBUP1,NTC
        LACC        V_B,1
        ADD         V_B
        SUB         V_M
        BCND        JM0,LT 
JBUP1:         
        CALL        DEL   
        B           TR0    
***************************
JCDW:    
        CALL        JM03
        LDP         #7     
        BIT         CT,15-1
        BCND        JCDW1,NTC
        LACC        V_C,1
        ADD         V_C
        SUB         V_M
        BCND        JM0,GT 
JCDW1:        
        CALL        DEL   
        B           TR0          
***************************        
JCUP:    
        LDP         #7     
        BIT         CT,15-1
        BCND        JCUP1,NTC
        LACC        V_C,1
        ADD         V_C
        SUB         V_M
        BCND        JM0,LT  
JCUP1:        
        CALL        DEL   
        B           TR0    
           
***************************   
     
JM0:             
        LDP         #7
        SPLK        #0,DAT9
        B           TR
TR0:
        LDP         #7  
        LACL        DN
        SUB         #777
        BCND        TR,NEQ   
        LACL        TR0_TIMER
        SUB         #1
        SACL        TR0_TIMER  
        BCND        TR,GT   
        SPLK        #0,DN  
        SPLK        #0,DAT9  
        LDP         #7
        LACL        DAT32
        SUB         #222
        BCND        TR,NEQ    
            
        CALL        START   
        
        LDP         #7    
        BIT         CT,15-0
        BCND        TR,TC    
        BIT         CT,15-2
        BCND        TR1,NTC                    
        LACL        DAT21
        SUB         #5
        SACL        DAT21
        SUB         DAT25
        BCND        TR,GT   
        LDP         #7    
        LACL        CT 
        OR          #01H
        SACL        CT     
        B            TR
TR1:    LDP         #7 
        LACL        DAT18
        SUB         #750
        BCND        TR,LT
        LACL        DAT21
        SUB         #50
        SACL        DAT21 
        SUB         #1500
        BCND        TR,GT   
        SPLK        #1500,DAT21
TR:     
        LDP         #225 
        LACL        ADCTRL2 
        OR          #0060H
        LDP         #7
        BIT         CT,15-15
        BCND        TR_1,TC
        OR          #04000H              ;#04000H
TR_1:        
        LDP         #225           
        SACL        ADCTRL2                 ;  
         
        CALL        REST_18B20
          
        MAR         *,AR4               ;AR4恢复现场
        LACL        *-
        ADDH        *-
        LST         #0,*- 
        LST         #1,* 
        CLRC        INTM                 ;开中断
        RET                                  

***********************************************             
PDPNBINT:
        LDP         #7  
        SPLK        #0,CT                 
        LDP         #6  
        LACL        S2
        OR          #08080H
        SACL        S2
        
        LDP         #234                 
        SPLK        #01H,EVBIFRA        ;清中断标志 
          
        MAR         *,AR4               ;AR4恢复现场
        LACL        *-
        ADDH        *-
        LST         #0,*- 
        LST         #1,*
        CLRC        INTM                 ;开中断
        RET                                          
            
******************************************************** 
*                   T1中断子程序                       *
***************       DAT21     ********************** 
JM03:    
        LDP         #7    
        LACL        DN0
        SUB         #999
        BCND        JM3_1,NEQ
        SPLK        #0,DN0      
        LDP         #234
        LACL        T4CNT
        SPLK        #0,T4CNT
        LDP         #7
        SACL        SP_TIME0   
        SPLK        #1,SPD_CNT      
        LDP         #7    
        LACC        DAT20 
        SPLK        #0,DAT20
        SPLK        #12,TEMPP        ; 12
        RPT         #15
        SUBC        TEMPP
        BIT         CT,15-0
        BCND        JM3_1,NTC 
        SACL        DAT21      
JM3_1:        
        RET                    
        
******************延迟子程序*********************
      
DEL: 
        LDP         #7     
        LACL        DN
        SUB         #777
        BCND        DEL3,EQ
        LACL        DAT21
        SUB         #15             ;#15
        BCND        DEL1,GT
        LACL        DAT21
        SUB         #2              ;#2
        SACL        DEL_TIMER
        B           DEL2
DEL1:   
        SPLK        #13,DEL_TIMER    ;#13
DEL2:   
         LACL        DAT9
        ADD         #1
        SACL        DAT9  
        SUB         DEL_TIMER
        BCND        DEL3,LT    
        SPLK        #0,DAT9
        SPLK        #777,DN     
        LACL        DAT21
        SUB         DEL_TIMER 
        SACL        TR0_TIMER
DEL3:   RET                           

***************位置计数子程序******************    
    
START:   LDP         #7  
         LACL       DATT21
         BCND       START0,GT
         LACL        DAT16
         SUB         #1
         SACL        DAT16 
          BCND        START1,GT
         SPLK        #6,DAT16  
         B          START1
START0:  LDP         #7
         LACL        DAT16
         ADD         #1
         SACL        DAT16 
         SUB         #6        
          BCND        START1,LEQ
         SPLK        #1,DAT16            
START1:    
        LDP         #7     
        LACL        DAT14        ; 测速计数  
        LDP         #4 
        ADD         SPEED_XS     ;    
        LDP         #7 
        SACL        DAT14        ;     
        BIT         CT,15-15
        BCND        START2,NTC
        LACC        #BLDCTABLE1
        ADD         DAT16
        LDP            #234
        TBLR        ATCRB         
START2:        
        RET 
********************************************                  
 
***************************

使用特权

评论回复
7
avocationA|  楼主 | 2008-5-22 10:34 | 只看该作者

6

***************BLDC导通码***********************  
      
*下调制有位置正转码*  
      
BLDCTABLE:
        .word  00333H,00403H,00340H,00043H ;反
        .word  00034H,00430H,00304H,00333H 
        
*下调制无位置正转码* 

BLDCTABLE1:
        .word  00343H,00403H,00430H,00034H 
        .word  00304H,00340H,00043H,00000H
        .word  00CCCH     
******************************************************************************
PDATTXXX:
         .word     PDAT3,PDATT12,PDATT13,PDATT14,PDATT15,PDATT16, PDATT17, PDATT18,PDATT19,  PDA20,PDATT22
         .word   PDATT23,PDATT24,PDATT25,PDATT26,PDATT27,PDATT28, PDATT29,   PDA21, PDATT5, PDATT6 
         .word    PDATT7, PDATT8, PDATT9,PDATT10, PV_MAX,PDATT11, PDATT20, PDATT30,PDATT31,PDATT32
         .word   PDATT33,PDATT34,PDATT35,PDATT36,PDATT37,PDATT38, PDATT39, PDATT40,PDATT41,PDATT42
         .word   PDATT43,PDATT44,PDATT45,PDATT46,PDATT47,PDATT21,PDAT21  ,PSPEEDA ,   PIN7,   PIN5  
         .word   PVA,PVB,PVC,PVM,PIDD,PCAN1,PCAN2,PCAN3,PCAN4,PCAN5,PCAN5,PCAN5,PCAN5,PCAN5,PCAN5
DATTADDX:
         .word   DATT47ADD,DATT12ADD,DATT13ADD,DATT14ADD,DATT15ADD,DATT16ADD,DATT17ADD,DATT18ADD,DATT19ADD, DA20ADD,DATT22ADD
         .word   DATT23ADD,DATT24ADD,DATT25ADD,DATT26ADD,DATT27ADD,DATT28ADD,DATT29ADD,  DA21ADD, DATT5ADD, DATT6ADD 
         .word    DATT7ADD, DATT8ADD, DATT9ADD,DATT10ADD,ADDEND  ,DATT11ADD,DATT20ADD,DATT30ADD,DATT31ADD,DATT32ADD
         .word   DATT33ADD,DATT34ADD,DATT35ADD,DATT36ADD,DATT37ADD,DATT38ADD,DATT39ADD,DATT40ADD,DATT41ADD,DATT42ADD
         .word   DATT43ADD,DATT44ADD,DATT45ADD,DATT46ADD,ADDEND  ,DATT21ADD,ADDEND  ,ADDEND  ,ADDEND  ,ADDEND
         .word      ADDEND,ADDEND,ADDEND,ADDEND,ADDEND,ADDEND,ADDEND,ADDEND,ADDEND,ADDEND,ADDEND,ADDEND,ADDEND,ADDEND  
DATTSUBX:
         .word   DATT47SUB,DATT12SUB,DATT13SUB,DATT14SUB,DATT15SUB,DATT16SUB,DATT17SUB,DATT18SUB,DATT19SUB, DA20SUB,DATT22SUB
         .word   DATT23SUB,DATT24SUB,DATT25SUB,DATT26SUB,DATT27SUB,DATT28SUB,DATT29SUB,  DA21SUB, DATT5SUB, DATT6SUB 
         .word    DATT7SUB, DATT8SUB, DATT9SUB,DATT10SUB,SUBEND  ,DATT11SUB,DATT20SUB,DATT30SUB,DATT31SUB,DATT32SUB
         .word   DATT33SUB,DATT34SUB,DATT35SUB,DATT36SUB,DATT37SUB,DATT38SUB,DATT39SUB,DATT40SUB,DATT41SUB,DATT42SUB
         .word   DATT43SUB,DATT44SUB,DATT45SUB,DATT46SUB,SUBEND  ,DATT21SUB,SUBEND  ,SUBEND  ,SUBEND  ,SUBEND  
         .word      SUBEND,SUBEND,SUBEND,SUBEND,SUBEND,SUBEND,SUBEND,SUBEND,SUBEND,SUBEND,SUBEND,SUBEND,SUBEND,SUBEND
******************************************************************************
         .end

使用特权

评论回复
8
MicroMMU| | 2008-5-23 13:09 | 只看该作者

贴出来的目的是什么?

我认为是垃圾.
有什么意思,你是不是在告诉人家,你很N

使用特权

评论回复
9
avocationA|  楼主 | 2008-5-23 14:50 | 只看该作者

lou上的那请你贴出你认为不垃圾的代码

使用特权

评论回复
10
y1234567| | 2010-8-2 18:16 | 只看该作者
多谢分享,要是能把思路说出来,大家更易理解

使用特权

评论回复
11
kubuco| | 2010-8-5 22:14 | 只看该作者
汇编  浪费。

使用特权

评论回复
12
zj1| | 2010-8-13 17:01 | 只看该作者
谢谢你的无私奉献。不知道能否说一下你的思路,让大家理解?

使用特权

评论回复
13
lionpann| | 2010-8-15 11:19 | 只看该作者
汇编太难理解了     谁来贴一个C的  便于大家学习

使用特权

评论回复
14
wolf_heart| | 2010-9-27 16:48 | 只看该作者
写个流程图+算法方程说明,谢谢

使用特权

评论回复
15
apple| | 2010-9-30 15:21 | 只看该作者
去年用DSPIC30F3011做了一款变频器, 把人家原来用的80196做的, 反编译出来再用C来写.

使用特权

评论回复
16
itelectron| | 2010-9-30 22:34 | 只看该作者
反汇编是正道:victory:
要资源就靠反汇编呵呵!

使用特权

评论回复
17
jack_shine| | 2010-10-16 17:36 | 只看该作者
看着吃力呀~~~

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

123

主题

935

帖子

0

粉丝