2013-01-22 04:17 AM
i have the below function to write a single byte to 82C900 via SPI. the µC is ST10F269, have to reuse this code because its a working one, but i am not finding this code appropriate. I have to replace 82C900 with MCP2515 so i want analyse if i can use this routine.
void WriteSingleSSCByte(WORD address,BYTE data)
{ int i; BYTE page; WORD lowaddress; unsigned char *pExCANMem; unsigned char *pPage; pPage = (unsigned char*)0x0F007C; pExCANMem = (unsigned char*)0x0F0000; lowaddress=(address&0x00FF); page=(((BYTE)(address>>7)) &0x0E );do
; while(P3_7 ==0) ; *pPage = page;do
; while(P3_7 ==0); *(pExCANMem+lowaddress)=data; } these are the settings for EBC: SYSCON - 0x8515 BUSCON3 - 0xC469 ADDRSEL3 - 0x0F00 please help me understand the code. in particular ''pPage = (unsigned char*)0x0F007C'' Rgds