AnsweredAssumed Answered

FF output for AD7490

Question asked by poocha on Jul 18, 2018
Latest reply on Jul 22, 2018 by Daryl_05

I have an output problem as well. But I do not get the address bits also. I get the output as FF for all the conversion. The config address of the first channel is 0x8330 considering the write address as 1, Seq = Shadow =0, PM1 = PM0 = 1, Range =1, coding = 1. I implemented my code in CCSC as follows

 

#include <16F1789.h>
#fuses NOWDT, NOBROWNOUT, NOMCLR
#use delay(internal=8MHz, clock=8MHz)
#include <PIC16F1789_registers.h>


#use rs232(baud=9600,parity=N,xmit=PIN_B6,rcv=PIN_B7,bits=8,stream=PORT1)

#use spi(MASTER, CLK = PIN_C3, DI = PIN_C4, DO = PIN_C5, BAUD = 9600, BITS = 16, STREAM = PORT2, MODE = 2 )


void main()
{

TRISC2 = 0;

 

while(True)
{

RC2 = 0;
////////////////////////////////////////////
spi_write(PORT2, 0x83);
spi_write(PORT2, 0x30);

RC2 = 1;
delay_us(5);

RC2 = 0;


spi_write(PORT2, 0x00);
spi_write(PORT2, 0x00);

delay_us(5);


int16 vol_X = spi_xfer(PORT2);



/////////////////////////////////////////////
RC2 = 1;

fputc(vol_X, PORT1);

delay_ms(500);


}


}

 

Please can you help me with the possible problem my code is having?

Outcomes