Pages: [1]   Go Down
Author Topic: [SOLVED]Writing Commands to MAX11632 ADCs without SPI  (Read 410 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys,

So I'm trying to interface with a MAX11632 ADC using an Arduino UNO board without using any SPI through the MISO, MOSI, CS, and SCK pins. The data sheet for this specific ADC can be found here:

This is the code I've written so far:
#include <SPI.h>

//Pin definitions
const int CS0 = 4;
const int CS1 = 5;
const int CS2 = 6;
const int DECODER_EN = 7;
const int MOSIPIN = 11;
const int MISOPIN = 12;
const int SCKPIN = 13;

//packet structure bytes
byte START_BYTE = '*';
byte END_BYTE = '#';
byte DELIMITER = ',';

//enumeration of channels for loops
//enum channels { CH0, CH1, CH2, CH3, CH4, CH5, CH6,
  //CH7, CH8, CH9, CH10, CH11, CH12, CH13, CH14, CH15 };

//array of conversion registries
byte channels[] = {B10000100, B10001100, B10010100,
B10011100, B10100100, B10101100, B10110100, B10111100, B11000100,
B11001100, B11010100, B11011100, B11100100, B11101100, B11110100,

//Other two setup registries
byte setupReg = B01111000;
byte averageReg = B00111100;
byte reg1 = B10000100;
byte reg2 = B10001100;
byte convReg = reg1;

void setup()
  //Set up ADC we wish to comm with
  //But don't start comm
  //This circuit has a chip select decoder to determine which of the 5 adcs to look at
  //Set clock low to prepare for data write
void loop()
  byte result;
//  Serial.println(START_BYTE);
//  for(int i = 0; i < 2; i++){
//    byte convReg;
//    if (i == 0){
//      convReg = reg1;
//    }
//    else{
//      convReg = reg2;
//    }
    //First we give the ADC register settings
    //takes input on rising clock edge
    //We then let the ADC run conversion
    //sends data to DOUT on falling clock edge
    result = analogRead(MISOPIN);
    //start comm with ADC again
    //read result from dataout
    //once we have data cut off comm
    //print out result

I'm pretty sure the ADC is not working the way it should, as I'm getting pretty much the exact same numbers no matter whether I'm reading from a channel connected to a Hall-effect sensor or a channel connected to a thermistor.

Any sort of nudge in the right direction would be much appreciated.

Thanks in advance!
« Last Edit: May 30, 2013, 07:48:46 am by awesomelyjen » Logged

Massachusetts, USA
Offline Offline
Tesla Member
Karma: 212
Posts: 8974
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

const int MISOPIN = 12;
    result = analogRead(MISOPIN);

12 is not a valid analog input pin.

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I think I ended up resolving the problem, which was more of me not understanding how and when to use SPI.

I did need to use an SPI interface for this code and eventually got it working.

Pages: [1]   Go Up
Jump to: