issue using MCP3423 or MCP 3221 ADC with i2c protocol - does not convert signal

bruno.stpete

New Member
Hello, i am willing to get digital value of analogic input, using both MCP3423 and MCP3221 converters. To do so, i am using the I2C protocol. When addressing the componants, i can see that they are both detected.

Neverthless, i cannot get any conversion done and the data read back stays at 0 ! I tried various configurations but did not master to solve it (when using a PCF8591 componant, i have been able to make it working).

What did I miss in my system ? i am including my files and images of the drawing as well.

Thank you for your help,

Attached documents:
- View attachment validationMCP3423.basView attachment validationMCP3423alone.DSN


My code:
' MCP3423 for PICAXE-18M2
' http://www.picaxe.com/BASIC-Commands
' Validation of code for MCP3423/3221 CAN device
' Before executing the progam, need to choose which device want to be test
' This is done by the lines:
' CAN_address = MCPxxxx_address
' CAN_command = MCPxxxx_command
' with xxxx being the device to be tested!

'Memory naming
'(*=========*)
symbol CAN_command = b0
symbol CAN_address = b1
symbol CAN_value1 = b2
symbol CAN_value2 = b3
symbol CAN_value3 = b4
symbol CAN_value4 = b5
symbol CAN_value5 = b6

'Constant naming
'(*============*)
symbol tempo = 500

'MCP3423 CAN commands
'(*================*)
symbol MCP3423_address = %11010000
symbol MCP3423_command = %10010000

'MCP3221 CAN commands
'(*================*)
symbol MCP3221_address = %10011010
symbol MCP3221_command = %00000000

'Initialize processor parameters
'(*===========================*)
CAN_address = MCP3423_address
CAN_command = MCP3423_command
setfreq m4
call CAN_initialize

main:
call CAN_read
pause tempo
goto main

CAN_initialize:
'(===========*)
hi2csetup i2cmaster,CAN_address,i2cslow,i2cbyte
hi2cout (CAN_command)
return

CAN_read:
'(=====*)
hi2cin (CAN_value1,CAN_value2,CAN_value3,CAN_value4,CAN_value5)
return
 
Top