
UpperByte = SPI.transfer(0) // read one byte of result back default SPI speed (4 MHz), or high speed (8 MHz) may be used. read out data from prior conversion, provide clocks for next conversion What do you think of this? #include Ĭonst int adcCS = 53 //Chip select outputĭummyByte = SPI.transfer(0) // Initialization/Reset clocks I'm getting closer but not quite there yet. In the first RESET cycle in Figure 14), or by asserting FS high ( as shown in the second RESET cycle in Figure The RESET cycle can be terminated by either asserting CS high (as shown In this case, it is also possible to initiate the RESET cycle byĪsserting FS low if CS is already low.
Arduino mega2560 code#
This output code is useful in determining when a valid reset/initialization has occurred.

If a valid RESET cycle is issued, the data presented on the SDO output during the following cycle is FF00h. The RESET cycle is terminated by asserting CS This RESET cycle is initiated by asserting the CS pin (pin 1) low for a minimum duration of at least one SCLKįalling edge but no more than 8 SCLK falling edges in length. The TLC4541/45 each require one RESET cycle after power-on for initialization in order to operate properly. Looking at the datasheet there is at least a device initialization/RESET cycle operation required before being able to read conversions. I wasn't able to find a arduino support library after doing a quick google search.
Arduino mega2560 serial#
Serial.println(adcValue) //Prints the ADC Value to Serial Port Using a strain gage attached to 16-bit ADC, connected to anĭigitalWrite(CS, LOW) //This pin pulled LOW to enable the ADCĪdcValue = digitalRead(adcOut) //Reads the ADC value Since I'm passively viewing the output, I don't see any need for a data transfer command.Īm I on the right track or have I got it all wrong? #include In the code below, I enable the SPI, then I simply want to read the output of the ADC. It seems so simple but I'm certain I'm missing something.

I'm trying to read the value of a strain gauge using an Arduino Mega2560, but the resolution of the 10Bit ADC is too coarse, so I'm adding an external 16Bit ADC over the SPI protocol.
