Shop OBEX P1 Docs P2 Docs Learn Events
Uncommon Baud rate — Parallax Forums

Uncommon Baud rate

turboturbo Posts: 24
edited 2008-02-20 18:02 in General Discussion
Is it possible to send out serial data at 7812 baud with the SX28? I have read through all the manuals and i cant seem to find any info on sending out serial data at uncommon baud rates . If it is not possible what extra component would i need to be able to do this?

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-02-19 10:45
    Yes, but you might have to use SXASM rather than SX/B to get the proper timing. There are examples at the SX List website, but you might have to find one particular crystal for it. The only difficulty with creating asynchronous serial i/o is that you have to use a crystal or resonator to properly hold the timing. RC circuits vary too much. You could even create an odd ball form - like 5 bits or 12 bits rather than the usual 7 or 8 bits.

    If you are sticking to a standard format without parity checking and without hardware handshaking signal, you might be able to tweak the RTCC configuration generated by a standard SX/B program and reassemble it. But nothing gets done with the the clock being a binary multiple of 7812 within less than one percent or better.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 2/19/2008 2:47:04 PM GMT
  • turboturbo Posts: 24
    edited 2008-02-19 11:13
    Thanks for the reply. Yes i am using a 4mhz xtal now i figured i might have to get a special size to be able to do this. This is for a simple program to take a analog voltage on one input pin and compare it to a table then send it out through a single wire to a dash for a temperature gauge. It uses a 7812.5 baud rate with 8bits ,no parity, and 1 stop bit.

    I may be able to fudge a little on the baud rate as i dont think the device is super picky on the rate at witch it come in at but 7812 is what the factory ECU used to communicate at.
  • BeanBean Posts: 8,129
    edited 2008-02-19 12:58
    SX/B doesn't care what baud rate you use.
    7812 baud with a 4MHz xtal should not be a problem.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-02-19 14:43
    Thanks Bean,
    It is obvious that I'm not up to speed on SX/B.
    Of course I wonder a bit what a .5 baud is. Is that something like half a person or a one and a half bathroom home?

    In truth, the device that does the reception has a bit of tolerance for frequency drift. They poll the pin mutiple times. As I recall, the minimum is 4 times for a good reading, but some do 16 times for each baud. So 7812 baud [noparse][[/noparse]or 7813] for coding purposes is fine.

    That comment about having to be a binary multiple is not exactly correct.· The RTCC has some room to make things fit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 2/19/2008 2:49:02 PM GMT
  • JonnyMacJonnyMac Posts: 9,217
    edited 2008-02-19 17:09
    To Bean's point, SX/B will do what you tell it to do. Since it compiles in place, you can use any baud rate and the compiler will calculate bit timing based on that. If the FREQ setting does not allow that given baud rate the compiler will complain.

    Your baud, 7812, is downright tame. Have a look at the first program attached, it should get you going in the right direction with SX/B. If you need to send and receive at the same time I've attached a slightly more sophisticated program that uses interrupt-driven serial; you can in fact send and receive simultaneously at your peculiar baud rate.

    Post Edited (JonnyMac) : 2/19/2008 5:48:03 PM GMT
  • turboturbo Posts: 24
    edited 2008-02-19 20:10
    OUT STANDING!!! You guys are great I have talked to a guy who has hacked the stock ECU and he said it is flexible on the incoming Buad he siad he has used 7911 so i would say 100 one way or another and it should work i will give this a try and see what it does thanks.
  • JonnyMacJonnyMac Posts: 9,217
    edited 2008-02-19 20:33
    I'm betting the 7812 is going to work for you. Why do I think this? Well, 1/7812.5 is dead on 128 microseconds -- this is suspiciously binary in nature (27).
  • turboturbo Posts: 24
    edited 2008-02-19 20:45
    Yes i did a search last night on 7812.5 Baud last night and i was really surprised how many devices use this rate for communications. Again thanks for the point in the right direction and as soon as i set up my gauge for testing and give it a go if i have any problems i will probably be back to ask for some help .
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-02-20 16:46
    SX/B seems to have become so handy that I am wondering why I am so dedicated to SSAsm.

    The truth is that I couldn't key up with the fast pace of its development. Now that things have slowed down and been well documented, it is time to take another look. Apparently, you only have to know your target baud and your clock rate to get the results. In SXAsm, you need to work though about 5 times as much.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • JonnyMacJonnyMac Posts: 9,217
    edited 2008-02-20 18:02
    You can of course mix ASM...ENDASM blocks into your SX/B code if you choose; I do that quite a lot these days.
Sign In or Register to comment.