Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4937

Understanding SPI communications for diffrent ADC type in cpp implementation

$
0
0
I spent many hours to understand how to change ADC MCP3008 SPI communications into the ADC 0832CCN. I need to change this function:

//this works for ADC MCP 3008
Code (Text):
  1. double Mcp3008Spi::read( uint8_t channel , bool differential )
  2. {
  3.     if( channel > 7 )
  4.     {
  5.         std::cerr << "Incorrect channel number (allowed 0-7)." << std::endl;
  6.  
  7.         return 0.0 / 0.0; // NaN
  8.     }
  9.  
  10.     if( this->handle == -1 )
  11.         return 0.0 / 0.0; // NaN
  12.  
  13.     uint8_t buffer[ 3 ];
  14.  
  15.     //...
Understanding SPI communications for diffrent ADC type in cpp implementation

Viewing all articles
Browse latest Browse all 4937

Latest Images

Trending Articles



Latest Images