Receive Serial IR?

Discussion in 'Questions (Windows Mobile)' started by spamme0, Dec 1, 2007.

  1. spamme0

    spamme0 Member

    Need help with serial IR communication.
    Axim X51v WM5
    I ran the comports app. Says IR is Com2.
    I ran the example SerialTerminal.sbp.
    I changed the serial.new1 command to
    serial.new2(2,9600,"N",8,1) to try to force
    the correct mode.
    Still nothing.

    The data source is a PIC processor with an IR led.
    I can receive this data on a PalmIII with a program
    written in interpredted Hotpaw Basic.
    On the Axim, I can run PocketDAQ and receive the data.

    What's the secret to setting up Basic4ppc to receive
    serial Infrared data in SIR mode?
    I'm also gonna want to transmit SIR data.

    Thanks, mike
  2. Erel

    Erel Administrator Staff Member Licensed User

    Have you tried to use port 3 instead of 2?
    Serial IR port is usually port 3.
  3. spamme0

    spamme0 Member


    Seems odd that a program designed to enumerate the ports
    would give the wrong answer?? Anyway, I tried port3. That's when the
    interesting stuff happened.

    Surely, the programmers are aware that on a PDA VGA screen
    the error messages are in a modal dialog box that's
    almost full screen in portrait mode.

    In landscape mode,
    the button to dismiss the error is off screen. Often, I have to reset the pda,
    or at least kill the program
    to get out of it. It's been really annoying to have to reset and try to
    figure out where I was every time the
    program encounters an error...which is often, given my (lack of) programming
    experience. Hope that's on the bugfix list.

    The error message happened when I tried to open a non-existent
    port, port3. System locked up with no way to get out, so I had to reset it.
    After the reset, I can receive the data on com port 2. Haven't evaluated
    it thoroughly, but seems to be working.

    I'd forgotten the first rule of windows programming, "when in doubt,
    reboot everything."
    Must have been some argument over who had control of the port.
    Maybe there's a clue to a bugfix in there...or maybe just windows mobile...

    One hurdle down, thanks, mike
  4. taximania

    taximania Well-Known Member Licensed User

    I've been trying to get my Micromaxx MDPPC150 (MIO168 Clone) to receive IR from a PIC for the best part of 2 years now, and still no success.

    How are you transmitting the data from the controller, just plain 9600 serial ?
  5. RandomCoder

    RandomCoder Well-Known Member Licensed User

    spamme0, I also have an Axim X51v but do not experience the same problem as you regarding error messages.
    In both portrait and landscape modes the error messages appear in the center of the screen and occupy a reasonable area. the close button is easily accessable.

  6. spamme0

    spamme0 Member

    error msg

    So, you're saying that you're running V5.80
    You ran the SerialTerminal.sbp demo program in landscape mode.
    You gave it an invalid serial port.
    And you did NOT an error message that was too big for the page?

    Screen capture attached.

    Attached Files:

  7. spamme0

    spamme0 Member

    The format used for serialIR is "almost" RS-232 in NRZ format.
    The setup screens in SIR programs suggest that there's a stop pulse.
    I don't see one on the scope...which is a problem for simple receivers.
    It's close enough that if you send a 15uS pulse for a zero and no pulse
    for a 1, and stick with 7-bit ascii in an 8-bit word, you can make it work
    'cause the 8th bit is always zero and creates a pulse you can use for
    the end of frame. Then a simple software pulse stretcher should
    turn the NRZ into something close enough to RZ to make the UART work
    in receive mode. I've not yet needed to receive on the PIC, so haven't actually implemented that part.

    To send from the PIC,
    I hacked PBPPIC14.LIB in PicBasic to make the Debug command send in SIR.
    PocketDAQ is a good starter program to look at what's coming in over the SIR.
    The serialterminal demo program discussed in this thread also works
    once you figure out which port to use.

    Best way to get started is to use two windows PDA's running PocketDAQ.
    Once you get them talking, you can watch what's going on
    on an oscilloscope and bootstrap up from there. Another alternative
    is to use an old/cheap Palm Pilot and HotPaw Basic to receive the SIR.
    Palm Pilots are basically free.
  8. Erel

    Erel Administrator Staff Member Licensed User

  9. taximania

    taximania Well-Known Member Licensed User

    Bingo, bargain, success finally, well sort of :)

    PocketDAQ, it's a new one to me. Many thanks for pointing me to it.
    It actually see's the data I'm transmitting from the Microchip PIC16F877A I'm using.

    My PPC can see IR data from a microchip PIC. PocketDAQ proves this.
    Any ideas on how the programmers of PocketDAQ use the serial port differently to B4PPC ??

    2 years, looks like were getting somewhere :)
    Last edited: Dec 8, 2007
  10. Erel

    Erel Administrator Staff Member Licensed User

    What happens when you try to receive the data?
    Are you using Serial IR ? You can't read Native (Raw) IR data.
  11. spamme0

    spamme0 Member


    PocketDAQ is VERY tolerant of misformed signals.

    I've also found that it can receive much narrower pulses than my palm.
    Don't know if it's the method or just that the palm is much slower.

    Suggest you send something with PocketDAQ, look at it on the scope.
    Then compare to the capture from your PIC. Make sure they look the same.
  12. taximania

    taximania Well-Known Member Licensed User

    PocketDAQ can read ascii data sent via RS232 format from my PIC circuit.
    9600 baud
    8 data bits
    1 stop bit
    No parity


    It also reads useable distinguishable data from my tv and dvd remote controls.

    I even managed to code my own very 'rough' serial.dll but it still doesn't see IR data from any COM:

    How do they manage it ??
  13. agraham

    agraham Expert Licensed User

    From a Groups Google - posted by one of the PocketDaq developers when it was in beta : " It also supports serial RawIR off the Pocket PC's irda port, and we are also planning to get into using Bluetooth. " You can see it is doing this, not using a COM port, from your screenshot.

    Further Googling found this

    I don't know how relevant this is to your problem however. You will understand the PIC end better than I.
  14. spamme0

    spamme0 Member


    I'm very confused about the terms. SIR and RAWIR seem to be used
    interchangeably?? The comports program identifies the port as nativeIR??
    I'm talking about the mode with no protocol. Short IR pulses that
    are similar to RZ mode RS-232.

    Here's my repeatable experiment.

    I have two Dell Axim X51v pda's. Unit B is set up for PocketDAQ
    in RawIR mode at 9600 baud and unchanged throughout the experiment.

    Soft Reset Unit A. Run b4ppc. Run the serialterminal example.
    Set for Com2. I can read/write data between the two X51v's.

    Close b4ppc and open pocketDAQ on unit A. Set for rawir mode 9600 baud.
    I can read/write data between the two X51v's.

    Exit PocketDAQ, verify thru the running programs screen that it's really
    exited. Reload b4ppc. Run serialterminal example on unit A.
    Set for Com2.
    Unit A receives NOTHING from unit B. Sending from unit A results in
    garbage on unit B.

    Soft Reset Unit A. Run b4ppc. Run the serialterminal example.
    Set for Com2. I can read/write data between the two X51v's.

    .....repeat as necessary, always same results.

    Hypothesis: Either B4ppc or serialterminal example is not initializing
    something that got messed up by PocketDAQ.


    Just in case I'd botched the file, I reloaded the serialterminal app.
    Now, I get an error message telling me it can't load,
    but it seems to be the serialdevice.dll. So, I tried reloading that.
    Now, I get a bunch of what look like diagnostic pop-up windows.
    The app runs, but I get half a dozen popups per transmission.
    I've got three different versions of b4ppc, multiple incompatible
    dll files with the same name and who knows how many versions of the
    serialterminal app. Not at all clear what is compatible with what.
    I'm gonna go take a nap before my head explodes...oops...too late...
  15. spamme0

    spamme0 Member


    OK, I started over with a fresh installation of windows 2000, installed
    B4ppc version 5.80 and extracted the pocket pc cabfile, dll and samples
    from that. Now, the serialterminal sample runs again on the X51v.

    Reference the attached picture.
    Positive pulses represent the infrared output from the pda.
    I'm receiving the IR signal with an IR transceiver salvaged from a dead palmV.
    The light pulses are clean, full amplitude and about 10 uS wide.
    They look crappy because of the limited screen resolution of the scope
    and the necessity to get the whole character on screen.

    I soft reset the X51v, load b4ppc and use serialterminal to transmit
    the letter "E", I get the top trace. GOOD.

    Then I close B4ppc and open pocketDAQ and send the letter
    "E", I get the identical top trace. GOOD

    Then I exit PocketDAQ, Reopen B4ppc and run serialterminal.
    I send the letter "E" and get the bottom trace. BAD

    Then I soft reset the X51v, reopen B4ppc and run serialterminal.
    I send the letter "E", I get the top trace. GOOD

    This is absolutely repeatable.

    Resetting the PPC is not acceptable. Is there some program addition
    in B4ppc that
    I can use to reinitialize whatever is getting messed up by pocketDAQ?
  16. Erel

    Erel Administrator Staff Member Licensed User

    You can try to open the port and then close it as a reset method.
  17. dion

    dion Member Licensed User

    Depends on how you are driving the InfreRed Led's, direct or through an encoder like the MCP2120. With the encoder chip on the UART, it is just normal serial comms. Busy finishing off a project with one in.
  18. spamme0

    spamme0 Member

    First thing I tried...and second...
    I did some experiments with Bluetooth serial talking to a GPS.
    B4PPC has no trouble switching back and forth to the GPS virtual serial port.
    Seems to be just the IR port that's not getting initialized.
    Too bad that the IR port is the only thing I need.
    Oh well, I'd not expect any engineering resources to be applied to checking
    this...maybe I'll stumble across a workaround.
    Thanks, mike
  19. taximania

    taximania Well-Known Member Licensed User


    Finally done it. Nail on the head. Whhhoooaaaa :sign0025:

    With the help of this .dll

    I've wrote my own .dll (VB.NET) that embed's the code in serialtools.dll to establish an IR connection with my PIC project.

    It works both ways.

    I can now read and send IR info to a Microchip Pic16F877A processor 2 ways :sign0060:

    Downer. The serialtools.dll is a 14 day trial version :sign0137:

    I'm going to buy the 'Licence Key' from franson for my self, £25 ish :sign0148:
    i'm currently using the trial licence key. 14 days.

    So unless you buy a licence key, of the correct serialNET licence and can compile 'my dll' yourself with your (bought licence key) I'm not sure if any of my ramblings will work for you.

    I obviously can't 'buy' a key and then share the DLL with you.
    You need a key to enable serialNET.DLL functionality.

    I'm also considering charging £5 for my DLL

    Hey, no one else on the internet will give you this free.

    @Dzt, @AGraham, dll masters

    The code in my dll seems fine. Do you want a copy to sort out a few more error checks.

    I'm so chuffed (Derbyshire) that it actually works ;)
  20. agraham

    agraham Expert Licensed User

    Nay - that's reet Lancashire (and North Cheshire) lad. I'm glad you finally made it work :)
  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