Problems with OnComm

jiorgi

Member
Licensed User
Hello!

I'm a beginner and I have problems to receive data from bluetooth port (in this case COM:6).
I'm from Spain, and maybe I couldn't explain like I wanted. :sign0013:

I want to connect my ipaq hw6915 by bluetooth to a serial-bluetooth converter (LM58). The connection has been established and I can send character from pocket pc to LM58 by bluetooth. Besides I have connected by RS-232 the LM58 to hyperterminal of PC. In this way I can be sure that LM58 receive data becouse it send by serial to the hyperterminal.

The problem exists when I want to send data by bluetooth from LM58 to pocket pc. The led of LM58 would be light informing that it is sending characters but it does't light. Becouse of that, I don't Know if it is problem of Lm58 or is problem of my program in basic4ppc.

I'm using the control OnComm in this form:

TextBox1.Text=TextBox1.Text & serial.InputString
Before that, when I open the com port I write this statement.
serial.EnableOnComm=True

¿What is the error?
Can you help me???

I hope you undestand my explanations, my English is not good.

Regards!!!!
 

pdablue

Active Member
Licensed User
Longtime User
PDA & Bluetooth Serial data communications.

Hi,

For more information on using a PDA to communicate with an external
Bluetooth module, visit the website:

index

This website uses an HP2210 PDA to send and receive serial data
to a BlueSmiRF bluetooth module.

The bluetooth wireless communication is at 9600 Baud, No parity,
8 data bits and 1 stop bit.

The HP2210 uses com port 8 instead of com port 6.
You may want to see if your PDA can use com port 8 instead of 6.

I do not know if HP kept the bluetooth com ports the same across
all of their PDA devices. You can try com port 8 to see if it works.
 

jiorgi

Member
Licensed User
Hello pdablue!

I've already seen that web. Before that, I didn't know anything about connecting by bluetooth a pda to a pic. That web is great!! I've learned a lot thanks to it.

Not all HP pda have the virtual com bluetooth in COM8. In my hp ipaq, the com bluetooth is COM6. I've used an aplication to see all ports of the pda.

In all ways, I tried with avery ports of the pda and it doesn't work.

Thanks for your help! If a solve the problem I'll write the solution here for help other friends who are in this situation.

Regards!!
 

Zenerdiode

Active Member
Licensed User
The led of LM58 would be light informing that it is sending characters but it does't light. Becouse of that, I don't Know if it is problem of Lm58 or is problem of my program in basic4ppc.

This is suggesting that the program you are using on the PC is not connecting to the BlueTooth port provided by the LM58. What is the LM58? A USB device? PCMCIA? SD card?

Sometimes BlueTooth devices provide two ports - one for sending and one for receiving.

¿What is the error?
Can you help me???

There's very little to work from here. Even if you don't want to post your full project, post a stripped-out version so we may see how you are handling the comms.
 

kamis

Member
Licensed User
Longtime User
:) :) :) Oye nen!!! De donde has sacao el LM58 y cuanto te ha costao. Yo quiero uno!!! :) :) :)
 

jiorgi

Member
Licensed User
This is suggesting that the program you are using on the PC is not connecting to the BlueTooth port provided by the LM58. What is the LM58? A USB device? PCMCIA? SD card?


It is a serial-bluetooth adapter. It has a DB9 connector (RS-232 communications). I've connected the LM58 to the COM2 of the PC and I'm using the hyperterminal to communicate to it. The program in basic4ppc is this:

serial.New2 (6,9600,"N",8,1)
serial.XonXoffHandshaking=False
serial.DTREnable=True
serial.MaxInputLen=0
serial.RTSEnable=False

Sub OpenPort_Click
If porttrabajo = 0 Then
serial.EnableOnComm=True
serial.PortOpen=True
porttrabajo = 1
End If
End Sub

Sub ClosePort_Click
If porttrabajo = 1 Then
serial.enableoncomm=False
serial.PortOpen=False
porttrabajo = 0
End If
End Sub

Sub serial_OnCom
TextBox1.Text=TextBox1.Text & serial.InputString
End Sub


It's a part of the program I've made. This is only the communication by bluetooth.

Thanks for your help

Regards!!!



:) :) :) Oye nen!!! De donde has sacao el LM58 y cuanto te ha costao. Yo quiero uno!!! :) :) :)

El LM58 es de la empresa LM Technologies, es un adaptador serie-bluetooth. Mira en la web de la empresa los distribuidores españoles que hay, yo creo que lo pedí en la web de expansys, que es una distribuidora de productos electrónicos. Hace mucho que lo compré y ya no me acuerdo muy bien aunque me suena que es en expansys.
El precio ya no me acuerdo, pero si te metes en la pagina que te he dicho te viene. Creo recordar que incluso el precio varia dependiendo de la tienda.

Un Saludo!!
 

Zenerdiode

Active Member
Licensed User
This page has a download for the LM058 user guide etc
LM 58
Yep, found that earlier today too.

B4X:
serial.DTREnable=True

  1. Why do you raise DTR? The LM058 does not have DSR/DTR lines, only uses RTS/CTS lines. Having said that, it probably doesn't make a difference.
  2. Make sure the PC com port is working correctly. Connect pin 2 to 3 and in Hyperterminal clear checkbox 'Echo typed characters locally' in 'ASCII Setup...' then ensure anything typed in HT is echoed back. Break your loopback to see that it no longer echos.
  3. How are you powering your LM058? If you are using the USB port, make sure it is a high power one as some laptops have a feeble current sinking ability and may not be able to drive the LM058 effectively.
  4. Make sure the DCE/DTE switch is in the correct position.
  5. The LM058 will have to be set to your desired baud rate by entering command mode and sending "L1". Hyperterminal can auto syncronise so that may explain why you can send data from the PDA but not to the PDA.

I still think that because there is no activity on the LM058 'data' LED that your problem is other than the OnComm event. If you think that it is not firing for some reason, just send some data (it will be buffered by Basic4PPC) then run the OnComm Sub by a button click.
 

jiorgi

Member
Licensed User
Itis problem of program.

Yep, found that earlier today too.

B4X:
serial.DTREnable=True

  1. Why do you raise DTR? The LM058 does not have DSR/DTR lines, only uses RTS/CTS lines. Having said that, it probably doesn't make a difference.
  2. Make sure the PC com port is working correctly. Connect pin 2 to 3 and in Hyperterminal clear checkbox 'Echo typed characters locally' in 'ASCII Setup...' then ensure anything typed in HT is echoed back. Break your loopback to see that it no longer echos.
  3. How are you powering your LM058? If you are using the USB port, make sure it is a high power one as some laptops have a feeble current sinking ability and may not be able to drive the LM058 effectively.
  4. Make sure the DCE/DTE switch is in the correct position.
  5. The LM058 will have to be set to your desired baud rate by entering command mode and sending "L1". Hyperterminal can auto syncronise so that may explain why you can send data from the PDA but not to the PDA.

I still think that because there is no activity on the LM058 'data' LED that your problem is other than the OnComm event. If you think that it is not firing for some reason, just send some data (it will be buffered by Basic4PPC) then run the OnComm Sub by a button click.

Hello Zenerdiode!!
Tonight I was working with the pda. I tried to receive data from LM58. I connected the LM58 to COM2 and controlled it by Hypeterminal. I used pocket putty to control the COM6 (bluetooth COM of the pda) to control the pocket pc. With this configuration in pocket putty:
BaudRate=19200 (as same as LM58)
Flow Control=Xon/Xoff
Non parity bit
8 bits data
2 bits Stop

I could receive data from LM58. Every characters I wrote in hyperterminal, they appeared in pocket putty terminal. So it isn't problem of LM58, it send data correctly.

Part of my program is this:

Sub App_Start
Form1.Show
serial.New2 (6,19200,"N",8,2)
serial.XonXoffHandshaking=True
Phone.New1("Form2")
Sms.New2
Intercept.New1
End Sub

Sub OpenPort_Click
If porttrabajo = 0 Then
serial.EnableOnComm=True
serial.PortOpen=True
portflag = 1
End If
End Sub

Sub ClosePort_Click
If porttrabajo = 1 Then
serial.EnableOnComm=False
serial.PortOpen=False
portflag = 0
End If
End Sub

Sub serial_OnCom
TextBox1.Text=TextBox1.Text & serial.InputString
End Sub

I don't know where is the error in the program:confused:
I don't know why I can't receive data with basic4ppc.

Thanks for all!

Regards!!!
 

jiorgi

Member
Licensed User
Solution!!!!!!!!!!!!!!!

I've solved the problem. It was the library SerialDevice.dll and the library DBComm.dll.
I've substituted this libraries for Serial2.dll and now my aplication can receive data correctly.

Thanks for all!!!!!!!!!!
Regards!!!!!!!!!!

:sign0060:
 

taximania

Well-Known Member
Licensed User
Longtime User
Great news.

In future, could you 'upload' your full 'source code' to the forum, if possible.
Someone may have realized you had a mix of .dll's involved.

I also found it quite amusing that the emails 'from my website' came from you.
Bluesmirf module ??
I didn't put 2 and 2 together even though I'd read your original post on here.

Regards Barry
 

jiorgi

Member
Licensed User
Hello Taximania!!!!!!!!!!!

I agree with you. When I finish my program I will post here for help people with similar problems.

I want to comunicate pocket pc to a PIC by bluetooth, I have to write more code in basic4ppc.

Your web is great!!!! :)
I've learned a lot reading your examples.

Thanks!
 
Top