ERRATA 2009³â 11¿ù 30ÀÏÀÚ ¹öÀü( ÆÄ¶õ±Û¾¾ ºÎºÐÀÌ ¼öÁ¤µÈ »çÇ×ÀÔ´Ï´Ù)


¼öÁ¤»çÇ× ÆÄÀÏ·Î ´Ù¿î·Îµå
¢º Download : Download ¼öÁ¤»çÇ× hwp ÆÄÀÏ



63~64ÆäÀÌÁö ¼öÁ¤»çÇ×:

<Ç¥ 2.1À» ´ÙÀ½Ç¥·Î ´ëÄ¡ÇÑ´Ù>


[Ç¥ 2.1] RS-232C Åë½ÅÇÁ·Î±×·¥ Æû °³Ã¼ÀÇ ¼Ó¼º

°³ ü

ÀÌ ¸§

¼Ó ¼º

¼³ Á¤

À§Ä¡

Form

frmMain

Caption

 RS-232C Åë½Å

 

Label

Label1

Caption

Àü¼Û»óÅÂ

¨í

Label2

Caption

¿¬°á»óÅ 

Lable3

Caption

Com Æ÷Æ®

lblConMessage

Caption

ConMessage

AutoSize

True

lblConStatus

Caption

lblConstatus

AutoSize

True

Line

Line1, Line2

Border Color ¿Í À§Ä¡, µÎ²², ±æÀ̸¦ Àû´çÈ÷

 

Command

Button

cmdComTx

Caption

ÇÁ·¹ÀÓ Àü¼Û

¨ê

cmdLstTxClear

Caption

»èÁ¦

¨ë

cmdLstRxClear

Caption

»èÁ¦

¨ì

cmdComOpen

Caption

Æ÷Æ®¿­±â

¨ô

cmdComClose

Caption

´Ý±â

¨õ

TextBox

txtEdit

Text

ÇÁ·¹ÀÓ Àü¼Û

¨ç

ListBox

lstTx

Style

0-Ç¥ÁØ

¨è

lstRx

Style

0-Ç¥ÁØ

¨é

ComboBox

cboCOM

Appearance

1 - 3D

¨ï

cboBPS

Appearance

1 - 3D

¨ð

OptionButton

optComBit(0)

Caption

7 bit

¨ñ

Value

False

optComBit(1)

Caption

8 bit

Value

True

optComParity(0)

Caption

No

¨ò

Value

True

optComParity(1)

Caption

Even 

Value

False

optComParity(2)

Caption

Odd

Value

False

optComStopBit(0)

Caption

1Stop

¨ó

Value

True

optComStopBit(1)

Caption

1.5

Value

False

optComStopBit(2)

Caption

2Stop

Value

False

MSComm

MSComm1

RThreshold

0

¨î

Settings

9600,n,8,1

SThreshold

0


________________________________________________________________________________

66ÆäÀÌÁö ¼öÁ¤»çÇ×:

<¼öÁ¤Àü>

Dim tempRxStrBuffer As String


<¼öÁ¤ÈÄ - ´ÙÀ½ ÆÄ¶õ±Û¾¾ ºÎºÐ Ãß°¡>

Dim RxStrBuffer As String

Dim RxCounter As Long

Dim TxStrBuffer As String

Dim TxStrLength As Long

Dim STX As String

Dim ETX As String

Dim tempRxStrBuffer As String

________________________________________________________________________________

66ÆäÀÌÁö ¼öÁ¤»çÇ×: Form_Load ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    lblCommStatus.Caption = "¿¬°á¾ÈµÊ¡°

    txtMsg1.Text = ""


<¼öÁ¤ ÈÄ>

    lblConStatus.Caption = "¿¬°á¾ÈµÊ¡°

    lblConMessage = ""

________________________________________________________________________________



69ÆäÀÌÁö ¼öÁ¤»çÇ×: cmdCOMOpen_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    ¡®Àü¼Û»óŸ¦ ³ªÅ¸³»´Â ÅØ½ºÆ® ¹Ú½º¸¦ Ŭ¸®¾î ½ÃŲ´Ù.

    txtMsg1.Text = ""

. . .

    txtMsg1.Text = errormsg

. . .

    lblCommStatus.Caption = "[" & Str$(MyCOMport) & " ] -> " _

                & ComPortProperty  & " ·Î ¿¬°áµÊ"


<¼öÁ¤ ÈÄ>

    ¡®Àü¼Û»óŸ¦ ³ªÅ¸³»´Â ¶óº§À» Ŭ¸®¾î ½ÃŲ´Ù.

    lblConMessage = ""

. . .

    lblConMessage = errormsg

. . .

    lblConStatus.Caption = "[" & Str$(MyCOMport) & " ] -> " _

                & ComPortProperty  & " ·Î ¿¬°áµÊ"

________________________________________________________________________________

<¼öÁ¤ Àü>

    If optComStopBit(i).Value = True Then

        ComPortProperty = ComPortProperty & ",1"

    ElseIf optComStopBit(i).Value = True Then

        ComPortProperty = ComPortProperty & ",1.5"

    Else

        ComPortProperty = ComPortProperty & ",2"

    End If


<¼öÁ¤ ÈÄ>

    If optComStopBit(0).Value = True Then

        ComPortProperty = ComPortProperty & ",1"

    ElseIf optComStopBit(1).Value = True Then

        ComPortProperty = ComPortProperty & ",1.5"

    Else

        ComPortProperty = ComPortProperty & ",2"

    End If

________________________________________________________________________________



70 ÆäÀÌÁö ¼öÁ¤»çÇ×: ComPortOpen Æã¼Ç ³»

<¼öÁ¤ Àü>

Private Function ComPortOpen(portno As Integer, portporoperty As String)

As String


<¼öÁ¤ ÈÄ - À§ÀÇ ÆÄ¶õ»ö ±Û¾¾ ºÎºÐ ÇÑ ÁÙ·Î ¹èÄ¡>
Private Function ComPortOpen(portno As Integer, portporoperty As String) As String

________________________________________________________________________________

<¼öÁ¤ Àü>

    MSComm1.Interval = 1

<¼öÁ¤ ÈÄ - À§ÀÇ ÆÄ¶õ»ö ±Û¾¾ ºÎºÐ »èÁ¦>

    MSComm1.Interval = 1 Àº À־ ¹«¹æÇÔ ±×·¯³ª ÇÊ¿ä¾ø´Â ºÎºÐÀ̹ǷΠ»èÁ¦ÇÏ´Â °ÍÀÓ

________________________________________________________________________________

71 ÆäÀÌÁö ¼öÁ¤»çÇ×: ComPortOpen Æã¼Ç ³»

<¼öÁ¤ Àü>

CommErrorH:

    ComPortOpen = "COM" & portno & "¿ÀÇÂ ¿¡·¯"

    '& Chr(10) &  "´Ù¸¥ ÇÁ·Î±×·¥¿¡ ÀÇÇÏ¿© »ç¿ëµÇ°í ÀÖ´Â°Í °°½À´Ï´Ù", _

                                                         vbInformation

<¼öÁ¤ ÈÄ - À§ÀÇ ÆÄ¶õ»ö ±Û¾¾ ºÎºÐ »èÁ¦>

CommErrorH:

    ComPortOpen = "COM" & portno & "¿ÀÇÂ ¿¡·¯"

________________________________________________________________________________


72ÆäÀÌÁö ¼öÁ¤»çÇ×: cmdCOMTx_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    txtTx.Text = ""

<¼öÁ¤ ÈÄ>

    txtEdit.Text = ""

________________________________________________________________________________

72ÆäÀÌÁö ¼öÁ¤»çÇ×:

<¼öÁ¤ Àü>

    Mscomm1.Output = Che$(&h41)

<¼öÁ¤ ÈÄ>

    Mscomm1.Output = Chr$(&h41)

________________________________________________________________________________


74-75ÆäÀÌÁö ¼öÁ¤»çÇ×: FrameTx1Plus() ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    txtMsg1.Text = ""

. . .

    TxStrBuffer = STX + txtTx.Text + ETX

. . .

    txtMsg1.Text = "µ¥ÀÌÅÍ Àü¼ÛÁß :¡° & TxCounter

. . .

    txtMsg1.Text = "Àü¼Û ³¡ : Total " & TxCounter & " ¹ÙÀÌÆ® Àü¼ÛµÊ"

<¼öÁ¤ ÈÄ>

    lblConMessage = ""

. . .

    TxStrBuffer = STX + txtEdit.Text + ETX

. . .

    lblConMessage = "µ¥ÀÌÅÍ Àü¼ÛÁß :¡° & TxCounter

. . .

    lblConMessage = "Àü¼Û ³¡ : Total " & TxCounter & " ¹ÙÀÌÆ® Àü¼ÛµÊ"

________________________________________________________________________________

83ÆäÀÌÁö ¼öÁ¤»çÇ×: MSComm1_OnComm() ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ ÈÄ - ¼­ºê·çƾ ¸Ç ¾Æ·¡¿¡ End Sub Ãß°¡>

    End Sub Ãß°¡

________________________________________________________________________________

84ÆäÀÌÁö ¼öÁ¤»çÇ×: cmdCOMClose_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    lblCommStatus.Caption = "¿¬°á¾ÈµÊ"

    txtMsg1.Text = ""


<¼öÁ¤ ÈÄ>

    lblConStatus.Caption = "¿¬°á¾ÈµÊ"

    lblConMessage = ""

________________________________________________________________________________


85ÆäÀÌÁö ¼öÁ¤»çÇ×: mnuEnd_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    UnloadAllForms

<¼öÁ¤ ÈÄ>

    Unload Me


103 ÆäÀÌÁö ¼öÁ¤»çÇ×:

<Ç¥ 3.1À» ´ÙÀ½Ç¥·Î ´ëÄ¡ÇÑ´Ù>


[Ç¥ 3.1] RS-232C Ÿ±êº¸µåÇÁ·Î±×·¥ Æû °³Ã¼ÀÇ ¼Ó¼º

°³ ü

ÀÌ ¸§

¼Ó ¼º

¼³ Á¤

À§Ä¡

Form

frmMain

Caption

 RS-232C Ÿ°Ùº¸µå

 

Label

Label1

Caption

Àü¼Û»óÅÂ

 

Label2

Caption

¿¬°á»óÅ 

Lable3

Caption

Com Æ÷Æ®

lblConMessage

Caption

ConMessage

AutoSize

True

lblConStatus

Caption

lblConstatus

AutoSize

True

Line

Line1, Line2

Border Color ¿Í À§Ä¡, µÎ²², ±æÀ̸¦ Àû´çÈ÷

 

Command

Button

cmdComTx

Caption

ÇÁ·¹ÀÓ Àü¼Û

¨ð

cmdLstTxClear

Caption

»èÁ¦

¨ñ

cmdLstRxClear

Caption

»èÁ¦

cmdComOpen

Caption

Æ÷Æ®¿­±â

¨ì

cmdComClose

Caption

´Ý±â

¨í

TextBox

txtEdit

Text

ÇÁ·¹ÀÓ Àü¼Û

¨î

txtTxData

Text

 txtTxData

¨ï

txtRxData

Text

txtRxData

ComboBox

cboCOM

Appearance

1 - 3D

¨ç

cboBPS

Appearance

1 - 3D

¨è

OptionButton

optComBit(0)

Caption

7 bit

¨é

Value

False

optComBit(1)

Caption

8 bit

Value

True

optComParity(0)

Caption

No

¨ê

Value

True

optComParity(1)

Caption

Even 

Value

False

optComParity(2)

Caption

Odd

Value

False

optComStopBit(0)

Caption

1Stop

¨ë

Value

True

optComStopBit(1)

Caption

1.5

Value

False

optComStopBit(2)

Caption

2Stop

Value

False

MSComm

MSComm1

RThreshold

0

¨õ

Settings

9600,n,8,1

SThreshold

0

Command

Button

cmdOn(0)~(4)

Caption

ON

¨ó

cmdOff(0)~(4)

Caption

OFF

¨ô

Image

imgTarget(0)~(4)

Picture

(ºñÆ®¸Ê)

¨ò

________________________________________________________________________________

105ÆäÀÌÁö ¼öÁ¤»çÇ×: Form_Load ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    lblCommStatus.Caption = "¿¬°á¾ÈµÊ¡°


<¼öÁ¤ ÈÄ>

    lblConStatus.Caption = "¿¬°á¾ÈµÊ¡°

________________________________________________________________________________

108ÆäÀÌÁö ¼öÁ¤»çÇ×: cmdCOMOpen_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    If optComStopBit(i).Value = True Then

        ComPortProperty = ComPortProperty & ",1"

    ElseIf optComStopBit(i).Value = True Then

        ComPortProperty = ComPortProperty & ",1.5"

    Else

        ComPortProperty = ComPortProperty & ",2"

    End If

<¼öÁ¤ ÈÄ>

    If optComStopBit(0).Value = True Then

        ComPortProperty = ComPortProperty & ",1"

    ElseIf optComStopBit(1).Value = True Then

        ComPortProperty = ComPortProperty & ",1.5"

    Else

        ComPortProperty = ComPortProperty & ",2"

    End If

________________________________________________________________________________

<¼öÁ¤ Àü>

    ¡®Àü¼Û»óŸ¦ ³ªÅ¸³»´Â ÅØ½ºÆ® ¹Ú½º¸¦ Ŭ¸®¾î ½ÃŲ´Ù.

    txtMsg1.Text = ""

. . .

    txtMsg1.Text = errormsg

. . .

    lblCommStatus.Caption = "[" & Str$(MyCOMport) & " ] -> " _

                & ComPortProperty  & " ·Î ¿¬°áµÊ"


<¼öÁ¤ ÈÄ>

    ¡®Àü¼Û»óŸ¦ ³ªÅ¸³»´Â ¶óº§À» Ŭ¸®¾î ½ÃŲ´Ù.

    lblConMessage = ""

. . .

    lblConMessage = errormsg

. . .

    lblConStatus.Caption = "[" & Str$(MyCOMport) & " ] -> " _

                & ComPortProperty  & " ·Î ¿¬°áµÊ"

________________________________________________________________________________


109 ÆäÀÌÁö ¼öÁ¤»çÇ×: ComPortOpen Æã¼Ç ³»

<¼öÁ¤ Àü>

Private Function ComPortOpen(portno As Integer, portporoperty As

String) As String


<¼öÁ¤ ÈÄ - À§ÀÇ ÆÄ¶õ»ö ±Û¾¾ ºÎºÐ ÇÑ ÁÙ·Î ¹èÄ¡>
Private Function ComPortOpen(portno As Integer, portporoperty As String) As String

________________________________________________________________________________

<¼öÁ¤ Àü>

    MSComm1.Interval = 1

<¼öÁ¤ ÈÄ - À§ÀÇ ÆÄ¶õ»ö ±Û¾¾ ºÎºÐ »èÁ¦>

    MSComm1.Interval = 1 Àº À־ ¹«¹æÇÔ ±×·¯³ª ÇÊ¿ä¾ø´Â ºÎºÐÀ̹ǷΠ»èÁ¦ÇÏ´Â °ÍÀÓ

________________________________________________________________________________


111-112ÆäÀÌÁö ¼öÁ¤»çÇ×: FrameTx1Plus() ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    txtMsg1.Text = ""

. . .

    txtMsg1.Text = "µ¥ÀÌÅÍ Àü¼ÛÁß :¡° & TxCounter

. . .

    txtMsg1.Text = "Àü¼Û ³¡ : Total " & TxCounter & " ¹ÙÀÌÆ® Àü¼ÛµÊ"

<¼öÁ¤ ÈÄ>

    lblConMessage = ""

. . .

    lblConMessage = "µ¥ÀÌÅÍ Àü¼ÛÁß :¡° & TxCounter

. . .

    lblConMessage = "Àü¼Û ³¡ : Total " & TxCounter & " ¹ÙÀÌÆ® Àü¼ÛµÊ"

________________________________________________________________________________

114ÆäÀÌÁö ¼öÁ¤»çÇ×: MSComm1_OnComm() ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ ÈÄ - ¼­ºê·çƾ ¸Ç ¾Æ·¡¿¡ End Sub Ãß°¡>

    End Sub Ãß°¡


________________________________________________________________________________

116ÆäÀÌÁö ¼öÁ¤»çÇ×: Target_On() ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

Private Sub cmdOn_Click(Index As Integer)

<¼öÁ¤ ÈÄ>

Private Sub Target_On(Index As Integer)


________________________________________________________________________________

118-119ÆäÀÌÁö ¼öÁ¤»çÇ×: cmdCOMClose_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    lblCommStatus.Caption = "¿¬°á¾ÈµÊ"

    txtMsg1.Text = ""


<¼öÁ¤ ÈÄ>

    lblConStatus.Caption = "¿¬°á¾ÈµÊ"

    lblConMessage = ""

________________________________________________________________________________


119ÆäÀÌÁö ¼öÁ¤»çÇ×: cmdLstRxClear_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

Private Sub cmdLstRxClear_Click()

    lstRx.Clear

End Sub

<¼öÁ¤ ÈÄ>

Private Sub cmdRxLstClear_Click()

    txtRxData.Text = ""

End Sub

________________________________________________________________________________

119ÆäÀÌÁö ¼öÁ¤»çÇ×: cmdLstTxClear_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

Private Sub cmdLstTxClear_Click()

    lstTx.Clear

End Sub

<¼öÁ¤ ÈÄ>

Private Sub cmdLstTxClear_Click()

    txtTxData.Text = ""

End Sub

________________________________________________________________________________


120ÆäÀÌÁö ¼öÁ¤»çÇ×: mnuEnd_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    UnloadAllForms ¡°¡±

<¼öÁ¤ ÈÄ>

    Unload Me


________________________________________________________________________________



130 ÆäÀÌÁö ¼öÁ¤»çÇ×:

<Ç¥ 3.2¸¦ ´ÙÀ½Ç¥·Î ´ëÄ¡ÇÑ´Ù>


[Ç¥ 3.2] RS-232C Á¦¾îº¸µåÇÁ·Î±×·¥ Æû °³Ã¼ÀÇ ¼Ó¼º

°³ ü

ÀÌ ¸§

¼Ó ¼º

¼³ Á¤

À§Ä¡

Shape

Shape1(0)~(4)

FillColor

&H00FF8080&

 

Shape

4 - µÕ±Ù»ç°¢Çü

Image

Image1~Image5

Picture

(ºñÆ®¸Ê)

¨ï

Command

Button

cmdLight(0)~(1)

Caption

Àüµî ON, Àüµî OFF

¨ñ,¨ò

cmdGas(0)~(1)

Caption

°¡½º Àá±Ý, Clear

cmdDoor(0)~(1)

Caption

µµ¾î Open, Clear

cmdAircon(0)~(1)

Caption

¿¡¾îÄÁ ON, ¿¡¾îÄÁ Off

cmdHeat(0)~(1)

Caption

³­¹æ ON, ³­¹æ OFF

Shape

Shape1(5)~(14)

FillColor

&H00C0C0C0&, &H00FFC0C0&

 

Shape

4 - µÕ±Ù»ç°¢Çü

Label

Label5(0)~(4)

Caption

ÇöÀç»óÅÂ

 

lblStatus(0)

Caption

Àüµî OFF

¨ó

lblStatus(1)

Caption

µ¿ÀÛ¾øÀ½

lblStatus(2)

Caption

µ¿ÀÛ¾øÀ½

lblStatus(3)

Caption

¿¡¾îÄÁ OFF

lblStatus(4)

Caption

³­¹æ OFF

TextBox

txtLight

Text

0

¨ð

txtGas

Text

1

txtDoor

Text

2

txtAircon

Text

3

txtHeat

Text

4

°³ ü

ÀÌ ¸§

¼Ó ¼º

¼³ Á¤

À§Ä¡

Form

frmMain

Caption

 RS-232C Á¦¾îº¸µå

 

Label

Label1

Caption

Àü¼Û»óÅÂ

¨ô

Label2

Caption

¿¬°á»óÅ 

Lable3

Caption

Com Æ÷Æ®

lblConMessage

Caption

ConMessage

AutoSize

True

lblConStatus

Caption

lblConstatus

AutoSize

True

Line

Line1, Line2

Border Color ¿Í À§Ä¡, µÎ²², ±æÀ̸¦ Àû´çÈ÷

 

Command

Button

cmdComTx

Caption

ÇÁ·¹ÀÓ Àü¼Û

¨î

cmdLstTxClear

Caption

»èÁ¦

cmdLstRxClear

Caption

»èÁ¦

cmdComOpen

Caption

Æ÷Æ®¿­±â

¨ì

cmdComClose

Caption

´Ý±â

TextBox

txtEdit

Text

ÇÁ·¹ÀÓ Àü¼Û

¨í

¨ï

txtTxData

Text

 txtTxData

txtRxData

Text

txtRxData

ComboBox

cboCOM

Appearance

1 - 3D

¨ç

cboBPS

Appearance

1 - 3D

¨è

OptionButton

optComBit(0)

Caption

7 bit

¨é

Value

False

optComBit(1)

Caption

8 bit

Value

True

optComParity(0)

Caption

No

¨ê

Value

True

optComParity(1)

Caption

Even 

Value

False

optComParity(2)

Caption

Odd

Value

False

optComStopBit(0)

Caption

1Stop

¨ë

Value

True

optComStopBit(1)

Caption

1.5

Value

False

optComStopBit(2)

Caption

2Stop

Value

False

MSComm

MSComm1

RThreshold

0

¨õ

Settings

9600,n,8,1

SThreshold

0

________________________________________________________________________________

133ÆäÀÌÁö ¼öÁ¤»çÇ×: Form_Load ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    lblCommStatus.Caption = "¿¬°á¾ÈµÊ¡°


<¼öÁ¤ ÈÄ>

    lblConStatus.Caption = "¿¬°á¾ÈµÊ¡°

________________________________________________________________________________

135ÆäÀÌÁö ¼öÁ¤»çÇ×: cmdCOMOpen_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    If optComStopBit(i).Value = True Then

        ComPortProperty = ComPortProperty & ",1"

    ElseIf optComStopBit(i).Value = True Then

        ComPortProperty = ComPortProperty & ",1.5"

    Else

        ComPortProperty = ComPortProperty & ",2"

    End If

<¼öÁ¤ ÈÄ>

    If optComStopBit(0).Value = True Then

        ComPortProperty = ComPortProperty & ",1"

    ElseIf optComStopBit(1).Value = True Then

        ComPortProperty = ComPortProperty & ",1.5"

    Else

        ComPortProperty = ComPortProperty & ",2"

    End If

________________________________________________________________________________

<¼öÁ¤ Àü>

    ¡®Àü¼Û»óŸ¦ ³ªÅ¸³»´Â ÅØ½ºÆ® ¹Ú½º¸¦ Ŭ¸®¾î ½ÃŲ´Ù.

    txtMsg1.Text = ""

. . .

    txtMsg1.Text = errormsg

. . .

    lblCommStatus.Caption = "[" & Str$(MyCOMport) & " ] -> " _

                & ComPortProperty  & " ·Î ¿¬°áµÊ"


<¼öÁ¤ ÈÄ>

    ¡®Àü¼Û»óŸ¦ ³ªÅ¸³»´Â ¶óº§À» Ŭ¸®¾î ½ÃŲ´Ù.

    lblConMessage = ""

. . .

    lblConMessage = errormsg

. . .

    lblConStatus.Caption = "[" & Str$(MyCOMport) & " ] -> " _

                & ComPortProperty  & " ·Î ¿¬°áµÊ"

________________________________________________________________________________


136 ÆäÀÌÁö ¼öÁ¤»çÇ×: ComPortOpen Æã¼Ç ³»

<¼öÁ¤ Àü>

    MSComm1.Interval = 1

<¼öÁ¤ ÈÄ - À§ÀÇ ÆÄ¶õ»ö ±Û¾¾ ºÎºÐ »èÁ¦>

    MSComm1.Interval = 1 Àº À־ ¹«¹æÇÔ ±×·¯³ª ÇÊ¿ä¾ø´Â ºÎºÐÀ̹ǷΠ»èÁ¦ÇÏ´Â °ÍÀÓ

________________________________________________________________________________


139-140 ÆäÀÌÁö ¼öÁ¤»çÇ×: FrameTx1Plus(txString as String) ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    txtMsg1.Text = ""

. . .

    txtMsg1.Text = "µ¥ÀÌÅÍ Àü¼ÛÁß :¡° & TxCounter

. . .

    txtMsg1.Text = "Àü¼Û ³¡ : Total " & TxCounter & " ¹ÙÀÌÆ® Àü¼ÛµÊ"

<¼öÁ¤ ÈÄ>

    lblConMessage = ""

. . .

    lblConMessage = "µ¥ÀÌÅÍ Àü¼ÛÁß :¡° & TxCounter

. . .

    lblConMessage = "Àü¼Û ³¡ : Total " & TxCounter & " ¹ÙÀÌÆ® Àü¼ÛµÊ"

________________________________________________________________________________

146ÆäÀÌÁö ¼öÁ¤»çÇ×: MSComm1_OnComm() ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ ÈÄ - ¼­ºê·çƾ ¸Ç ¾Æ·¡¿¡ End Sub Ãß°¡>

    End Sub Ãß°¡


________________________________________________________________________________

149 ÆäÀÌÁö ¼öÁ¤»çÇ×: cmdCOMClose_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    lblCommStatus.Caption = "¿¬°á¾ÈµÊ"

    txtMsg1.Text = ""


<¼öÁ¤ ÈÄ>

    lblConStatus.Caption = "¿¬°á¾ÈµÊ"

    lblConMessage = ""

________________________________________________________________________________


169 ÆäÀÌÁö ¼öÁ¤»çÇ×:

<Ç¥ 4.1À» ´ÙÀ½Ç¥·Î ´ëÄ¡ÇÑ´Ù - û»öºÎºÐÀÌ ±âÁ¸Ç¥¿Í ´Ù¸¥ °ÍÀÓ >


[Ç¥ 4.1] À©¼Ó¼­¹öÇÁ·Î±×·¥ Æû µðÀÚÀÎ °³Ã¼ÀÇ ¼Ó¼º

°³ ü

ÀÌ ¸§

¼Ó ¼º

¼³ Á¤

À§Ä¡

Label

Label1

Caption

My IP ÁÖ¼Ò

 

Label2

Caption

Local Æ÷Æ®

 

Label3

Caption

Á¢¼Ó»óÅÂ

 

lblCStatus

Caption

Á¢¼Ó»óÅ ǥ½Ã

¨ï

Line

Line1

Border Color ¿Í À§Ä¡, µÎ²², ±æÀ̸¦ Àû´çÈ÷

 

TextBox

txtIP

Text

IP ÁÖ¼Ò ÀÔ·Â ¿äû

¨ç

txtPortAddr

Text

1001

¨è

txtSend

Text

º¸³¾¸Þ½ÃÁö

¨î

txtMessage

Text

 

¨í

Multiline

True

Command

Button

cmdHost

Caption

¿¬°á(Me Host)

¨é

cmdDisconnect

Caption

²÷±â

¨ê

cmdExit

Caption

Á¾·á

¨ë

Winsock

wsockServer

Protocol

0-sckTCPProtocol

¨ð



 

174 ÆäÀÌÁö ¼öÁ¤»çÇ×: txtSend_KeyDown ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

       If (wsockClient.State <> sckConnected) Then

                MsgBox "Ŭ¶óÀÌ¾ðÆ®°¡ ¿¬°áµÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù"

                Exit Sub

        End If

<¼öÁ¤ ÈÄ>

       If (wsockServer.State <> sckConnected) Then

                MsgBox "Ŭ¶óÀÌ¾ðÆ®°¡ ¿¬°áµÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù"

                Exit Sub

        End If


175 ÆäÀÌÁö ¼öÁ¤»çÇ×: wsockServer_Close() ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    MsgBox "¼­¹ö¿Í ¿¬°áÀÌ ²÷¾îÁ³½À´Ï´Ù."

<¼öÁ¤ ÈÄ>

    MsgBox "Ŭ¶óÀÌ¾ðÆ®¿Í ¿¬°áÀÌ ²÷¾îÁ³½À´Ï´Ù."



177 ÆäÀÌÁö ¼öÁ¤»çÇ×:

<Ç¥ 4.2¸¦ ´ÙÀ½Ç¥·Î ´ëÄ¡ÇÑ´Ù>


[Ç¥ 4.2] À©¼ÓŬ¶óÀÌ¾ðÆ® ÇÁ·Î±×·¥ Æû µðÀÚÀÎ °³Ã¼ÀÇ ¼Ó¼º

°³ ü

ÀÌ ¸§

¼Ó ¼º

¼³ Á¤

Label

Label1

Caption

¿¬°áÇÒ È£½ºÆ® IP ÁÖ¼Ò

Label2

Caption

Port

Label3

Caption

Á¢¼Ó»óÅÂ

lblCStatus

Caption

Á¢¼Ó»óÅ ǥ½Ã

Line

Line1

Border Color ¿Í À§Ä¡, µÎ²², ±æÀ̸¦ Àû´çÈ÷

 

TextBox

txtIP

Text

IP ÁÖ¼Ò ÀÔ·Â ¿äû

txtPortAddr

Text

1001

txtSend

Text

º¸³¾¸Þ½ÃÁö

txtMessage

Text

 

Multiline

True

Command

Button

cmdClient

Caption

¿¬°á(Me Client)

cmdDisconnect

Caption

²÷±â

cmdExit

Caption

Á¾·á

Winsock

wsockClient

Protocol

0-sckTCPProtocol


222 ÆäÀÌÁö ¼öÁ¤»çÇ×:

<Ç¥ 5.1À» ´ÙÀ½Ç¥·Î ´ëÄ¡ÇÑ´Ù - û»öºÎºÐÀÌ ±âÁ¸Ç¥¿Í ´Ù¸¥ °ÍÀÓ >


[Ç¥ 5.1] À©¼ÓŸ°Ùº¸µåÇÁ·Î±×·¥ Æû µðÀÚÀÎ °³Ã¼ÀÇ ¼Ó¼º

°³ ü

ÀÌ ¸§

¼Ó ¼º

¼³ Á¤

À§Ä¡

Label

Label1

Caption

My IP ÁÖ¼Ò

 

Label2

Caption

Local Æ÷Æ®

 

Label3

Caption

Á¢¼Ó»óÅÂ

 

Label4

Caption

Åë½Å»óÅÂ

 

lblCStatus

Caption

lblCstatus

¨í

lblTStatus

Caption

lblTStatus

Line

Line1

Border Color ¿Í À§Ä¡, µÎ²², ±æÀ̸¦ Àû´çÈ÷

 

TextBox

txtIP

Text

IP ÁÖ¼Ò ÀÔ·Â ¿äû

¨ç

txtPortAddr

Text

1001

¨è

txtReceive

Text

txtReceive

¨ì

txtSend

Text

txtSend

Command

Button

cmdHost

Caption

¿¬°á(Me Host)

¨é

cmdDisconnect

Caption

²÷±â

¨ê

cmdExit

Caption

Á¾·á

¨ë

cmdOn(0)~(4)

Caption

ON

¨ï

cmdOff(0)~(4)

Caption

OFF

¨ð

Winsock

wsockServer

Protocol

0-sckTCPProtocol

¨ñ

Image

imgTarget(0)~(4)

Picture

(ºñÆ®¸Ê)

¨î


242 ÆäÀÌÁö ¼öÁ¤»çÇ×:

<±×¸² 5.10À» ´ÙÀ½ ±×¸²À¸·Î ´ëÄ¡ÇÑ´Ù - ¨ñ,¨ò,¨ó,¨ô,¨õ º¯°æ >



243 ÆäÀÌÁö ¼öÁ¤»çÇ×:

<¼öÁ¤ Àü>

        [Ç¥ 4.2] À©¼ÓÁ¦¾îº¸µåÇÁ·Î±×·¥ Æû µðÀÚÀÎ °³Ã¼ÀÇ ¼Ó¼º

<¼öÁ¤ ÈÄ>

        [Ç¥ 5.2] À©¼ÓÁ¦¾îº¸µåÇÁ·Î±×·¥ Æû µðÀÚÀÎ °³Ã¼ÀÇ ¼Ó¼º



243 ÆäÀÌÁö ¼öÁ¤»çÇ×:

<Ç¥ 5.2¸¦ ´ÙÀ½Ç¥·Î ´ëÄ¡ÇÑ´Ù - û»öºÎºÐÀÌ ±âÁ¸Ç¥¿Í ´Ù¸¥ °ÍÀÓ >


[Ç¥ 5.2] À©¼ÓÁ¦¾îº¸µåÇÁ·Î±×·¥ Æû µðÀÚÀÎ °³Ã¼ÀÇ ¼Ó¼º

°³ ü

ÀÌ ¸§

¼Ó ¼º

¼³ Á¤

À§Ä¡

Label

Label1

Caption

¿¬°áÇÒ È£½ºÆ® IP ÁÖ¼Ò

 

Label2

Caption

Local Æ÷Æ®

 

Label3

Caption

Á¢¼Ó»óÅÂ

 

Label4

Caption

Åë½Å»óÅÂ

 

lblCStatus

Caption

lblCStatus

¨ï

lblTStatus

Caption

 lblTStatus

Line

Line1

Border Color ¿Í À§Ä¡, µÎ²², ±æÀ̸¦ Àû´çÈ÷

 

TextBox

txtIP

Text

IP ÁÖ¼Ò ÀÔ·Â ¿äû

¨ç

txtPortAddr

Text

1001

¨è

txtSend

Text

txtSend

¨î

txtReceive

Text

txtReceive

¨í

Command

Button

cmdClient

Caption

¿¬°á(Me Client)

¨é

cmdDisconnect

Caption

²÷±â

¨ê

cmdExit

Caption

Á¾·á

¨ë

Winsock

wsockClient

Protocol

0-sckTCPProtocol

¨ð

Shape

Shape1(0)~(4)

FillColor

&H00FF8080&

 

Shape

4 - µÕ±Ù»ç°¢Çü

 

Image

Image1~Image5

Picture

(ºñÆ®¸Ê)

¨ñ

Command

Button

cmdLight(0)~(1)

Caption

Àüµî ON, Àüµî OFF

¨ó¨ô

cmdGas(0)~(1)

Caption

°¡½º Àá±Ý, Clear

cmdDoor(0)~(1)

Caption

µµ¾î Open, Clear

cmdAircon(0)~(1)

Caption

¿¡¾îÄÁ ON, ¿¡¾îÄÁ Off

cmdHeat(0)~(1)

Caption

³­¹æ ON, ³­¹æ OFF

Shape

Shape1(5)~(14)

FillColor

&H00C0C0C0&, &H00FFC0C0&

 

Shape

4 - µÕ±Ù»ç°¢Çü

 

Label

Label5(0)~(4)

Caption

ÇöÀç»óÅÂ

 

lblStatus(0)

Caption

Àüµî OFF

¨õ

lblStatus(1)

Caption

µ¿ÀÛ¾øÀ½

lblStatus(2)

Caption

µ¿ÀÛ¾øÀ½

lblStatus(3)

Caption

¿¡¾îÄÁ OFF

lblStatus(4)

Caption

³­¹æ OFF

TextBox

txtLight

Text

0

¨ò

txtGas

Text

1

txtDoor

Text

2

txtAircon

Text

3

txtHeat

Text

4


253 ÆäÀÌÁö ¼öÁ¤»çÇ×:  wsockClient_DataArrival( ) ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

            If str1 = ETX Then

                str3 = Left(sData, 3)

                txtReceive.Text = txtReceive.Text + str2

¨ë              Call updateControlStatus(str3)

                lblTStatus.Caption = "µ¥ÀÌÅͼö½Å Á¤»ó"

            Else


<¼öÁ¤ ÈÄ>

            If str1 = ETX Then

                str3 = Left(sData, 3)

                txtReceive.Text = txtReceive.Text + str3

¨ë              Call updateControlStatus(str3)

                lblTStatus.Caption = "µ¥ÀÌÅͼö½Å Á¤»ó"

            Else



ºÎ·Ï : API ¼±¾ð ¸ðµâ(ModAPI.bas)


'wav ÆÄÀÏ ¿¬ÁÖÇϱâ ÇÔ¼ö

Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _

         (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Public Const SND_ASYNC = 1

Public Const SND_LOOP = &H8

Public Const SND_NODEFAULT = &H2

Public Const SND_NOSTOP = &H10

Public Const SND_NOWAIT = &H2000


'Sleep ÇÔ¼ö

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


<<ÇÁ·Î±×·¥ ¹ö±×>>

2Àå, 3Àå-Target ÇÁ·Î±×·¥, 3Àå-Control ÇÁ·Î±×·¥


cmdCOMOpen_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

    If optComStopBit(i).Value = True Then

        ComPortProperty = ComPortProperty & ",1"

    ElseIf optComStopBit(i).Value = True Then

        ComPortProperty = ComPortProperty & ",1.5"

    Else

        ComPortProperty = ComPortProperty & ",2"

    End If


<¼öÁ¤ ÈÄ - ÆÄ¶õ»ö ±Û¾¾ºÎºÐ ¼öÁ¤>

    If optComStopBit(0).Value = True Then

        ComPortProperty = ComPortProperty & ",1"

    ElseIf optComStopBit(1).Value = True Then

        ComPortProperty = ComPortProperty & ",1.5"

    Else

        ComPortProperty = ComPortProperty & ",2"

    End If

________________________________________________________________________________

3Àå-Target ÇÁ·Î±×·¥  cmdLstRxClear_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

Private Sub cmdLstRxClear_Click()


End Sub

<¼öÁ¤ ÈÄ - ÆÄ¶õ±Û¾¾ºÎºÐ Ãß°¡>

Private Sub cmdRxLstClear_Click()

    txtRxData.Text = ""

End Sub

________________________________________________________________________________

3Àå-Target ÇÁ·Î±×·¥ cmdLstTxClear_Click ÇÁ·Î½ÃÀú ³»

<¼öÁ¤ Àü>

Private Sub cmdLstTxClear_Click()


End Sub

<¼öÁ¤ ÈÄ - ÆÄ¶õ±Û¾¾ºÎºÐ Ãß°¡ >

Private Sub cmdLstTxClear_Click()

    txtTxData.Text = ""

End Sub

________________________________________________________________________________