Home > other >  ADS1247 register can't read, read out for 3 f?? Using a simulation SPI.
ADS1247 register can't read, read out for 3 f?? Using a simulation SPI.

Time:01-06

//ADS1247 write eight
Void WriteByteADS1247 (unsigned char 1 _ u8WriteData)//8 bit
{
unsigned char i;
Ad1247_ DelayUs (500);
for (i=0; i<8; I++)
{
ADS1247_ SCLK1;
Ad1247_ DelayUs (500);
If (1 _ u8WriteData & amp; 0 x80)
{
ADS1247_ DIN1;
}
The else
{
ADS1247_ DIN0;
}
1 _ u8WriteData & lt; <=1;
ADS1247_ SCLK0;
Ad1247_ DelayUs (500);
}
Ad1247_ DelayUs (2);
}

//ADS1247 8 bits of data read
Unsigned char ReadByteADS1247 (void)//8 bit
{
unsigned char i;
Unsigned char l_ u8ReadDate=0;
ADS1247_ CS0.
While (ADS1247_ DRDY);
for(i=0; i<8; I++)
{
ADS1247_ SCLK0;
Ad1247_ DelayUs (500);
L_ u8ReadDate & lt; <=1;
If (ADS1247_ DOUT)
{
L_ u8ReadDate |=0 x01;
ADS1247_ SCLK1;
Ad1247_ DelayUs (500);
}
}
Ad1247_ DelayUs (500);
ADS1247_ CS0.
Return l_ u8ReadDate;
}

//ADS1247 initialization program
Void ADS1247_ Init (void)
{
HAL_ Delay (100);
Unsigned char u8TestValue l=https://bbs.csdn.net/topics/0;
ADS1247_ CS1;
ADS1247_ SCLKl;

ADS1247_ CS0.
WriteByteADS1247 x06 (0);
ADS1247_ CS1;
HAL_ Delay (100);

ADS1247_ CS0. .
X42 WriteByteADS1247 (0);//write address 0 x02 register
WriteByteADS1247 (0 x00); 1/write a register
X38 WriteByteADS1247 (0);//write 0 x38
ADS1247_ DIN1;
ADS1247_ CS1;

ADS1247_ CS0. .
WriteByteADS1247 (0 x22);//read address 0 x03 register
WriteByteADS1247 (0 x00);//read a register
WriteByteADS1247 (ADS1247_ COMMAND NOP);
ADS1247_ CS1;

L_ u8TestValue=https://bbs.csdn.net/topics/ReadByteADS1247 ();
Printf (" l_ u8TestValue=https://bbs.csdn.net/topics/0x&x/r/n ", l _u8TestValue);

ADS1247_ CS0. .
WriteByteADS1247 x04 (0);
ADS1247_ CS1;
}

I just want to write a first data to a register, and then try to write it into the value read it out, but has not been correctly, what is wrong??
https://e2echina.ti.com/question_answer/analog/data_converters/f/58/t/198020? Tisearch=e2e - sitesearch& Keymatch=% 20 user % 3 a110720
Here are my sequence diagram
  • Related