cancel
Showing results for 
Search instead for 
Did you mean: 

CRC check

alessandra2
Associate II
Posted on December 03, 2003 at 17:21

CRC check

2 REPLIES 2
gmeyer
Associate II
Posted on May 17, 2011 at 11:35

It would be nice if the compiler supported an instruction like:

wData = (*((huge unsigned int *)(dwAddress)));

The compiler doesn't support this so we've created a routine. Here it is. Obviously you would want to work on every address in a page before swapping to the next page when computing your CRC.

BYTE byReadAddress(DWORD dwAddress)

{

BYTE byReturn;

BYTE byPage;

BYTE byOldPage;

BYTE * pbyOffset;

// Disable Interrupts so only this routine uses the DPP while it is changed.

di();

SWITCH_TO_DPR_PAGE;

// Find the 16k page boundary

byPage = (BYTE)(dwAddress / 0x4000);

byOldPage = DPR0;

// Calculate 14bit (16k) offset

pbyOffset =(BYTE *)(dwAddress & 0x3FFF);

// set the page, Read the byte & restore the page

DPR0 = byPage;

byReturn = *pbyOffset;

DPR0 = byOldPage;

ei();

return byReturn;

}

alessandra2
Associate II
Posted on May 17, 2011 at 11:35

I would use ST9 to write a C program to check RAM and ROM (crc check). How could I direct the software to check absolut addresses? Could I have a little related example?