Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001
Page 26
PP_PCF8591.BSP
•
Assemble PCF8591 circuit on breadboard
-- use on-board 4.7K resistors (R1 and R2) for pull-ups
' -----[ Title ]----------------------------------------------------------------
'
' BS2p Plus Pack
'
' File...... PP_PCF8591.BSP
' Purpose... PCF8591 A2D/D2A Demo
' Author.... Parallax
' E-mail.... [email protected]
' Started...
' Updated... 26 SEP 2001
' {$STAMP BS2p}
' -----[ Program Description ]--------------------------------------------------
'
' This program demonstates the Philips PCF8591 4-channel A2D plus 1-channel
' D2A. Channel 0 input is tied to the output of the D2A pin. Channel 1 input
' is tied to the wiper of a pot. Channes 2 and 3 are tied to Vss.
'
' The PCF85591 uses a control byte after the Slave Address. The control byte
' data (see details in PCF8591 documentation) is used to enable the analog
' output bit and set the kind of analog inputs. In this demo, the analog output
' bit is enabled and four single-ended analog inputs are used.
'
' Note that the first byte transmitted in a read cycle contains the conversion