CP3BT26G18NEP/HAPB National Semiconductor, CP3BT26G18NEP/HAPB Datasheet - Page 192

no-image

CP3BT26G18NEP/HAPB

Manufacturer Part Number
CP3BT26G18NEP/HAPB
Description
Manufacturer
National Semiconductor
Datasheet

Specifications of CP3BT26G18NEP/HAPB

Operating Temperature (min)
-40C
Operating Temperature (max)
85C
Operating Temperature Classification
Industrial
Mounting
Surface Mount
Pin Count
128
Package Type
LQFP
Lead Free Status / RoHS Status
Not Compliant
24.4.1
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; NAME: ACBRead
;
;
;
;
;
; PARAMETERS:
;
;
;
;
; CALLS:
;
; RETURNED: error status
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
UWORD
{
KBD_OUT &= ~BIT0;
KBD_OUT &= ~BIT0;
KBD_OUT &= ~BIT0;
//
ACB_T
UBYTE
UWORD
acb =
if (Addrs != NextAddress) {
KeyInit();
}
if ((err = ACBStartX (Slave | (Addrs >> 7 & 0x0E), ACB_READ, Count)))
rcv =
while (Count) {
}
KBD_OUT &= ~BIT0;
ACBRead (UBYTE Slave, UWORD Addrs, UWORD Count, UBYTE *buf)
NextAddress =
if ((err = ACBStartX (Slave | (Addrs >> 7 & 0x0E), ACB_WRITE, 0)))
acb->ACBsda =
Timeout =
while (!(acb->ACBst & ACBSDAST) && !(acb->ACBst & ACBBER) && Timeout--);
if (acb->ACBst & ACBBER) {
}
if (!Timeout)
return (err);
if (Count-- == 1)
Timeout =
while (!(acb->ACBst & ACBSDAST) && Timeout--);
if (!Timeout)
*rcv++
NextAddress++;
Avoiding Bus Error During Write Transaction
ACBStartX
*acb;
err, *rcv;
Timeout;
(ACB_T*)ACB_ADDRESS;
return (err);
acb->ACBst
return (ACBERR_COLLISION);
return (ACBERR_TIMEOUT);
buf;
acb->ACBctl1
return (ACBERR_TIMEOUT);
UBYTE
UWORD
UWORD
UBYTE
=
Reads "Count" byte(s) from selected I2C Slave.
Read or Write operation (as recorded in NextAddress), a "dummy" write transaction is
initiated to reset the address to the desired location.
Start sequence and the Read transaction.
which sends the Start condition and Slave address.
1000;
1000;
acb->ACBsda;
Slave
Addrs
Count
*buf
Addrs;
(UBYTE)Addrs;
|=
ACBBER;
|=
-
-
-
-
ACBACK;
Slave Device Address. Must be of format 0xXXXX0000
Byte/Array address (extended addressing mode uses two byte address)
Number of bytes to read
Pointer to receive buffer
/* Set pointer to ACB module
/* If the indicated address differs from the last
/* recorded access (i.e. Random Read), we must first
/* send a "dummy" write to the desired new address..
/* Update last address placeholder
/* Send start bit and Slave address...
/* If unsuccessful, return error code
/* Send new address byte
/* Set timeout
/* Wait for xmitter to be ready...zzzzzzzzz
/* If a bus error occurs while sending address, clear
/* the error flag and return error status
/* If we timeout, return error
/* (Re)Send start bit and Slave address...
/* If error, return
/* Get address of read buffer
/* Read Count bytes into user’s buffer
/* If this the final byte, or only one requested, send
/* the NACK bit after reception
/* Set timeout
/* Timed out??
/* YES - return error
/* NO - Read byte from Recv register
/* Adjust current address placeholder
All transactions begin with a call to ACBStartX
If read address differs from previous
Checks for errors throughout process.
This is followed by a repeated
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/

Related parts for CP3BT26G18NEP/HAPB