Hello @PetrS ,
I am able to connect the NXPS32K148-EVAL board with MCP4725(12 bit DAC Module).and i am getting analog data as per my inputs.
But the same thing when i try in a loop then it is not giving the analog values based on the input values,
Code :
void setVoltage(uint16_t output)
{
uint8_t packet[3];
packet[0] = MCP4725_CMD_WRITEDAC;
packet[1] = output / 16; // Upper data bits (D11.D10.D9.D8.D7.D6.D5.D4)
packet[2] = (output % 16) << 4; // Lower data bits (D3.D2.D1.D0.x.x.x.x)
/* Send a packet of data to the bus slave */
LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C1, packet, 3, true, OSIF_WAIT_FOREVER);
}
void delay(int value)
{
while(value--)
{
}
}
int main()
{
.....
for (int i = 0 ; i < 4096 ; i++)
{
setVoltage(1000);
delay(100000);
}
......
}
it will be really helpful if you help me in this,
Thanks,
Rohit