greencardigan
Senior Member
Hello.
I have a MCP3424 which is a 4 channel ADC chip and it's on an arduino shield that I recently purchased.
Info re TC4 shield: http://www.mlgp-llc.com/arduino/public/arduino-pcb.html
MCP3424 Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22088c.pdf
I am trying to write to the configuration register to change the conversion resolution and gain factor but it doesn't seems to be working. When I read the data and config register back it has not changed. However, it sends back 3 data bytes then the config data which seems right for the 18bit conversion.
Here's my test code.
When running this code I get the following in the terminal window.
159
0 0 16 144
0 0 16 144
.
.
.
144 is the default value for the configuration register.
Any ideas?
I have a MCP3424 which is a 4 channel ADC chip and it's on an arduino shield that I recently purchased.
Info re TC4 shield: http://www.mlgp-llc.com/arduino/public/arduino-pcb.html
MCP3424 Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22088c.pdf
I am trying to write to the configuration register to change the conversion resolution and gain factor but it doesn't seems to be working. When I read the data and config register back it has not changed. However, it sends back 3 data bytes then the config data which seems right for the 18bit conversion.
Here's my test code.
Code:
hi2csetup i2cmaster, %11010000, i2cfast, i2cbyte 'setup for MCP3424 ADC chip
bit7 = 1 'data ready bit N/A
bit6 = 0 'channel selection bits. 00 = channel 1
bit5 = 0
bit4 = 1 'Conversion mode bit. 1 = continuous
bit3 = 1 'Sample rate bits. 11 = 18 bit conversion. Default = 00
bit2 = 1
bit1 = 1 'PGA Gain selection bits. 11 = x8. Default = 00
bit0 = 1
hi2cout 0, (b0) 'write to configuration register
sertxd (#b0,13,10)
do
hi2cin 0, (b0,b1,b2,b3) 'read 3 data bytes then config register byte
sertxd (#b0," ",#b1," ",#b2," ",#b3,13,10)
pause 1000
loop
159
0 0 16 144
0 0 16 144
.
.
.
144 is the default value for the configuration register.
Any ideas?