ขอถามผู้ทราบหน่อยคับ chack bok หน่อย
คือว่าผมทำก่รเขียนโปรแกรมติดต่อกับ บอร์ดควบคุมดีเลย์ ตอนนี้ก็ได้แล้ว แต่ต้องการให้มันทำงานทุกวันอ่ะ ด้วยการติ๊ก ที่ เซ๊คบ๊อค ผมทำรีเลย์ 8 ตัว อยากจะให้ คุมได้ทุกตัวเลยอะคับ ผมอยากให้ช่วย นี้โค๊ด อันที่ทำแล้ว ช่วยเพิ่มให้หน่อยนะคับ Private Sub Form_Load() Label1.Caption = "Relay1" Label2.Caption = "Relay2" Label3.Caption = "Relay3" Label4.Caption = "Relay4" Label5.Caption = "Relay5" Label6.Caption = "Relay6" Label7.Caption = "Relay7" Label8.Caption = "Relay8" Label10.Caption = "Alarm Time" Label11.Caption = "Alarm delay (sec)" Label9.FontBold = True Text1.Alignment = 2 Text2.Alignment = 2 Text3.Alignment = 2 Text4.Alignment = 2 Text5.Alignment = 2 Text6.Alignment = 2 Text7.Alignment = 2 Text8.Alignment = 2 Text9.Alignment = 2 Text10.Alignment = 2 Text11.Alignment = 2 Text12.Alignment = 2 Text13.Alignment = 2 Text14.Alignment = 2 Text15.Alignment = 2 Text16.Alignment = 2 Text1.Text = "00:00:00" Text3.Text = "00:00:00" Text5.Text = "00:00:00" Text7.Text = "00:00:00" Text9.Text = "00:00:00" Text11.Text = "00:00:00" Text13.Text = "00:00:00" Text15.Text = "00:00:00" Text2.Text = "0" Text4.Text = "0" Text6.Text = "0" Text8.Text = "0" Text10.Text = "0" Text12.Text = "0" Text14.Text = "0" Text16.Text = "0" Timer1.Interval = 1000 Timer2.Interval = 1000 Timer3.Interval = 1000 Timer4.Interval = 1000 Timer5.Interval = 1000 Timer6.Interval = 1000 Timer7.Interval = 1000 Timer8.Interval = 1000 Timer9.Interval = 1000 Timer1.Enabled = False Timer2.Enabled = False Timer3.Enabled = False Timer4.Enabled = False Timer5.Enabled = False Timer6.Enabled = False Timer7.Enabled = False Timer8.Enabled = False pwrite = &H378 Out pwrite, &H0 End Sub
Private Sub Timer1_Timer() Text2.Text = Text2.Text - 1 If Val(Text2.Text) < 0 Then Out pwrite, Inp(pwrite) Xor &H1 Text2.Text = "0" Timer1.Enabled = False End If End Sub
Private Sub Timer2_Timer() Text4.Text = Text4.Text - 1 If Val(Text4.Text) < 0 Then Out pwrite, Inp(pwrite) Xor &H2 Text4.Text = "0" Timer2.Enabled = False End If End Sub
Private Sub Timer3_Timer() Text6.Text = Text6.Text - 1 If Val(Text6.Text) < 0 Then Out pwrite, Inp(pwrite) Xor &H4 Text6.Text = "0" Timer3.Enabled = False End If End Sub
Private Sub Timer4_Timer() Text8.Text = Text8.Text - 1 If Val(Text8.Text) < 0 Then Out pwrite, Inp(pwrite) Xor &H8 Text8.Text = "0" Timer4.Enabled = False End If End Sub
Private Sub Timer5_Timer() Text10.Text = Text10.Text - 1 If Val(Text10.Text) < 0 Then Out pwrite, Inp(pwrite) Xor &H10 Text10.Text = "0" Timer5.Enabled = False End If End Sub
Private Sub Timer6_Timer() Text12.Text = Text12.Text - 1 If Val(Text12.Text) < 0 Then Out pwrite, Inp(pwrite) Xor &H20 Text12.Text = "0" Timer6.Enabled = False End If End Sub
Private Sub Timer7_Timer() Text14.Text = Text14.Text - 1 If Val(Text14.Text) < 0 Then Out pwrite, Inp(pwrite) Xor &H40 Text14.Text = "0" Timer7.Enabled = False End If End Sub
Private Sub Timer8_Timer() Text16.Text = Text16.Text - 1 If Val(Text16.Text) < 0 Then Out pwrite, Inp(pwrite) Xor &H80 Text16.Text = "0" Timer8.Enabled = False End If End Sub
Private Sub Timer9_Timer() Label9.Caption = Time$ If Label9.Caption = Text1.Text Then Out pwrite, Inp(pwrite) Xor &H1 Timer1.Enabled = True End If If Label9.Caption = Text3.Text Then Out pwrite, Inp(pwrite) Xor &H2 Timer2.Enabled = True End If If Label9.Caption = Text5.Text Then Out pwrite, Inp(pwrite) Xor &H4 Timer3.Enabled = True End If If Label9.Caption = Text7.Text Then Out pwrite, Inp(pwrite) Xor &H8 Timer4.Enabled = True End If If Label9.Caption = Text9.Text Then Out pwrite, Inp(pwrite) Xor &H10 Timer5.Enabled = True End If If Label9.Caption = Text11.Text Then Out pwrite, Inp(pwrite) Xor &H20 Timer6.Enabled = True End If If Label9.Caption = Text13.Text Then Out pwrite, Inp(pwrite) Xor &H40 Timer7.Enabled = True End If If Label9.Caption = Text15.Text Then Out pwrite, Inp(pwrite) Xor &H80 Timer8.Enabled = True End If End Sub
|