Shop OBEX P1 Docs P2 Docs Learn Events
Simple_Serial rx issue — Parallax Forums

Simple_Serial rx issue

wch7693wch7693 Posts: 4
edited 2008-06-28 03:13 in Propeller 1
Hey, I'm new to the forum so I'm not sure if this has already been brought up.

I was messing around with Simple_Serial methods today, and I noticed that the rx method sometimes puts a 1 in bit 0 of the byte it returns, even if a 0 was sent for that bit. For example, if you were receiving the alphabet in ascii, it would be stored as acceeggiikk... etc. I fixed this by adding "b~" before the first if statement in the method, if you don't do that b is left uninitialized and you might get your first bit or'd with a 1 the first time b := ina[noparse][[/noparse]sin] << 7 | b >> 1 happens.

Comments

  • Ken PetersonKen Peterson Posts: 806
    edited 2008-06-28 02:23
    Gosh...this looks familiar. I haven't had this problem but I do remember reading about someone else having it. There might be something on the forum about it but I am not sure if it got resolved. Sorry I'm not more helpful.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-28 03:13
    You're absolutely correct. "b" is not initialized. The only local variable that's initialized is the result field. The easiest way to handle this would be to make "b" the result field like "PUB rx : b | t". Since you brought it up, how about sending a Private Message to Chip asking him to correct it as the author?
Sign In or Register to comment.