PIC18C242 MICROCHIP [Microchip Technology], PIC18C242 Datasheet - Page 135

no-image

PIC18C242

Manufacturer Part Number
PIC18C242
Description
High-Performance Microcontrollers with 10-Bit A/D
Manufacturer
MICROCHIP [Microchip Technology]
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC18C242-I/SO
Manufacturer:
MICROCHIP
Quantity:
2 000
Part Number:
PIC18C242/JW
Manufacturer:
NS
Quantity:
10
14.3.4.1
The master device generates all of the serial clock
pulses and the START and STOP conditions. A trans-
fer is ended with a STOP condition or with a repeated
START condition. Since the repeated START condition
is also the beginning of the next serial transfer, the I
bus will not be released.
In Master transmitter mode serial data is output through
SDA, while SCL outputs the serial clock. The first byte
transmitted contains the slave address of the receiving
device (7 bits) and the Read/Write (R/W) bit. In this
case, the R/W bit will be logic ’0’. Serial data is trans-
mitted 8 bits at a time. After each byte is transmitted, an
acknowledge bit is received. START and STOP condi-
tions are output to indicate the beginning and the end
of a serial transfer.
In Master receive mode, the first byte transmitted con-
tains the slave address of the transmitting device
(7 bits) and the R/W bit. In this case, the R/W bit will be
logic ’1’. Thus, the first byte transmitted is a 7-bit slave
address followed by a ’1’ to indicate receive bit. Serial
data is received via SDA, while SCL outputs the serial
clock. Serial data is received 8 bits at a time. After each
byte is received, an acknowledge bit is transmitted.
START and STOP conditions indicate the beginning
and end of transmission.
The baud rate generator used for the SPI mode opera-
tion is now used to set the SCL clock frequency for
either 100 kHz, 400 kHz or 1 MHz I
baud rate generator reload value is contained in the
lower 7 bits of the SSPADD register. The baud rate gen-
erator will automatically begin counting on a write to the
SSPBUF. Once the given operation is complete, (i.e.
transmission of the last data bit is followed by ACK), the
internal clock will automatically stop counting and the
SCL pin will remain in its last state.
7/99 Microchip Technology Inc.
I
2
C MASTER MODE OPERATION
2
C operation. The
Preliminary
2
C
A typical transmit sequence would go as follows:
a)
b)
c)
d)
e)
f)
g)
h)
i)
j)
k)
l)
The user generates a Start Condition by setting
the START enable bit SEN (SSPCON2<0>).
SSPIF is set. The MSSP module will wait the
required start time before any other operation
takes place.
The user loads the SSPBUF with the address to
transmit.
Address is shifted out the SDA pin until all 8 bits
are transmitted.
The MSSP Module shifts in the ACK bit from the
slave device and writes its value into the
SSPCON2 register (SSPCON2<6>).
The MSSP module generates an interrupt at the
end of the ninth clock cycle by setting the SSPIF
bit.
The user loads the SSPBUF with eight bits of
data.
DATA is shifted out the SDA pin until all 8 bits are
transmitted.
The MSSP Module shifts in the ACK bit from the
slave device and writes its value into the
SSPCON2 register (SSPCON2<6>).
The MSSP module generates an interrupt at the
end of the ninth clock cycle by setting the SSPIF
bit.
The user generates a STOP condition by setting
the STOP enable bit PEN (SSPCON2<2>).
Interrupt is generated once the stop condition is
complete.
PIC18CXX2
DS39026B-page 135

Related parts for PIC18C242