Shop OBEX P1 Docs P2 Docs Learn Events
Got a BS2 and an oscilloscope? — Parallax Forums

Got a BS2 and an oscilloscope?

fredsan42fredsan42 Posts: 8
edited 2009-02-14 17:29 in BASIC Stamp
So I'm trying to debug an issue I'm having interfacing to the new MLX90614 temperature sensor. I could really use some quick and relatively easy help if someone is up for it. All you need is a BS2, an oscilloscope that can export results, and a little bit of boredom. [noparse]:)[/noparse] You do NOT need the MLX sensor to help me out here.

I am attaching some sample code provided by Parallax for doing a simple demo with the BS2/MLX. All I care about getting is an oscilloscope reading of how the SEROUT sequence looks when running this program.

I would be eternally grateful to anyone feeling like helping me out here.

If you have the Parallax USB oscilloscope, that'd be great, because that's what I have, so I could very easily import the saved results. But anything will help.

Thanks in advance!

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-02-13 03:29
    fredsan42 said...
    ...eternally grateful...
    Interesting.

    But, anyway.· I have a CRT-based oscilloscope.·

    What are you angling at SEROUT-wise?

    Post Edit -- I knew I saw you on about this in another Subject.· As I see it, you cannot·connect the MLX90614 directly·to a PC serial port.· It interfaces with a Stamp directly using TTL voltage levels.· You should be able to establish a PC-to-MLX link using a MAX232 (or MAX233, for fewer parts) TTL-to-RS232 converter.

    Post Edited (PJ Allen) : 2/13/2009 3:46:25 AM GMT
  • fredsan42fredsan42 Posts: 8
    edited 2009-02-13 04:13
    Yep, eternally grateful. [noparse]:)[/noparse]

    I'm interested in seeing what the SEROUT sequence looks like so I can verify that my chip (non-BS2) is putting out the same thing. I have yet to be able to get my MLX to do anything at all, so I'm starting to suspect maybe it's bad. If I can confirm that what a BS2 puts out is the same thing I'm putting out, I can at least stop trying so many slightly different things...
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-02-13 12:19
    When "True" is used, the idle state is +5V and the Start bit is 0V.·

    The MAX232 is an inverter --·on the·logic (TTL/CMOS)·side it's·HI in, negative voltage out;·logic·LO in, postive voltage out; on the RS232 side it's negative voltage in,·logic HI out, positive voltage in, logic LO out.·
    The idle state (nothing going on)·for RS232 is negative voltage (not Ground), so the·logic idle state is +5.

    In some cases, a Stamp can be connected to a PC (through a 22K resistor), and then "Inverted" is used.

    Does your PICAXE have True and Inverted baudmodes?··The MLX is waiting for 9600, 8-N-1, True.· If not one then try the other, "roll your data."· It wouldn't have been a good idea to connect the MLX directly to a PC serial port (if you've done that.)

    Post Edit -- If you have a MAX232/233, you should give that a try.


    Post Edited (PJ Allen) : 2/13/2009 12:28:59 PM GMT
  • fredsan42fredsan42 Posts: 8
    edited 2009-02-13 13:02
    Someone on another forum mentioned that he was using an LCD display meant for a BS2 with a PICAXE, and he was able to communicate with it successfully without a MAX232 and using the inverted baud mode. It's always possible that that LCD is a bit smarter than the MLX I guess.

    The PICAXE is does have both true and inverted modes. I've tried using both, though the documentation specifies that when using true, a MAX232 should be used. I have been hesitant to do that since I thought the MAX232 increased the voltage output above (and below) +/-5V.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-02-13 15:18
    The MAX232's RS232 pins would·go to a PC,·its TTL/CMOS pins would go a Stamp, the MLX or other 5V device I/O.

    The Parallax serial LCDs use PBASIC True baudmodes.

    Maybe PICAXE calls Idle LO True, there's no microcontroller convention standard for interoperability.· I do not know anything about PICAXE.·
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-02-13 23:35
    So, I took your program and added a trigger output pin for my oscilloscope, you can't sync on data.· It loops: trigger_pin HI/LO, SEROUT, Pause, repeat process.

    Pic attached, modified program attached.
    1536 x 1152 - 124K
  • fredsan42fredsan42 Posts: 8
    edited 2009-02-14 00:35
    Thanks for your help. I broke down earlier today and bought a BS2. I just couldn't deal with the craziness anymore. It turns out the sensor works as expected with the BS2. I tried to make the programs identical for both BS2 and PICAXE. I scoped both programs running. The only thing I can find is that the entire transmission of the !ID sequence takes 11.82ms with the PICAXE and 11.56 on the BS2. The timing is very slightly different between the two, but the actual waveforms look the same, with the exception that the MLX sensor starts replying 2ms after the end of the transmission from the BS2, whereas it does nothing from with the other chip.

    Does anyone know what typical timing tolerances are for serial transmissions?

    Thanks.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-02-14 17:29
    Loathe as I was to do so, I've been researching PICAXE (NB pg. 99, Why does PICAXE only support up to 4800 baud rate on serout/serin commands?).· 4800 baud is the fastest they·can go with their internal/RC timebase.· The MLX module requires, as you know, 9600 baud, which is outside the internal/RC PICAXE envelope.

    Post Edit (newsflash) -- Though the Demo software was written using 9600 baud, you may be pleased to know that the MLX90614 features auto-baud detection: "Auto-baud detection (2400, 4800, 9600, 19.2K, 38.4K) for microcontroller-to-MLX90614 communications".· It occurred to me, all of a sudden,·that it might, but not knowing so till I took a look at the·product·page (of all things)!

    Post Edited (PJ Allen) : 2/14/2009 5:56:49 PM GMT
Sign In or Register to comment.