OM13008,598 NXP Semiconductors, OM13008,598 Datasheet - Page 353

no-image

OM13008,598

Manufacturer Part Number
OM13008,598
Description
BOARD LPC XPRESSO LPC122X
Manufacturer
NXP Semiconductors
Series
LPCXpressor
Datasheets

Specifications of OM13008,598

Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Other names
568-6642
OM13008
NXP Semiconductors
23.4 Examples
UM10441
User manual
23.4.1 Initialization
23.4.2 Signed division
23.4.3 Unsigned division with remainder
The example C-code listing below shows how to initialize the API’s ROM table pointer.
/* Declare table pointer */
LPC_ROM_DIV_STRUCT const* pDivROM;
/* Assign pointer to table */
pDivROM = *((LPC_ROM_DIV_STRUCT**)LPC_122x_DIVROM_LOC);
The example C-code listing below shows how to perform a signed integer division via the
ROM API.
/* Divide (-99) by (+6) */
int32_t result;
result = pDivROM->sidiv(-99, 6);
/* result now contains (-16) */
The example C-code listing below shows how to perform an unsigned integer division with
remainder via the ROM API.
/* Modulus Divide (+99) by (+4) */
uidiv_return result;
result = pDivROM-> uidivmod (+99, 4);
/* result.quot contains (+24) */
/* result.rem contains (+3) */
All information provided in this document is subject to legal disclaimers.
Rev. 1.1 — 10 March 2011
Chapter 23: LPC122x Integer division routines
UM10441
© NXP B.V. 2011. All rights reserved.
353 of 442

Related parts for OM13008,598