您当前的位置:五五电子网电子知识单片机-工控设备义隆单片机em78p153大功率轮廓灯跳机同步4回路程序 正文
em78p153大功率轮廓灯跳机同步4回路程序

em78p153大功率轮廓灯跳机同步4回路程序

点击数:7460 次   录入时间:03-04 11:44:18   整理:http://www.55dianzi.com   义隆单片机
  MOV  tcount2,a
;;;;;;;;;;;;;;;;;;;;;;;;;;
 djz tcount1    ;tcount1表示节拍
 jmp intext21
 
 bs  stflag,7
 inc tcount1      ;重置查表标志

/*;;;;;;;;;;;;;;;;;;;;;;;;;
;tcount1!=tcount3
;;;;;;;;;;;;;;;;;;;;;;;;;
intext25:
  MOV  a,tcount1
 sub a,tcount3
 jbc status,c   ;若为1则无借位,tcount1>tcount3
 jmp intext27
  MOV  temp3,a   ;差放入temp3中
 inc temp3
 inc temp3
  MOV  a,tcount3
  MOV  temp,a
intext28:
 call delay100u   ;第一波廷时
 djz temp
 jmp intext28
  MOV  a,code2   ;先输出code2,即处于消暗的代码
  MOV  port5,a
intext29:
 call delay100u
 djz temp3
 jmp intext29
  MOV  a,code   ;再输出code,即处于上涨的代码
  MOV  port5,a
 jmp intext21
 
intext27:
  MOV  a,tcount3
 sub a,tcount1
  MOV  temp3,a
 inc temp3
 inc temp3
  MOV  a,tcount1
  MOV  temp,a
intext30:
 call delay100u
 djz temp
 jmp intext30
  MOV  a,code   ;输出code,即处于上涨的代码
  MOV  port5,a
intext31: 
 call delay100u
 djz temp3
 jmp intext31
  MOV  a,code2   ;输出code2,即处于消暗的代码
  MOV  port5,a
;;;;;;;;;;;;;;;;;;;;;;;;;;;*/ 
;龙图开发网 http://www.longtoo.com   原创,转载请注明出处

intext21:
 jbs code,7    ;判断是渐亮还时渐灭
 jmp intext22    ;这里是亮度变化趋势区分点
 
  MOV  a,tcount1      ;code,7为1,则亮度渐亮
  MOV  temp,a
intext23:
 call delay100u   ;这是个定长廷时子程序,如能用定时器会更好

,那有可能利于加上按健功能
 djz temp
 jmp intext23
  MOV  a,code      ;输出已准备好的代码
  MOV  port5,a     ;
 jmp intend
 
intext22:
  MOV  a,tcount1         ;亮度为渐暗
 add a,@91    ;与160对应产生不过0的廷时
  MOV  temp,a
 com temp      ;得到渐暗方式的代码
intext24:
 call delay100u
 djz temp
 jmp intext24 
  MOV  a,code
  MOV  port5,a
 call delay100u
 call delay100u 

intend:
  MOV  a,a_temp
 clr isr    ;这一指令不能少
 reti
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;
spmode1:
 add pc,a
 retl 10
 retl 10
 retl 20
 retl 30
 retl 60
 
tbmode1:     ;跑马1的
 add pc,a
 retl 0b00000000 ;4
 retl 0b00001000
 retl 0b00000100
 retl 0b00000010
 retl 0b00000001
 
tbmode2:
 add pc,a
 retl 0b00000000 ;32
 
 retl 0b00000001
 retl 0b00000001
 retl 0b00001001
 retl 0b00001101
 retl 0b00001111
 retl 0b00001111
 retl 0b00001110
 retl 0b00000110
 
 retl 0b00000010
 retl 0b00000010
 retl 0b00000011
 retl 0b00001011
 retl 0b00001111
 retl 0b00001111
 retl 0b00001101
 retl 0b00001100
 
 retl 0b00000100
 retl 0b00000100
 retl 0b00000110
 retl 0b00000111
 retl 0b00001111
 retl 0b00001111
 retl 0b00001011
 retl 0b00001001
 
 retl 0b00001000
 retl 0b00001000
 retl 0b00001100
 retl 0b00001110
 retl 0b00001111
 retl 0b00001111
 retl 0b00000111
 retl 0b00000011
 retl 0b00000001
 
spmode4:
 add pc,a
 retl 1
 retl 1
 retl 1
 retl 1
 retl 1
 
tbmode3:
 add pc,a
 retl 0b00000000 ;8
 
 retl 0b00001100
 retl 0b10001100
 
 retl 0b00000110
 retl 0b10000110
 
 retl 0b00000011
 retl 0b10000011
 
 retl 0b00001001
 retl 0b10001001
 
tbmode4:
 add pc,a
 retl 0b00000000 ;6
 retl 0b00001111
 retl 0b10001111
 retl 0b00000000
 retl 0b00001111
 retl 0b10001111

tbmode5:
 add pc,a
 retl 0b00000000
 retl 0b00001001
 retl 0b00000011
 retl 0b00000110
 retl 0b00001100
 retl 0b00001001
 retl 0b00000011
 retl 0b00000110
 retl 0b00000011
 retl 0b00001001
 retl 0b00001100
 retl 0b00000110
 retl 0b00000011

;龙图开发网 http://www.longtoo.com   原创,转载请注明出处

 org 0x100
main:
 clr lamp
  MOV  a,@0xf0 ;设置PORT5
 iow ioc5
 clr port5
  MOV  a,@0xf0
 iow iocb
  MOV  a,@0b11111101 ;设置PORT6.
 iow ioc6
  MOV  a,@0x02  ;P6口上拉
 iow iocd
 
  MOV  a,port6 ;读入P6口的拔码开关值
 nop
  MOV  a,port6
  MOV  spcode,a
 rlc spcode  ;把高2位左移到低2位
 rlc spcode
 rlc spcode
  MOV  a,@0x03 ;屏蔽高6位
 and spcode,a   ;保存速度代码,这个代码是公用的
 

init: 
  MOV  a,@04 ;开外部中断
 iow iocf
  MOV  a,@0x40
 iow ioce
 eni    ;开总中断
 ;jmp mode4
 
;;;;;;;;;;;;;;;;;;;;;;;;;;
;跑马1,单灯跑马
;;;;;;;;;;;;;;;;;;;;;;;;;;
mode1:
 clr ifdrim
  MOV  a,@10+5
  MOV  count2,a     ;COUNT2决定这一模式总循环次数
 
  MOV  a,spcode     ;根据开关代码查到它对应的值
 call spmode1
  MOV  tick,a    ;这里可以省去tick2了,40/80/120/160
 
mode13:
 bc stflag,0   ;表示不梦幻
  MOV  a,@04  
  MOV  chtb,a   
mode12:
  MOV  a,chtb
 call tbmode1   ;跑马1的代码表。

上一页  [1] [2] [3]  下一页


本文关键字:程序  义隆单片机单片机-工控设备 - 义隆单片机