Philips Semiconductors
P87LPC778
CMOS single-chip 8-bit microcontroller
Product data Rev. 01 — 31 March 2004 25 of 79
9397 750 12378
© Koninklijke Philips Electronics N.V. 2004. All rights reserved.
8.6.1 PWM brake function
In general when Brake is asserted the four PWM outputs are forced to a user
selected state, namely the state selected by the brakestate in PWMCON1 bits 0 to 3.
As shown in the description of the operation of the PWMCON1 register if
PWMCON1.4 is a ‘1’ brake is asserted under the control PWMCON1.7, BKCH, and
PWMCON1.5, BPEN.
As shown if both are a ‘0’ brake is asserted. If PWMCON1.7 is a ‘1’ brake is asserted
when the run bit, PWMCON0.7, is a ‘0’. If PWMCON1.6 is a ‘1’ brake is asserted
when the Brake Pin, P0.2, has the same polarity as PWMCON1.6. When brake is
asserted in response to this pin the RUN bit, PWMCON0.7, is automatically cleared.
The combination of both PWMCON1.7 and PWMCON1.5 being a ‘1’ is not allowed.
Since the Brake Pin being asserted will automatically clear the Run bit,
PWMCON0.7, the user program can poll this bit to determine when the Brake Pin
causes a brake to occur.
When the brake signal is released, the PWM pins hold their brake state assigned by
PWMCON1[3:0]. Since the RUN bit is cleared, the PWM pins will stay in the brake
state till the PWM is restarted.
The details for PWMCON1 are shown in Tables 20, 21 and 22.
2 PWM1I 0 PWM1 output is non-inverted. Output is a ‘1’ from the start
of the cycle until compare; ‘0’ thereafter.
1 PWM1 output is inverted. Output is ‘0’ from the start of the
cycle until compare; ‘1’ thereafter.
1 PWM0I 0 PWM0 output is non-inverted. Output is a ‘1’ from the start
of the cycle until compare; ‘0’ thereafter.
1 PWM0 output is inverted. Output is ‘0’ from the start of the
cycle until compare; ‘1’ thereafter.
Table 19: PWMCON0 - PWM control register 0 (address 0DAH) bit description
Bit Symbol Value Description
Table 20: PWMCON1 - PWM control register 1 (address C8H) bit allocation
Reset value: 00H
Bit 7 6 5 4 3 2 1 0
Symbol BKCH BKPS BPEN BKEN PWM3B PWM2B PWM1B PWM0B
Table 21: PWMCON1 - PWM control register 1 (address C8H) bit description
Bit Symbol Value Description
7 BKCH - See Table 2 2 below.
6 BKPS 0 ‘Brake’ is asserted if P0.2 (Brake Pin) is LOW.
1 ‘Brake’ is asserted if P0.2 (Brake Pin) is HIGH.
5 BPEN See Table 22 below.
4 BKEN 0 ‘Brake’ is never asserted.
1 ‘Brake’ is enabled (see Tabl e 2 2 below).
3 PWM3B 0 PWM3 is LOW, when Brake is asserted.
1 PWM3 is HIGH, when Brake is asserted.
Philips Semiconductors
P87LPC778
CMOS single-chip 8-bit microcontroller
Product data Rev. 01 — 31 March 2004 26 of 79
9397 750 12378
© Koninklijke Philips Electronics N.V. 2004. All rights reserved.
8.7 I
2
C-bus serial interface
The I
2
C-bus uses two wires (SDA and SCL) to transfer information between devices
connected to the bus. The main features of the bus are:
Bidirectional data transfer between masters and slaves.
Serial addressing of slaves (no added wiring).
Acknowledgment after each transferred byte.
Multimaster bus.
Arbitration between simultaneously transmitting masters without corruption of
serial data on bus.
The I
2
C-bus subsystem includes hardware to simplify the software required to drive
the I
2
C-bus. The hardware is a single bit interface which in addition to including the
necessary arbitration and framing error checks, includes clock stretching and a bus
timeout timer. The interface is synchronized to software either through polled loops or
interrupts. Refer to the application note AN422, in Section 4, entitled ‘Using the
8XC751 Microcontroller as an I
2
C-bus Master’ for additional discussion of the 87C77x
I
2
C-bus interface and sample driver routines.
Six time spans are important in I
2
C-bus operation and are insured by Timer I:
The MINIMUM HIGH time for SCL when this device is the master.
The MINIMUM LOW time for SCL when this device is a master. This is not very
important for a single-bit hardware interface like this one, because the SCL low
time is stretched until the software responds to the I
2
C-bus flags. The software
response time normally meets or exceeds the MIN LO time. In cases where the
software responds within MIN HI + MIN LO) time, Timer I will ensure that the
minimum time is met.
2 PWM2B 0 PWM2 is LOW, when Brake is asserted.
PWM2 is HIGH, when Brake is asserted.
1
1 PWM1B 0 PWM1 is LOW, when Brake is asserted.
1 PWM1 is HIGH, when Brake is asserted.
0 PWM0B 0 PWM0 is LOW, when Brake is asserted.
1 PWM0 is HIGH, when Brake is asserted.
Table 22: PWMCON1 brake condition
BPEN BKCH Brake condition
0 0 Set software break.
0 1 On when PWM not running (Brake Pin has no
effect).
1 0 On when Brake Pin asserted (PWM run has no
effect).
1 1 Clear software Brake.
Table 21: PWMCON1 - PWM control register 1 (address C8H) bit description
…continued
Bit Symbol Value Description
Philips Semiconductors
P87LPC778
CMOS single-chip 8-bit microcontroller
Product data Rev. 01 — 31 March 2004 27 of 79
9397 750 12378
© Koninklijke Philips Electronics N.V. 2004. All rights reserved.
The MINIMUM SCL HIGH TO SDA HIGH time in a stop condition.
The MINIMUM SDA HIGH TO SDA LOW time between I
2
C-bus stop and start
conditions (4.7 ms, see I
2
C-bus specification).
The MINIMUM SDA LOW TO SCL LOW time in a start condition.
The MAXIMUM SCL CHANGE time while an I
2
C-bus frame is in progress. A frame is
in progress between a start condition and the following stop condition. This time span
serves to detect a lack of software response on this device as well as external
I
2
C-bus problems. SCL ‘stuck low’ indicates a faulty master or slave. SCL ‘stuck high’
may mean a faulty device, or that noise induced onto the I
2
C-bus caused all masters
to withdraw from I
2
C-bus arbitration.
The first five of these times are 4.7 ms (see I
2
C-bus specification) and are covered by
the low order three bits of Timer I. Timer I is clocked by the 87LPC77987 CPU clock.
Timer I can be pre-loaded with one of four values to optimize timing for different
oscillator frequencies. At lower frequencies, software response time is increased and
will degrade maximum performance of the I
2
C-bus. See special function register
I2CFG description for prescale values (CT0, CT1).
The MAXIMUM SCL CHANGE time is important, but its exact span is not critical. The
complete 10 bits of Timer I are used to count out the maximum time. When I
2
C-bus
operation is enabled, this counter is cleared by transitions on the SCL pin. The timer
does not run between I
2
C-bus frames (i.e., whenever reset or stop occurred more
recently than the last start). When this counter is running, it will carry out after 1020 to
1023 machine cycles have elapsed since a change on SCL. A carry out causes a
hardware reset of the I
2
C-bus interface. In cases where the bus hang-up is due to a
lack of software response by this device, the reset releases SCL and allows I
2
C-bus
operation among other devices to continue.
8.7.1 I
2
C-bus interrupts
If I
2
C-bus interrupts are enabled (EA and EI2 are both set to 1), an I
2
C-bus interrupt
will occur whenever the ATN flag is set by a start, stop, arbitration loss, or data ready
condition (refer to the description of ATN following). In practice, it is not efficient to
operate the I
2
C-bus interface in this fashion because the I
2
C-bus interrupt service
routine would somehow have to distinguish between hundreds of possible conditions.
Also, since I
2
C-bus can operate at a fairly high rate, the software may execute faster if
the code simply waits for the I
2
C-bus interface.
Typically, the I
2
C-bus interrupt should only be used to indicate a start condition at an
idle slave device, or a stop condition at an idle master device (if it is waiting to use the
I
2
C-bus). This is accomplished by enabling the I
2
C-bus interrupt only during the
aforementioned conditions.
[1] Due to the manner in which bit addressing is implemented in the 80C51 family, the I2CON register
should never be altered by use of the SETB, CLR, CPL, MOV (bit), or JBC instructions. This is due to
the fact that read and write functions of this register are different. Testing of I2CON bits via the JB and
JNB instructions is supported.
Table 23: I2CON - I
2
C-bus control register (address D8H) bit allocation
Bit addressable
[1]
; Reset value: 81H
Bit 7 6 5 4 3 2 1 0
Symbol (R) RDAT ATN DRDY ARL STR STP MASTER -
Symbol (W) CXA IDLE CDR CARL CSTR CSTP XSTR XSTP

P87LPC778FDH,529

Mfr. #:
Manufacturer:
NXP Semiconductors
Description:
IC MCU 8BIT 8KB OTP 20TSSOP
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet