5892|3

3

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

燃烧器火焰探测和控制 [复制链接]

有个程序,实在看不懂,哪位帮忙看下,帮我详细解释解释
'(
故障代码:
E0:燃气泄露
E1:风机
E2:点火器
E3:小火电磁阀(v1)
E4:大火电磁阀(v2)
E5:残火
E6:燃气超压
E7:意外熄火(保留)
E8:点火失败
E9:漏电
F1:火焰检测线对地短路(保留)
运行代码:
Aa:风机预扫和系统自检
00:正常燃烧
Cc:手动状态 (保留)
')

$regfile = "m16def.dat"
$crystal = 4000000

Ddra = &B000000111
Porta = &B11110110

Ddrb = &B11111111
Portb = &B00000000

Ddrc = &B11011110
Portc = &B00111101

Ddrd = &B00000011
Portd = &B00111100

'/**************************************************************
Config Timer0 = Timer , Prescale = 1024
Enable Timer0
On Ovf0 6s
Tcnt0 = &H06
'/==============================================================
'Config Timer1 = Timer , Prescale = 1024
'Enable Timer1
'On Ovf1 miao
'Timer1 = &H06
'/==============================================================
Config Timer2 = Timer , Prescale = 1024
Enable Timer2
Enable Interrupts
On Ovf2 Led_display
Tcnt2 = &H190
'/==============================================================
Config Adc = Single , Prescaler = Auto , Reference = Avcc
'/**************************************************************
Dim Dh_time As Byte , Dh_isr As Byte '点火相关

Dim Fans_isr As Byte '风机相关

Dim Lou_dian As Word '漏电相关

Dim D_h_q As Byte '点火器相关

Dim Xie_lou As Word '燃气泄露

Dim B As Byte

Dim E_e As Byte

Dim Dh As Word

Dim Fans As Word : Fans = 0

Dim Yu_sao As Word

Dim F_m As Byte '/buzzer

Dim X_l As Word

Dim Y_j As Word

Dim A(14)as Byte , M_1 As Byte , M_2 As Byte
Dim T_2 As Byte

Dim Miao As Byte
Dim Fen As Byte , Fen_1 As Byte , Fen_10 As Byte
Dim Shi As Byte
'/--------------------------------------------------------------
Const On = 1
Const Off = 0

Buzzer Alias Portc.7

'/--------------------------------------------------------------

Waitms 10
Start Timer0
Start Timer2
Restore Daima
For M_1 = 1 To 14
Read A(m_1)
Next M_1
M_1 = 13
M_2 = 13
Waitms 10

'/--------------------------------------------------------------


'/自检

Do

If Pina.4 = 0 Then '/选择风机

If Pind.4 = 1 Then
Incr Fans
Else
Fans = 0
End If

If Fans > 800 Then '/ 风机
M_1 = 2
M_2 = 11
Fans = 800

Else
M_1 = 13
M_2 = 13
End If

If Fans < 800 And Yu_sao > 20 Then Exit Do

Else
Exit Do
End If

Loop



'/--------------------------------------------------------
If Pina.4 = 0 Then Portd.1 = 1 '/FANS
Waitms 100

Do

If Pinc.5 = 1 Then '/漏电
M_1 = 10
M_2 = 11
Portd.1 = 0
Waitms 400
End If

If Pind.5 = 1 Then '/点火器
Incr Dh
Else
Dh = 0
End If

If Dh > 800 Then '/点火器
M_1 = 3
M_2 = 11
Dh = 1000
Waitms 400
Else
End If

If Pind.6 = 0 Then '/苗火阀
M_1 = 4
M_2 = 11
Waitms 400
Else
End If

If Pind.7 = 0 Then '/主火阀
M_1 = 5
M_2 = 11
Waitms 400
Else
End If

If Pinc.0 = 1 Then '/残火
M_1 = 6
M_2 = 11
Waitms 400
Else
End If

If Pind.3 = 1 Then '/燃气压力
M_1 = 7
M_2 = 11
Waitms 400
Else
End If



If M_2 = 13 And M_1 = 13 Then E_e = 12 '/退出循环

If E_e = 12 And Yu_sao > 350 Then Exit Do

If Y_j >= 150 Then Exit Do

Loop

'/HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
If Y_j >= 150 Then
M_1 = 14
M_2 = 14
Portd.1 = 1
Waitms 600
Portd.0 = 1
Waitms 500
Portc.1 = 0
Portc.2 = 0
Portc.4 = 0
Portc.3 = 1
Wait 3
Portc.3 = 0
Waitms 400
Do
Buzzer = 0
Portc.1 = 1
Portc.2 = 1
Portc.3 = 0
Portc.4 = 0
Wait 5
Portd.0 = 0
Buzzer = 1
Waitms 500
M_1 = 14
M_2 = 14

Loop
Else


Porta.2 = 1
Portc.1 = 0
Portc.2 = 1
Portc.3 = 1
Portc.4 = 1

End If





''/==================================================================
'/手动程序


'/主程序

'Portd.1 = 1
'Waitms 300
Portd.0 = 1
Dh_time = 0


Start Adc '/START ADC

Do

If Dh_time < 70 Then '/安全点火时间
Yu_sao = 0

If Pinc.0 = 0 Then Waitms 5
If Pinc.0 = 0 Then
Portd.0 = 1
Portc.2 = 0
Portc.1 = 0
Porta.2 = 1
Portc.3 = 1
Waitms 500
Portc.4 = 0
'Portc.3 = 1
Dh_isr = 0
M_1 = 13
M_2 = 13
Else
Buzzer = 0
Dh_time = 35 '/减少重点火时间
'M_1 = 1
'M_2 = 1
Portd.0 = 0
Portc.4 = 0
Porta.2 = 0
Waitms 800
Portc.3 = 0
'/-------------------------------------------------------------------
If Pina.5 = 1 Then '/电压切换
If Dh_isr > 50 Then '/低压维持
Portc.2 = 1
Portc.1 = 1
Dh_isr = 220
Else
End If
Else '/高压维持
Portc.1 = 0
Portc.2 = 0
End If
'/===================================================================

If Miao => 30 Then '计时
Incr Fen_1
'Porta.2 = Not Porta.2
Miao = 0

Else
End If

If Fen_1 = 25 Then
Incr Fen
Fen_1 = 0
'Porta.2 = Not Porta.2
Else
End If

If Fen = 10 Then
Incr Fen_10
Fen = 0
Else
End If

If Fen_10 = 6 Then
Incr Shi
Fen_10 = 0
If Shi > 9 Then Shi = 0
Else
End If

'/-------------------------------------------------------------------
'/显示
If Miao < 10 Then '/显示"00"
M_1 = 1
M_2 = 1
Else
End If

If Miao > 10 And Miao < 20 Then '/显示"xH"
M_1 = 14
M_2 = Shi + 1
Else
End If

If Miao > 20 And Miao < 30 Then '/显示"xx"
M_1 = Fen + 1
M_2 = Fen_10 + 1
Else
End If

'/====================================================================

End If

Else
Portd.0 = 0
Portc.2 = 1
Portc.3 = 1
Portc.4 = 1
Portc.1 = 0
'Portd.1 = 0
Dh_time = 200
M_1 = 9
M_2 = 11
Waitms 300
'/--------------------------------------------------------------------
If Pinc.0 = 1 Then Waitms 5 '/余火检测
If Pinc.0 = 1 Then
M_1 = 6
M_2 = 11
Waitms 300
Else
End If
'/--------------------------------------------------------------------
If Yu_sao > 3000 Then '/风机后扫
Portd.1 = 0
Else
'Portd.1 = 1
End If

End If

'/-----------------------------------------------------------
Xie_lou = Getadc(7) '/燃气泄露
If X_l > 1400 And Xie_lou > 540 Then Waitms 5
If X_l > 1400 And Xie_lou > 540 Then
Do
M_1 = 1
M_2 = 11
Portd.0 = 0 : Portd.1 = 1 : Porta.2 = 1
Portc.1 = 0 : Portc.2 = 1 : Portc.3 = 1 : Portc.4 = 1
Loop
Else
End If

'/------------------------------------------------------------
If Pinc.5 = 1 Then Waitms 5 '漏电检测
If Pinc.5 = 1 Then
Do
M_1 = 10
M_2 = 11
Portd.0 = 0 : Portd.1 = 0 : Porta.2 = 1
Portc.1 = 0 : Portc.2 = 1 : Portc.3 = 1 : Portc.4 = 1
Loop
Else
End If
'/-----------------------------------------------------------
Loop
End

'/HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

Daima:
Data &H90 , &HFC , &H52 , &H58 , &H3C , &H19 , &H11 , &HF8 , &H10 , &H18
Data &H13 , &H33 , &H30 , &H34

'/===================================================================
6s:
Tcnt0 = &H06
Incr Dh_time
Incr Dh_isr
Incr Yu_sao
Incr X_l
Incr Miao
If X_l > 1400 Then X_l = 1500 '/MQ-2上电延时 1400=90S


If M_1 <= 10 And M_2 = 11 Then '/报警音
Incr F_m
If F_m = 16 Then
Buzzer = Not Buzzer
Elseif F_m = 20 Then
Buzzer = Off
F_m = 0
End If
Else
'Buzzer = Off
End If


If Pina.3 = 0 Then
Incr Y_j
Else
End If


Return

'/===========================================================
'J_sh:
'Timer1 = &H06


'/============================================================
'/LED处理

Led_display:
Tcnt2 = &H3E8
'portc.6 = 1
Incr T_2
Select Case T_2
Case 1
Portb = A(m_1) : Porta.0 = 0 : Porta.1 = 1
Case 2
Portb = A(m_2) : Porta.0 = 1 : Porta.1 = 0
Case Else
Porta.0 = 1 : Porta.1 = 1
T_2 = 0

End Select

Return
此帖出自工控电子论坛

最新回复

是单片机的控制原程式 学过编程的都明白 楼主要学编程基础  详情 回复 发表于 2011-11-18 07:56
点赞 关注
 

回复
举报

6892

帖子

0

TA的资源

五彩晶圆(高级)

沙发
 

这个我也看不懂,有看懂的帮个忙啊

此帖出自工控电子论坛
个人签名一个为理想不懈前进的人,一个永不言败人!
http://shop57496282.taobao.com/
欢迎光临网上店铺!
 
 

回复

3

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
据说这是basic语言
此帖出自工控电子论坛
 
 

回复

32

帖子

0

TA的资源

一粒金砂(初级)

4
 
是单片机的控制原程式
学过编程的都明白
楼主要学编程基础
此帖出自工控电子论坛
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表