TeamElectronics / MCP4261
Embed: (wiki syntax)

« Back to documentation index

MCP4261 Class Reference

MCP4261 Class Reference

Interface to the 7/8-Bit Single/Dual SPI Digital POT with Non-Volatile Memory. More...

#include <MCP4261.h>

Public Member Functions

 MCP4261 (SPI &spi, PinName nWP, PinName nSHDN, PinName nCs)
 Create an instance of the MCP4261 connected via specfied SPI instance.
 MCP4261 (PinName nWP, PinName nSHDN, PinName mosi, PinName miso, PinName sck, PinName nCs)
 Create an instance of the MCP4261 connected with SPI pins.
int read (char address)
 Read an Address.
void write (char address, int data)
 Write to Address.
void inc (bool number)
 Increment wiper.
void dec (bool number)
 Decrement wiper.
int status ()
 Read the Status register.
int tcon ()
 Read the tcon register.
void tcon (int data)
 write to tcon register.
int wiper (bool number)
 Read the Volatile Wiper.
void wiper (bool number, int data)
 write to Volatile Wiper.
int nvwiper (bool number)
 Read the non-volatile wiper (Power On Reset start value).
void nvwiper (bool number, int data)
 write to non-volatile wiper (Power On Reset start value).
void shdn (bool act)
 HARDWARE SHUTDOWN PIN (SHDN)
void wp (bool act)
 HARDWARE WRITE PROTECT PIN (WP)

Detailed Description

Interface to the 7/8-Bit Single/Dual SPI Digital POT with Non-Volatile Memory.

Using the driver:

  • remenber to setup SPI in main routine or use pins instance.

Defaults in this driver on start up:

  • as default is HARDWARE WRITE PROTECT PIN "Off".
  • as default is HARDWARE SHUTDOWN PIN "Off".

Definition at line 64 of file MCP4261.h.


Constructor & Destructor Documentation

MCP4261 ( SPI &  spi,
PinName  nWP,
PinName  nSHDN,
PinName  nCs 
)

Create an instance of the MCP4261 connected via specfied SPI instance.

Parameters:
spiThe mbed SPI instance (make in main routine)
nWPThe Hardware Write Protect Control pin.
nSHDNThe Shutdown pin.
nCsThe SPI chip select pin.

Definition at line 30 of file MCP4261.cpp.

MCP4261 ( PinName  nWP,
PinName  nSHDN,
PinName  mosi,
PinName  miso,
PinName  sck,
PinName  nCs 
)

Create an instance of the MCP4261 connected with SPI pins.

Parameters:
nWPThe Hardware Write Protect Control pin.
nSHDNThe Shutdown pin.
mosiThe SPI Master Output, Slave Input pin.
misoThe SPI Master Input, Slave Output pin.
sckThe SPI Serial Clock pin.
nCsThe SPI chip select pin.

Definition at line 35 of file MCP4261.cpp.


Member Function Documentation

void dec ( bool  number )

Decrement wiper.

Parameters:
numberThe selected wiper to decrement.

Definition at line 71 of file MCP4261.cpp.

void inc ( bool  number )

Increment wiper.

Parameters:
numberThe selected wiper to increment.

Definition at line 53 of file MCP4261.cpp.

int nvwiper ( bool  number )

Read the non-volatile wiper (Power On Reset start value).

Parameters:
numberThe wiper number = '0' or '1'
Returns:
The 16 bits read.

Definition at line 134 of file MCP4261.cpp.

void nvwiper ( bool  number,
int  data 
)

write to non-volatile wiper (Power On Reset start value).

Parameters:
numberThe wiper number = '0' or '1'
dataThe 16 bits to write to the register

Definition at line 147 of file MCP4261.cpp.

int read ( char  address )

Read an Address.

Parameters:
addressThe selected register to read from.
Returns:
The 16 bits read.

Definition at line 42 of file MCP4261.cpp.

void shdn ( bool  act )

HARDWARE SHUTDOWN PIN (SHDN)

Parameters:
actSHDN is Active = true and Inactive = false

Definition at line 160 of file MCP4261.cpp.

int status (  )

Read the Status register.

Returns:
The 16 bits read.

Definition at line 90 of file MCP4261.cpp.

int tcon (  )

Read the tcon register.

Returns:
The 16 bits read.

Definition at line 96 of file MCP4261.cpp.

void tcon ( int  data )

write to tcon register.

Parameters:
dataThe 16 bits to write to the register

Definition at line 102 of file MCP4261.cpp.

void wiper ( bool  number,
int  data 
)

write to Volatile Wiper.

Parameters:
numberThe wiper number = '0' or '1'
dataThe 16 bits to write to the register

Definition at line 121 of file MCP4261.cpp.

int wiper ( bool  number )

Read the Volatile Wiper.

Parameters:
numberThe wiper number = '0' or '1'
Returns:
The 16 bits read.

Definition at line 108 of file MCP4261.cpp.

void wp ( bool  act )

HARDWARE WRITE PROTECT PIN (WP)

Parameters:
actWP is Active = true and Inactive = false

Definition at line 166 of file MCP4261.cpp.

void write ( char  address,
int  data 
)

Write to Address.

Parameters:
addressThe selected register to write to.
dataThe 16 bits to write to the register

Definition at line 48 of file MCP4261.cpp.