hello! I'm new here and beginner
I need help with a problem I have no idea how to solve.
I'm trying to control the AD7376 via SPI from PIC 18F4520.
the signals seem correct in SPI pins, according to AD7376 datasheet:
but the potentiometer only works ok when sending odd decimal data (binary final 1)
spi_write (x);
231 or 11100111 works
232 or 11101000 not
233 or 11101001 works
234 or 11101010 not
235 or 11101011 works
236 or 11101100 not
...
my code:
VOID main (VOID)
{
setup_spi ( SPI_MASTER | SPI_H_TO_L | SPI_XMIT_L_TO_H | SPI_CLK_DIV_64 ); //mode 3
output_high (pin_b0); //chip select
delay_ms (1000);
WHILE (1)
{
output_low (pin_b0); //chip select
spi_write (3);
output_high (pin_b0); //chip select
delay_ms (5000); //time for measure
}
}
any idea what might be happening?
thanks all.
Regards.