problem with communication with PPC and microcontroller using serial

taximania

Well-Known Member
Licensed User
Longtime User
Here's a code snippet from my PPC to a Nokia LCD screen via serial.
The letter "P" is used to position the cursor, followed by 2 more bytes, the x and y position.

Sub pos(x,y)
Serial.Output("P")
byt(0)=x
serial.Output2(byt())
byt(0)=y
serial.Output2(byt())
End Sub

Your code:
Sub Button1_Click
If serial.PortOpen = True Then
Serial.OutputBytes(dj(),0,1) 'Send the single Byte Array
Will only send 1 byte, currently set to "0"
Quote: OUTPUTBYTES (Value As Byte[], start As Int32, count As Int32)
textbox3.Text =serial.OutBufferCount
End If

End Sub

Sub Button2_Click
If serial.PortOpen = True Then
Serial.Output2(dj()) 'Send the Byte Array
I don't think this will work.
Quote: OUTPUT2 (Value As Byte[])textbox3.Text =serial.OutBufferCount
End If
End Sub


You say it works phone to phone,
micro to micro,
Are you certain all the settings are the same between the phone and micro,
eg Baud, parity, bits etc.

I'm still thinking :sign0163:
 

icefairy333

Active Member
Licensed User
Longtime User
taximania,thank u .
all the settings between the phone and micro are the same,because the communication could be established between then.but just the receiver didn't get what it should get.what a pity.
in my demo code.i used the Button1_Click to sent the first byte of dj().that means the dj(0) here.
and the Button2_Click sent the whole byte of dj().
Ijust want to test which method of the serialEX.dll is work here,but it's a pity.none.
maybe there are some obstacle between them,maybe my thought is a fault at the first time
 

taximania

Well-Known Member
Licensed User
Longtime User
Just because the phone see's the bluetooth device, doesn't mean the BT is set up right. Have you tried connecting the RX and TX lines of the module together, does the module echo back what the phone sends ?
 

taximania

Well-Known Member
Licensed User
Longtime User
As per diagram attached.
The BT should send back a copy of anything sent to it.
 

Attachments

  • this.jpg
    this.jpg
    44.3 KB · Views: 238
Top