Writing data to the chip should look like this:
unsigned char
HtrcWriteData(unsigned char ucData, tBoolean tReadByte)
{
static unsigned char bitOR[] =
{
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
};
unsigned char ucReadByte;
int bitShift;
/* Start transfer */
HTRC_CLK_HIGH();
SysCtlDelay(g_ulDelayHold);
HTRC_SOUT_LOW();
SysCtlDelay(g_ulDelayHold);
HTRC_SOUT_HIGH();
SysCtlDelay(g_ulDelayHold);
for(bitShift = 0; bitShift < 8; bitShift++)
{
HTRC_CLK_LOW();
SysCtlDelay(g_ulDelayHoldHalf);
if(bitOR[7 - bitShift] & ucData)
{
HTRC_SOUT_HIGH();
}
else
{
HTRC_SOUT_LOW();
}
SysCtlDelay(g_ulDelayHoldHalf);
HTRC_CLK_HIGH();
SysCtlDelay(g_ulDelayHold);
}
if(tReadByte == false)
{
HTRC_CLK_LOW();
SysCtlDelay(g_ulDelayHoldHalf);
return 0;
}
ucReadByte = 0;
for(bitShift = 0; bitShift < 8; bitShift++)
{
HTRC_CLK_LOW();
SysCtlDelay(g_ulDelayHold);
HTRC_CLK_HIGH();
SysCtlDelay(g_ulDelayHoldHalf);
if(HTRC_SIN_READ() != 0)
{
ucReadByte |= bitOR[7 - bitShift];
}
SysCtlDelay(g_ulDelayHoldHalf);
}
HTRC_CLK_LOW();
SysCtlDelay(g_ulDelayHoldHalf);
return ucReadByte;
}