pcf8591 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. Kernel driver pcf8591
  2. =====================
  3. Supported chips:
  4. * Philips PCF8591
  5. Prefix: 'pcf8591'
  6. Addresses scanned: I2C 0x48 - 0x4f
  7. Datasheet: Publicly available at the Philips Semiconductor website
  8. http://www.semiconductors.philips.com/pip/PCF8591P.html
  9. Authors:
  10. Aurelien Jarno <aurelien@aurel32.net>
  11. valuable contributions by Jan M. Sendler <sendler@sendler.de>,
  12. Jean Delvare <khali@linux-fr.org>
  13. Description
  14. -----------
  15. The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one
  16. analog output) for the I2C bus produced by Philips Semiconductors. It
  17. is designed to provide a byte I2C interface to up to 4 separate devices.
  18. The PCF8591 has 4 analog inputs programmable as single-ended or
  19. differential inputs :
  20. - mode 0 : four single ended inputs
  21. Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3
  22. - mode 1 : three differential inputs
  23. Pins AIN3 is the common negative differential input
  24. Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2
  25. - mode 2 : single ended and differential mixed
  26. Pins AIN0 and AIN1 are single ended inputs for channels 0 and 1
  27. Pins AIN2 is the positive differential input for channel 3
  28. Pins AIN3 is the negative differential input for channel 3
  29. - mode 3 : two differential inputs
  30. Pins AIN0 is the positive differential input for channel 0
  31. Pins AIN1 is the negative differential input for channel 0
  32. Pins AIN2 is the positive differential input for channel 1
  33. Pins AIN3 is the negative differential input for channel 1
  34. See the datasheet for details.
  35. Module parameters
  36. -----------------
  37. * input_mode int
  38. Analog input mode:
  39. 0 = four single ended inputs
  40. 1 = three differential inputs
  41. 2 = single ended and differential mixed
  42. 3 = two differential inputs
  43. Accessing PCF8591 via /sys interface
  44. -------------------------------------
  45. ! Be careful !
  46. The PCF8591 is plainly impossible to detect ! Stupid chip.
  47. So every chip with address in the interval [48..4f] is
  48. detected as PCF8591. If you have other chips in this address
  49. range, the workaround is to load this module after the one
  50. for your others chips.
  51. On detection (i.e. insmod, modprobe et al.), directories are being
  52. created for each detected PCF8591:
  53. /sys/bus/devices/<0>-<1>/
  54. where <0> is the bus the chip was detected on (e. g. i2c-0)
  55. and <1> the chip address ([48..4f])
  56. Inside these directories, there are such files:
  57. in0, in1, in2, in3, out0_enable, out0_output, name
  58. Name contains chip name.
  59. The in0, in1, in2 and in3 files are RO. Reading gives the value of the
  60. corresponding channel. Depending on the current analog inputs configuration,
  61. files in2 and/or in3 do not exist. Values range are from 0 to 255 for single
  62. ended inputs and -128 to +127 for differential inputs (8-bit ADC).
  63. The out0_enable file is RW. Reading gives "1" for analog output enabled and
  64. "0" for analog output disabled. Writing accepts "0" and "1" accordingly.
  65. The out0_output file is RW. Writing a number between 0 and 255 (8-bit DAC), send
  66. the value to the digital-to-analog converter. Note that a voltage will
  67. only appears on AOUT pin if aout0_enable equals 1. Reading returns the last
  68. value written.