16F877A nın portlarını VB ile okumak...

hkeskin

Üye
Katılım
1 Ağu 2008
Mesajlar
56
Puanları
1
Yaş
39
Selam arkadaşlar..
16F877A nın portlarını VB ile okumak için yardımlarınız lazım..

örneğin PORTA nın 6 girişi için ayrı ayrı byte cinsinden

label1.text = 1. giriş
label2.text = 2. giriş
..
..
..
label6.text = 6. giriş

PORTB nin 8 girişi için

label7.text = 1. giriş
label8.text = 2. giriş
..
..
..
label14.text = 8. giriş

aynı şekilde POTRC.. PORTD .. PORTE yide satır satır byte cinsinden label lere nasıl okutabilirim..

örnek kod veya kaynak göstereirmisiniz..
 
slm arkadaşlar uzun araştırmalar sonucu anlatmaya çalıştığım şeyi yaptım.. vb ile pic in portlarındaki veriyi ayrı ayrı label lere yazdırdım bundan sonrası tamamen fantazi... kolay gelsinn

Kod:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Imports
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System[/SIZE]
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Imports
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]System.Threading[/SIZE]
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Public
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Form1[/SIZE]
[SIZE=2]    
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] SerialPort1_DataReceived([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.IO.Ports.SerialDataReceivedEventArgs) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] SerialPort1.DataReceived[/SIZE]
[SIZE=2]        Thread.Sleep(300)
     
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] a [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = SerialPort1.ReadExisting[/SIZE]
[SIZE=2]        TextBox1.Text = a
      
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] porta, portb, portc, portd, porte [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2]        porta = Convert.ToInt32(Mid(a, 2, 3))
        portb = Convert.ToInt32(Mid(a, 6, 3))
        portc = Convert.ToInt32(Mid(a, 10, 3))
        portd = Convert.ToInt32(Mid(a, 14, 3))
        porte = Convert.ToInt32(Mid(a, 18, 3))

        Label1.Text = porta
        Label2.Text = portb
        Label3.Text = portc
        Label4.Text = portd
        Label5.Text = porte
   
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Button2_Click([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Button2.Click[/SIZE]
[SIZE=2]        SerialPort1.PortName = [COLOR=#a31515]"COM1"[/COLOR]
       SerialPort1.Open()
    
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
End
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE][/COLOR][/SIZE]
 
Moderatör tarafında düzenlendi:

Forum istatistikleri

Konular
128,207
Mesajlar
915,824
Kullanıcılar
449,987
Son üye
mavcil19

Yeni konular

Geri
Üst