VB Lesson: Serial Port

Serial Port membolehkan software di dalam komputer berhubung dengan hardware lain di luar. Misalnya menghubungkan Visual Basic dengan hardware PIC.

Melalui serial port, Visual Basic boleh mengawal alatan lain ataupun memaparkan bacaan daripada alatan lain. Software Visual Basic boleh menghasilkan sistem SCADA (Supervisory Control And Data Acquisition).

Berikut adalah videonya.

PIC Source Code

Sertai Telegram Group bagi dapatkan source code

VB Source Code

Sertai Telegram Group bagi dapatkan source code

56 Replies to “VB Lesson: Serial Port”

  1. salam.. sy ad sikit maslah, kalo tak keberatan, sy nk minta tunjuk ajar saudara utk memberi sedikit input or info cmne sy nk link kan rfid sy dgn vb especially vb.net..dgn ayat yg lebeh jelas,

    sy membuat satu projek yg mana melibatkan database, masalah sy, sy tdak tahu bagaimana nk hubungkan rfid sy dgn database sy.

    harap encik/saudara/bos boleh membantu sy yg memerlukan ini,, terima kasih

  2. Salam, sy nk tanya, dlm PIC tu perlu ke kite declare lib dia? sbb sy menggunakan SK40C dr cytron?

    1. w/salam, Akmal. Library bergantung kpd coding, kalau coding semua dlm main file tak perlu declare library. Kalau ada function dlm file library, kena declare library.

  3. How much does it cost?
    WHat about other codes you have, for example dht11, current sensor??
    I would like to have a price list if possible. Have a project which implements many stuff from your web site.

  4. Salam, saya ada dua soalan:

    1) untuk function “uart_number(adc,10,4)”, en. cuba send value adc ke vb kan? so, character
    10 dgn 4 tu untuk apa?

    2) function ni kira apa? kenapa kena tolak 48?

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    SerialPort1.Write(“S” & HScrollBar1.Value & “.”)
    If SerialPort1.BytesToRead = 4 Then
    j = 0
    For Me.i = 1 To 4
    Rx(j) = SerialPort1.ReadByte
    j = j + 1
    Next
    End If

    ADC = Val((Rx(0) – 48) & (Rx(1) – 48) & (Rx(2) – 48) & (Rx(3) – 48))
    If ADC >= 0 And ADC <= 1023 Then
    HScrollBar2.Value = ADC
    Label2.Text = HScrollBar2.Value
    End If
    End Sub

    Terima Kasih :)

    1. W/salam, Nor.
      1) 10 tu untuk nombor decimal, 4 tu untuk bilangan digit
      2) Tolak 48 untuk tukar nombor ASCII kpd integer. Nombor 0 bersamaan 0x30 (48) ASCII.

  5. salam… nak tny, kalau utk buat vb(input) —>> arduino xbee (output) utk bce data yg diletakkan dalam vb, kena buat serial port mcm ni jgak ke?? boleh bg info??

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.