Shop OBEX P1 Docs P2 Docs Learn Events
Serial In/Out with ISR — Parallax Forums

Serial In/Out with ISR

SailerManSailerMan Posts: 337
edited 2007-01-22 23:25 in General Discussion
What is the formula for determining the baud rate for the SX48 @ 50MHZ and an ISR of 74 Clocks. Using a baud rate of 9600 and 19200. I have a formula at home that seems to work but I get flaky results.

Regards,
Eric
·

Comments

  • BeanBean Posts: 8,129
    edited 2007-01-22 14:05
    Eric,
    It depends on the oversampling used in the interrupt code. It seems that 3x is the mimimum. So that would be 57600 interrupts per second for 19200, and 28800 interrupt per second for 9600.

    The ISR cycles wouldn't make any difference (as long as it finished before the next ISR is due).

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
  • RsadeikaRsadeika Posts: 3,837
    edited 2007-01-22 16:41
    Hopefully, in one of the new books, they will devote, maybe a chapter, that shows how to deal with this problem, at least a problem·for me anyway. Also, lots of examples with maybe working UART program in SX/B that has a functioning Rx and Tx.

    The problem that I have is,·as soon as you want to change something like the freq, and the baud rate, everything goes down hill for me.

    Ray
  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-01-22 23:25
    Did you know that in the latest version of SX/B (1.51.03) the INTERRUPT keyword has a rate parameter that lets you specify interrupts per second? With this, all the dirty work is handled and you can change frequency without having to rewrite your interrupt code. That takes care of the freq problem; if you change the baud rate then you may have to touch up the code (perhaps change a constant value).

    I'm not to the advanced section of my book yet so I have made a mental note for myself to make sure I have some coverage on this topic.

    Post Edited (JonnyMac) : 1/22/2007 11:29:34 PM GMT
Sign In or Register to comment.