Problems with OnComm

Discussion in 'Questions (Windows Mobile)' started by jiorgi, Jun 1, 2009.

  1. jiorgi

    jiorgi Member Licensed User


    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.

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

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

  2. pdablue

    pdablue Active Member Licensed User

    PDA & Bluetooth Serial data communications.


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


    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.
  3. jiorgi

    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.

  4. Zenerdiode

    Zenerdiode Active 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?

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

    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.
  5. kamis

    kamis Member Licensed User

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

    jiorgi Member Licensed User

    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)

    Sub OpenPort_Click
    If porttrabajo = 0 Then
    porttrabajo = 1
    End If
    End Sub

    Sub ClosePort_Click
    If porttrabajo = 1 Then
    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


    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!!
  7. taximania

    taximania Well-Known Member Licensed User

    Hi Jorge :)

    This page has a download for the LM058 user guide etc
    LM 58

    I'm thinking it's a Baud rate problem.
    It states the LM58 baud rate is 19200.

    Just an idea.
  8. Zenerdiode

    Zenerdiode Active Member Licensed User

    Yep, found that earlier today too.

    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.
  9. jiorgi

    jiorgi Member Licensed User

    Itis problem of program.

    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
    serial.New2 (6,19200,"N",8,2)
    End Sub

    Sub OpenPort_Click
    If porttrabajo = 0 Then
    portflag = 1
    End If
    End Sub

    Sub ClosePort_Click
    If porttrabajo = 1 Then
    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!

  10. jiorgi

    jiorgi Member Licensed User


    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!!!!!!!!!!

  11. taximania

    taximania Well-Known Member Licensed 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
  12. jiorgi

    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.

  13. Zenerdiode

    Zenerdiode Active Member Licensed User

    Which is why I asked you to upload the full source code that demonstrated your problem. :rolleyes:

    Glad you're sorted now. :)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice