Shop OBEX P1 Docs P2 Docs Learn Events
Timing — Parallax Forums

Timing

JBrooksJBrooks Posts: 6
edited 2005-07-15 21:17 in BASIC Stamp
I am working on a OBDII vehicle interface which uses serial communication.· I have all the necesary documentation for Chrysler vehicles (the electrical characteristics and data format vary between manufactures and I have a Jeep). However, I need to make sure my timing is correct and the Stamp manual only goes into detail concerning the·PAUSE instruction and nothing else. I need to know how long every instruction I use takes to execute. I have experience with assembly language and believe I might be able to use the information from the memory map to determine the exact timing if I know the number of cyles per instruction. I am using the BS2SX. Where can I find this information? Any help is appreciated.

thanks,
Jeff

Comments

  • dandreaedandreae Posts: 1,375
    edited 2005-07-15 17:50
    You can go to Dr. Tracy Allen's website www.emesystems.com and you will find information regarding the timing of most of the commands.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com



    Post Edited (Dave Andreae (Parallax)) : 7/15/2005 5:55:45 PM GMT
  • Ken GraceyKen Gracey Posts: 7,387
    edited 2005-07-15 17:53
    Jeff,

    It will vary based on the parameters and values you use in your commands, too.

    Do you have an oscilloscope? If not, it could be time to get one.·Don't rely entirely on anybody else's measurements though they could give you and idea of the code overhead in the PBASIC interpreter. The best way is to use a scope and measure the program execution time.

    Ken Gracey
    Parallax, Inc.
  • JBrooksJBrooks Posts: 6
    edited 2005-07-15 17:56
    do you know if there is a way to program in assembly language?
  • JBrooksJBrooks Posts: 6
    edited 2005-07-15 18:05
    I don't have a O-scope... unfortunately I can't afford one at the moment. I am an Electrical angineering student and have programed with Motorola chips in their assembly language. They had an instruction set summary that specifed the number of bytes and cycles which I used to determine the timing (varying on the type of data and addressing modes), does the stamp have anything similar?

    The data transfer is a little forgiving but I have the matrix orbital LCD and a couple of pushbuttons to control menu opperations that can throw off my timing.

    it might be time for me to get a scope....

    Thanks
    Jeff
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-07-15 18:10
    JBrooks -

    The Parallax PBASIC Stamp only supports the BASIC Language, in an interpretive form. The Javelin Stamp supports a subset of Java. There is also an SX/B compiler which supports compiled BASIC, but you can also drop into assembler, whenever you have the need to do so. The SX/B compiler supports the Ubicom SX Processors. See the Parallax web site for more information.

    I suspect you will need to use the SX/B compiler and the SX processors to achieve an OBDII vehicle interface. Just for the record, there are currently OBDII serial interfaces available. I just didn't want you "reinvent the wheel" without realizing it smile.gif

    Regards,

    Bruce Bates
  • steve_bsteve_b Posts: 1,563
    edited 2005-07-15 18:14
    Hi Jeff,

    I was looking in to using the Stamp for an OBD2 interface.
    I'm not savvy enough a programmer so I cheated and purchased an interface chip from ELM electronics ( http://www.elmelectronics.com/DSheets/ELM322DS.pdf·)

    I too have a Jeep ('02TJ) and was wanting some better idea of what was going on under the hood!

    I put together the setup cct and could 'talk' to the chip using Procomm on my laptop, but never did get around to hooking up to my Jeep.



    I don't have a great understanding of the OBD2 code (wasn't willing to buy the big protocol book) but this seemed like a half decent way to approach it....then see if I can simplify the interface cct and use a stamp.

    It is Variable Pulse Width....which shouldn't be too bad....but I'd think you'd need to have some pretty tight Pulsein loops to catch it all.

    The SX (not the BS2sx) chip would be fast enough, no doubt!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • JBrooksJBrooks Posts: 6
    edited 2005-07-15 19:01
    Dave thanks for the website. The basic stamp timing page is very informative.

    Getting an interface might be a more realistic solution. This started as a project for a college class.·
    Who else makes these chips? I knew someone had to make them I just did not know who.·

    There are three main protocols (with a forth becoming the standard in '08·I think, called CAN)
    • J1850 VPW for GM
    • J1850 PWM for Ford
    • ISO9141-2 for Chrysler·and asian vehicles.·

    Sometimes the protocols are mixed between manufactures, ie. a Ford might have VPW. I believe we need the ISO9141 ('99TJ).· Check out this website for some information.. http://www.obddiagnostics.com/index.html·This website·has some good information but it took me a while to really understand it.

    I have the ISO9141-2 documentation. The protocol is pretty simple. It transmits at 10.4k Baud except for a byte of data to signal a wakeup at the very start. All the timing is measured in msec, so any stamp is fast enough.· I plan on making a scan tool that will be able to read and diagnose trouble codes along with aquire realtime data (engine RPM, speed ....).

    The documentation was confusing.· The SAE manual details what the OBD system should be able to do but does not give specifics about the protocol (data rate, parity bits....) hence each manufacturer came up with their own "best way". SAE·protocol only governs emisions controls.·Chrysler has their own databus that is used to comunicate with nonemissions modules (instrument cluster, airbag.....) which most manufactures probably have their own. So it is necesary to get the vehicle specific protocol (ISO9141-2) along with the SAE manual that tells you which data should be sent.

    thanks for reading my ramblings. If you have any input please offer it. I have already written the code needed to initialze the ECU but need to make sure the timing is correct.·

    Jeff
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-07-15 19:33
    JBrooks,

    Just to support what was said before: the timing issues can change depending on what you are doing- remember that PBasic is tokenized- so trying to figure out timing like you do with ASM can be tricky (if not impossible for 'general' cases)- For specific code, that's when you need to Oscope...

    If you want/need to code in ASM, check out the SX chips.

    Which Motorolla chips have you worked with? I'm partial to the 68HC11 myself [noparse];)[/noparse]

    Ryan
  • JBrooksJBrooks Posts: 6
    edited 2005-07-15 19:46
    either I use an iterface chip, get an o-scope, or use an SX chip.

    an interface chip might be the best choice so far.

    I used the 68HC11. I purchased the BS2SX before taking the microcontroller class. I would highly recomend a class, even at a community college and even if it is not a Parallax chip. It gave me a greater understanding of how chips work and made clear some of the topics that were very foggy to me when I read the stamp manual.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-07-15 20:56
    I've had several classes on uControllers, and did my B.S. senior year project on 68HC11s. [noparse]:)[/noparse]

    Digital design is a science, whereas analog is an artform -

    You might give the Sx a try, and with the new carrier boards at such a great pricepoint too! I really enjoy the SXes, and it seems we have some similar background...

    Ryan
  • JBrooksJBrooks Posts: 6
    edited 2005-07-15 21:17
    Ryan,

    I was not aware that they are so inexpensive. I have already started to look into it. I definately learned a lot from the the 68HC11. And I agree with the Digital and Analog statement. I'll see what I can do with what I have until I can come up with some funds for some new toys......

    Jeff
Sign In or Register to comment.