![Infineon 82C900 Скачать руководство пользователя страница 13](http://html1.mh-extra.com/html/infineon/82c900/82c900_application-note_2055171013.webp)
AP29002
Standalone TwinCAN Controller
Using special features of the 82C900
Application Note
12
V 1.0, 2004-02
The following C function transfers 1 data byte to the address specified as a parameter:
void SSC_SendByte(word StartAddress, byte Data)
{
SSC_SetPage(StartAddress >> 7);
// extract 4 MSBs (= page number) from StartAddress
SLS = 0;
// set SLS=0, new communication sequence
while(RDY==0){};
// wait for RDY==1 -> 82C900 is ready
SSCRIR = 0;
// reset receive interrupt request
SSCTB = PAGE_WRITEMASK | StartAddress;
// mask for write, load transmit buffer register
// with StartAddress
while(!SSCRIR){};
// wait for end of transmission
while(RDY==0){};
// wait for RDY==1 -> 82C900 is ready
SSCRIR = 0;
// reset receive interrupt request
SSCTB = Data; // load transmit buffer register with Data
while(!SSCRIR){};
// wait for end of transmission
while(RDY==0){};
// wait for RDY==1 -> 82C900 is ready
SLS = 1;
// set SLS=1, communication sequence end
}
First the four MSB bits are extracted from the address as they specify the page. Then
the page is set in the 82C900’s
PAGE
register using the
SSC_SetPage
function
described before. After that, the write indication bit is added to the remaining 7 address
bits and address byte is being transferred via the SSC. Then the data byte is
transferred completing the communication sequence.
This procedure is the same for all Infineon microcontrollers containing a SSC
peripheral.
Reading a byte from the 82C900 works similar to writing:
First the four MSB bits are extracted from the address as they specify the page. Then
the page is set in the 82C900’s
PAGE
register using the
SSC_SetPage
function
described before.