I am trying to read a data stream of 80 bits that's going to come into SCIbRx. The first 16 bits is Sync Pattern, next 16 is ID, next 16 is command (bits of interest),
next 16 is argument (filled with zeros), and the last 16 bits are checksum. I have a preliminary code written below. I hope it can be followed. I am having some
difficulty.
First, how do I store all 80 bits into a variable when the SCIBRx_BUF is only 8 bits long. I am trying to do something like that to look at Sync Pattern below.
Secondly, is it possible to store 16 bits at a time into different variables.
Thirdly, what command controls when to write in buffer when it is filled with first 8 bits, because I was thinking to store those values in a variable, clear the buffer, write to buffer and start all over again?
Lastly, is there a good crc program for F28335 control card?
Thanks.
Waqqas
{
Uint16 i;
Uint16 Sync = 0x7E;
// A constant value which always marks the start of a packet
Uint16 StreamLength = 80;
// Number of bits in payload;
Uint16 crc;
//Checksum
Uint16 SyncPattern;
Uint16 myID;
Uint16 Data;
rdataB = ScibRegs.SCIRXBUF.all;
// Read data
SyncPattern = (rdataB & 0xFF) >> 16;
while
(rdataB > 0) {
// SCIB Available Data
// read the incoming byte: // Read data
if
(SyncPattern == Sync)
{
myID = (rdataB & (16 << StreamLength - 16)) != 0;
Data = (rdataB & 0x0F);
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1;
// Clear Overflow flag
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1;
// Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100;
// Issue PIE ack
}