Shop OBEX P1 Docs P2 Docs Learn Events
Question about Beau Schwabe's Generic ADC driver... — Parallax Forums

Question about Beau Schwabe's Generic ADC driver...

markaericmarkaeric Posts: 282
edited 2011-05-31 10:43 in Propeller 1
There's a line of code in the driver that specifies the ADC resolution as follows:

asm_cycles long $FFFF '(use $FFFF for 16-bit, $FFF for 12-bit, or $FF for 8-bit)


Though it's not specified, is it safe to assume I can use $03FF to achieve 10-bit resolution?


Thanks,
Mark

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-05-30 13:12
    I'm not sure which driver you're referring to (in the future, provide a link), but I would be surprised if there was something special about multiples of 4 bits. $1FF should get you 9 bits of resolution and $3FF should get you 10 bits.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-05-30 13:14
    "Though it's not specified, is it safe to assume I can use $03FF to achieve 10-bit resolution?" - Yes, this is correct. You can also avoid any scaling if you set the value for example to 3300 or $0CE4 ... this way the result is directly in millivolts.
  • markaericmarkaeric Posts: 282
    edited 2011-05-31 10:43
    Thanks Beau! That's pretty slick. 10 bits should scale nicely for what I'm doing, but I'll keep that in mind for the future!

    @Mike Green - Thanks for the response. Next time I will post a link (or code) of the object I'm referring to.
Sign In or Register to comment.