用单片机控制的12V镇流器,源码公开
采用HT MCU控制的PL13W镇流器,源码稍后公开.500) {this.resized=true; this.width=500; this.alt='这是一张缩略图,点击可放大。\n按住CTRL,滚动鼠标滚轮可自由缩放';this.style.cursor='hand'}" onclick="if(!this.resized) {return true;} else {window.open('http://u.dianyuan.com/bbs/u/48/1166675262.jpg?x-oss-process=image/watermark,g_center,image_YXJ0aWNsZS9wdWJsaWMvd2F0ZXJtYXJrLnBuZz94LW9zcy1wcm9jZXNzPWltYWdlL3Jlc2l6ZSxQXzQwCg,t_20');}" onmousewheel="return imgzoom(this);">
全部回复(13)
正序查看
倒序查看
现在还没有回复呢,说说你的想法
@miky1188
工作原理:上电复位---预热---22KHz工作.MCUPIN11(PB5)为控制信号输入脚,低电平有效;可接CDS光敏电阻或其它设备的输出信号达到自动控制的目的.
INCLUDE HT48RA0A.INC
DATA .SECTION AT 20H 'DATA'
;------------------------------------------------
counter0 db ?
counter1 db ?
keycount db ?
keystatus db ?
;------------------------------------------------
CODE .SECTION
ORG 00H
Jmp initial
;------------------------------------------------
ORG 010H
Initial: ;淸除所有的資料記憶體從20H至3FH
mov A,20H
mov MP,A
jmp clramloop
clramloop:
clr R0
inc MP
mov A,0BFH
sub A,MP
sz STATUS.0
jmp clramloop ;MP0<3FH 跳轉至clramloop
;------------------------------------------------
;------------------------------------------------
; -- 主程式 --
;------------------------------------------------
initial_mode:
clr keycount
mov A,00000011B ;設置PA0 和PA1 輸出為″1″
mov PA,A
mov A,00000000B ;
mov PC,A
;------------------------------------------------
mov A,0E0H;
mov counter1,A ;100×256×32=第一次點火時間
;(4MHz=E0H=0.8 秒)
;................................................
;................................................
sign_test:
sz keystatus.0 ;檢測PB5引腳準位
jmp ignite ;如果PB5準位爲低,點亮燈管
call delay_46
call delay_46
sz PB5
jmp clr_sign
inc keycount
mov A,0FAH
sub A,keycount
sz status.0
jmp sign_test
set keystatus.0 ;
jmp sign_test
clr_sign:
clr keycount
mov A,00000011B ;設置PA0 和PA1 輸出為″1″
jmp sign_test
;................................................
ignite:
clr keycount
call ignite_sub ;點火模式:第一次子程式
;
mov A,0FCH ;4MHz=FCH=0.1秒
mov counter1,A ;110×256×4=第二次點火時間
ignite_se: ;點火模式:第二次
mov A,00000001b
clr pa
mov PA,A
call delay_46
nop
nop
nop
nop
;..
mov A,00000010b
clr pa
mov PA,A
call delay_46
nop
siz counter0
jmp ignite_se
siz counter1
jmp ignite_se
;................................................
run_mode: ;運作模式:固定頻率在22kHz
mov A,00000001b
clr pa
mov PA,A
call delay_run
snz keystatus.0 ;
jmp initial_mode ;PB5爲高準位,熄滅燈管
;.......
mov A,00000010b
clr pa
mov PA,A
call delay_run
jmp run_mode
;--------------------------------------------------
; -- 子程式 --
;--------------------------------------------------
;delay_run:
clr wdt
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
ret
;
delay_run:
clr wdt
snz PB5 ;檢測PB5引腳準位
jmp delay_run1 ;如果PB5準位爲高,熄滅燈管
inc keycount
mov A,0FAH
sub A,keycount
sz status.0
jmp delay_run2
clr keystatus.0
jmp delay_run3
delay_run1:
nop
jmp $+1
jmp $+1
delay_run2:
jmp $+1
delay_run3:
jmp $+1
ret
delay_46:
clr wdt
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
nop
ret
;--------------------------------------------------
; -- 子程式 --
;--------------------------------------------------
ignite_sub:
mov A,00000001b
mov PA,A
;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;
mov A,00000010b
mov PA,A
;.......
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;.......
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;.....
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;.....
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
clr wdt
siz counter0
jmp ignite_sub
siz counter1
jmp ignite_sub
clr pa
;..................................
ret
end
DATA .SECTION AT 20H 'DATA'
;------------------------------------------------
counter0 db ?
counter1 db ?
keycount db ?
keystatus db ?
;------------------------------------------------
CODE .SECTION
ORG 00H
Jmp initial
;------------------------------------------------
ORG 010H
Initial: ;淸除所有的資料記憶體從20H至3FH
mov A,20H
mov MP,A
jmp clramloop
clramloop:
clr R0
inc MP
mov A,0BFH
sub A,MP
sz STATUS.0
jmp clramloop ;MP0<3FH 跳轉至clramloop
;------------------------------------------------
;------------------------------------------------
; -- 主程式 --
;------------------------------------------------
initial_mode:
clr keycount
mov A,00000011B ;設置PA0 和PA1 輸出為″1″
mov PA,A
mov A,00000000B ;
mov PC,A
;------------------------------------------------
mov A,0E0H;
mov counter1,A ;100×256×32=第一次點火時間
;(4MHz=E0H=0.8 秒)
;................................................
;................................................
sign_test:
sz keystatus.0 ;檢測PB5引腳準位
jmp ignite ;如果PB5準位爲低,點亮燈管
call delay_46
call delay_46
sz PB5
jmp clr_sign
inc keycount
mov A,0FAH
sub A,keycount
sz status.0
jmp sign_test
set keystatus.0 ;
jmp sign_test
clr_sign:
clr keycount
mov A,00000011B ;設置PA0 和PA1 輸出為″1″
jmp sign_test
;................................................
ignite:
clr keycount
call ignite_sub ;點火模式:第一次子程式
;
mov A,0FCH ;4MHz=FCH=0.1秒
mov counter1,A ;110×256×4=第二次點火時間
ignite_se: ;點火模式:第二次
mov A,00000001b
clr pa
mov PA,A
call delay_46
nop
nop
nop
nop
;..
mov A,00000010b
clr pa
mov PA,A
call delay_46
nop
siz counter0
jmp ignite_se
siz counter1
jmp ignite_se
;................................................
run_mode: ;運作模式:固定頻率在22kHz
mov A,00000001b
clr pa
mov PA,A
call delay_run
snz keystatus.0 ;
jmp initial_mode ;PB5爲高準位,熄滅燈管
;.......
mov A,00000010b
clr pa
mov PA,A
call delay_run
jmp run_mode
;--------------------------------------------------
; -- 子程式 --
;--------------------------------------------------
;delay_run:
clr wdt
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
ret
;
delay_run:
clr wdt
snz PB5 ;檢測PB5引腳準位
jmp delay_run1 ;如果PB5準位爲高,熄滅燈管
inc keycount
mov A,0FAH
sub A,keycount
sz status.0
jmp delay_run2
clr keystatus.0
jmp delay_run3
delay_run1:
nop
jmp $+1
jmp $+1
delay_run2:
jmp $+1
delay_run3:
jmp $+1
ret
delay_46:
clr wdt
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
jmp $+1
nop
ret
;--------------------------------------------------
; -- 子程式 --
;--------------------------------------------------
ignite_sub:
mov A,00000001b
mov PA,A
;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;
mov A,00000010b
mov PA,A
;.......
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;.......
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;.....
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;.....
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
;..
mov A,00000001b
mov PA,A
;;
mov A,00000010b
mov PA,A
clr wdt
siz counter0
jmp ignite_sub
siz counter1
jmp ignite_sub
clr pa
;..................................
ret
end
0
回复
提示
@miky1188
[图片]500){this.resized=true;this.width=500;this.alt='这是一张缩略图,点击可放大。\n按住CTRL,滚动鼠标滚轮可自由缩放';this.style.cursor='hand'}"onclick="if(!this.resized){returntrue;}else{window.open('http://u.dianyuan.com/bbs/u/48/1166679750.jpg');}"onmousewheel="returnimgzoom(this);">
好!非常好!如果把异常保护加上去,产品的可行性更高;我正想用PIC12系列产品DIP-8的单片机来控制,希望大家提建议.
0
回复
提示
@miky1188
INCLUDEHT48RA0A.INCDATA .SECTION AT20H 'DATA';------------------------------------------------counter0db?counter1db?keycountdb?keystatusdb ?;------------------------------------------------CODE .SECTION ORG00H Jmpinitial;------------------------------------------------ ORG010HInitial: ;淸除所有的資料記憶體從20H至3FH movA,20H movMP,A jmpclramloopclramloop: clrR0 incMP movA,0BFH subA,MP szSTATUS.0 jmpclramloop;MP0
循环的语句为什么写那么长?几句就可以代替你的几十句啊!
0
回复
提示