The document is an acknowledgement by the authors expressing gratitude to their guide Mr. Ratnesh S. Sengar and Mr. Saurabh Mishra for their guidance and support in successfully completing their project. It thanks them for their valuable suggestions, inspiration, and help throughout all stages of the project. The authors also acknowledge exchanging ideas with various other people.
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardBharat Biyani
- Designed a 4 stage pipelined, 16-bit customizable microprocessor in VHDL which can execute instructions (direct & memory mapped addressing modes), handle interrupts (IVT based), communicate with IO devices including keyboard and VGA monitor and facilitates with a single port BLOCK RAM for Stack, Instruction , Data & IVT memory. Keyboard and VGA controller provides input-output interface gives user flexibility of keying in the instructions through Keyboard that is interfaced with Nexys 3 through USB 2.0; VGA interface to display the output. Keyboard and VGA controllers are also coded in VHDL.
- Implemented the VHDL code on Nexys 3 Spartan FPGA board which involved simulation, synthesis and bit file generation using Xilinx ISE,programming the FPGA with Digilent Adept.
- Employed the debug mode to make the design more user friendly
SMS(Short Message Service)plays vital role in
day to day life. SMS used in many real world application like
Transportation Information System, private health facilities
using SMS, mobile banking, participation in elections through
SMS, in Crime Scene Investigation and many more.The major
problem facing in SMS is security ,while transferring message
like account number or password from one user to another
user it just taken as a plain text so there some type of attacks
like man in the middle attack, disclosure, replay attack takes
place and causing a huge risk. The traditional SMS service
does not provide information security like confidentiality,
integrity, authenticity. The attacker can alter SMS Information
using weak encryption algorithm like A5/1 or A5/2.The existing
protocol used for providing security in SMS is based on
asymmetric and symmetric key. To provide secure end to end
communication Easy SMS protocol is used which is completely
based on symmetric key. On applying AES algorithm it may
provide effective encryption for password. The expecting result
on using Easy SMS protocol is to reduce bandwidth
consumption and increasing the password or pass code
strength through SMS.
— in distributed computing environment, Mobile agents
are mobile autonomous processes which operate on behalf of
users (e.g., the Internet). These applications include a specialized
search of a middleware services such as an active mail system,
large free-text database, electronic malls for shopping, and
updated networking devices. Mobile agent systems use less
network bandwidth, increase asynchrony among clients and
servers, dynamically update server interfaces and introduce
concurrency. Due to software components, security of mobile
agent is essential in any mobile agent based application. Security
services such as Confidentiality, Integrity, Authentication,
Authorization and Non-Repudiation are discussed and combat
with by the researchers. This work is proposing a new technique
for access control area of security for the mobile agents and it
will be implemented using an example of shopping cart data
sharing for multiple levels.
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardBharat Biyani
- Designed a 4 stage pipelined, 16-bit customizable microprocessor in VHDL which can execute instructions (direct & memory mapped addressing modes), handle interrupts (IVT based), communicate with IO devices including keyboard and VGA monitor and facilitates with a single port BLOCK RAM for Stack, Instruction , Data & IVT memory. Keyboard and VGA controller provides input-output interface gives user flexibility of keying in the instructions through Keyboard that is interfaced with Nexys 3 through USB 2.0; VGA interface to display the output. Keyboard and VGA controllers are also coded in VHDL.
- Implemented the VHDL code on Nexys 3 Spartan FPGA board which involved simulation, synthesis and bit file generation using Xilinx ISE,programming the FPGA with Digilent Adept.
- Employed the debug mode to make the design more user friendly
SMS(Short Message Service)plays vital role in
day to day life. SMS used in many real world application like
Transportation Information System, private health facilities
using SMS, mobile banking, participation in elections through
SMS, in Crime Scene Investigation and many more.The major
problem facing in SMS is security ,while transferring message
like account number or password from one user to another
user it just taken as a plain text so there some type of attacks
like man in the middle attack, disclosure, replay attack takes
place and causing a huge risk. The traditional SMS service
does not provide information security like confidentiality,
integrity, authenticity. The attacker can alter SMS Information
using weak encryption algorithm like A5/1 or A5/2.The existing
protocol used for providing security in SMS is based on
asymmetric and symmetric key. To provide secure end to end
communication Easy SMS protocol is used which is completely
based on symmetric key. On applying AES algorithm it may
provide effective encryption for password. The expecting result
on using Easy SMS protocol is to reduce bandwidth
consumption and increasing the password or pass code
strength through SMS.
— in distributed computing environment, Mobile agents
are mobile autonomous processes which operate on behalf of
users (e.g., the Internet). These applications include a specialized
search of a middleware services such as an active mail system,
large free-text database, electronic malls for shopping, and
updated networking devices. Mobile agent systems use less
network bandwidth, increase asynchrony among clients and
servers, dynamically update server interfaces and introduce
concurrency. Due to software components, security of mobile
agent is essential in any mobile agent based application. Security
services such as Confidentiality, Integrity, Authentication,
Authorization and Non-Repudiation are discussed and combat
with by the researchers. This work is proposing a new technique
for access control area of security for the mobile agents and it
will be implemented using an example of shopping cart data
sharing for multiple levels.
Cooperative communication has emerged as a new
dimension of diversity to emulate the strategies designed for
multiple antenna systems, since a wireless mobile device may not
be able to support multiple transmit antennas due to size, cost,
or hardware limitations. Capacity optimization of the wireless
network is performed by making changes in the physical layer of
the network. In this article, we propose a Capacity-Optimized
Cooperative (COCO) topology control scheme to improve the
network capacity in MANETs by jointly considering both upper
layer network capacity and physical layer cooperative
communications. Simulations in the network simulator are
performed to show the efficiency of the system.
Cooperative communication has received tremendous interest
for wireless networks. Most existing works on cooperative
communications are focused on link-level physical layer issues.
Consequently, the impacts of cooperative communications on
network-level upper layer issues, such as topology control,
routing and network capacity, are largely ignored. In this
article, we propose a Capacity-Optimized Cooperative (COCO)
topology control scheme to improve the network capacity in
MANETs by jointly considering both upper layer network
capacity and physical layer cooperative communications.
Through simulations, we show that physical layer cooperative
communications have significant impacts on the network
capacity, and the proposed topology control scheme can
substantially improve the network capacity in MANETs with
cooperative communications.
Всероссийская интернет-площадка teach4teach.ru предназначена для продажи и обмена цифровыми учебно-методическими материалами и продвижения инновационных разработок педагогов. Авторы получают возможность не только дополнительного заработка от продажи своих материалов, но и возможность обсуждения инноваций, обмена опытом с молодым или опытными учителями.
Инновационные подходы к использованию ДОТ.
Смешанное обучение.
Методика использования социальной сети 4portfolio.ru в качестве образовательной платформы.
No matter how old you are, if you find yourself unable to work due to certain medical disability, you may be eligible to apply for the Social Security Administration claim.
Origin of Microprocessor and Classification of Microprocessor Vijay Kumar
This Presentation have information about the topics are
Microprocessors evolution,
Introduction to 8085,
Basic terms,
Types of Processors,
Microprocessor Based System,
Origin of Microprocessor,
Classification of Microprocessor,
Memory,
Input and Output Devices and
Technological Improvements on Microprocessor.
ccfghlm,,fghggjjghkgkjkjkjklhljhlkjhljhlhjl
bnjkhhkbkbn,mn,mn,mn,mn,mn,mn,m,mn,bn,bn,mbn,bj,bjbj,bjbj,bm, dvglksmndgopjpjmlkvmsodfgjhonjhlkmnlkmdvokji0fpqokdf[k[akfmcadokjvojisdlkmlkswopdvgopko;pmfasd f
\plvsf[prblpk[bnpk
Wireless energy meter monitoring with automated tariff calculationUdayalakshmi JK
Electricity billing has become a difficult task. The board has to make regular visit to the consumers house to make the reading. Also it can cause manual error. Now here we are monitoring the energy meter with modern techniques. The total energy consumed by the consumer and the consumption cost is known to the consumer and to the board by means of a hand held device.
2. ACKNOWLEDGEMENT
We take the opportunity to express our overwhelming sense
of gratitude for the experience and guidance which was given
to us to successfully complete the project in Department of
Remote Handling and Robotics (DRHR), BARC, Mumbai.
It was an enriching experience which we will always cherish.
In the first place we owe our immense & unpayable debt of
gratitude towards our guide Mr. Ratnesh S. Sengar, SO-F
for his valuable guidance, unabated inspiration, valuable
suggestions & most untiring help at all stages, which helped
us to complete this project in the present form. I would also
like to thank Mr. Saurabh Mishra, SO-C, DRHR for his
unflinching support. I acknowledge with a deep sense of
gratitude and appreciation the exchange of ideas with the
various people.
3. MICROCONTROLLERS
Microcontrollers are general purpose Microprocessors which have additional parts that allow
them to control external devices.
A microcontroller is a small, low-cost computer-on-a-chip which usually includes:
1. An 8 or 16 bit microprocessor (CPU).
2. A small amount of RAM.
3. Programmable ROM and/or flash memory.
4. Parallel and/or serial I/O.
5. Timers and signal generators.
6. Analog to Digital (A/D) and/or Digital to Analog (D/A) conversion.
Microcontrollers are:
1. Often used to run dedicated code that controls one or more tasks in the operation of a
device or a system.
2. Also called embedded controllers, because the microcontroller and support circuits are
often built into, or embedded in, the devices they control.
Devices that utilize microcontrollers include car engines, consumer electronics (VCRs,
microwaves, cameras, pagers, cell phones, etc.), computer peripherals (keyboards, printers,
modems, etc.), test/measurement equipment (signal generators, multi-meters, oscilloscopes
...).
The general block diagram of every microcontroller is as shown below-
4. Description of every block in the above block diagram:
I. ROM or Read Only Memory:
ROM is used to store the user instructions or program code. Every time the
microcontroller is powered the instructions in the ROM is executed. This type of
memory is non-volatile i.e. the contents of the memory are retained even if the power is
lost.
There are many types of ROMs. They are:-
i) EPROM (Erasable Programmable Read Only Memory):- This type of ROM can be
erased and programmed again. UV (Ultraviolet) rays are used to erase this kind of
memory. This type of ROM is mostly not because costly equipment is needed to
reprogram the memory.
ii) EEPROM (Electrically Erasable Programmable Read Only Memory):- It is similar
to EPROM but the memory can be erased electrically without the use of UV rays.
One disadvantage is that it takes a large amount of time to reprogram this kind of
memory.
iii) FLASH: It is similar to EEPROM but it is faster than EEPROM. But it has a smaller
lifetime compared to EEPROM.
II. RAM (Random Access Memory):- This memory is used during the execution of
program. It is for storing variables and other program data.
III. I/O PORTS: These ports are used to receive data from the external environment or
the user and also to send data. There are two types of I/O ports:-
5. i) Digital - These ports are used to send or receive digital data. Digital means discrete
data i.e. 0V or 5V.
ii) Analog - Since most of the sensors give analog data analog input pins are
commonly used to read sensor data. You can also write analog voltage values to
these ports.
IV. Timers: Timers are used to keep track of the time that has passed. Timers are
extremely useful in many cases where outputs are to be maintained for a
sufficient amount of time. These are some of the basic components present in a
microcontroller.
Microcontrollers also contain ADCs (Analog to Digital Converters), DAC (Digital to Analog
Converters) and many other peripherals.
C167CR-LM
The microcontroller with which we are concerned is C167CR-LM. A 16 bit microcontroller
manufactured by Infineon Technologies Pvt Ltd. It belongs to Infineon C166 Family, the
C167-class.
6. The microcontrollers of the Infineon 16-bit family have been designed to meet the high
performance requirements of real-time embedded control applications. The architecture of
this family has been optimized for high instruction throughput and minimum response time to
external stimuli (interrupts). Intelligent peripheral subsystems have been integrated to reduce
the need for CPU intervention to a minimum extent. This also minimizes the need for
communication via the external bus interface. The high flexibility of this architecture allows
to serve the diverse and varying needs of different application areas such as automotive,
industrial control, or data communications.
C167-type devices are members of the second generation of this family. This second
generation is even more powerful due to additional instructions for HLL support, an
increased address space, increased internal RAM and highly efficient management of various
resources on the external bus.
Enhanced derivatives of this second generation provide additional features like additional
internal high-speed RAM, an integrated CAN-Module, an on-chip PLL, etc.
Utilizing integration to design efficient systems may require the integration of application
specific peripherals to boost system performance, while minimizing the part count. These
efforts are supported by the so-called XBUS, defined for the Infineon 16-bit microcontrollers
(second generation). This XBUS is an internal representation of the external bus interface that
opens and simplifies the integration of peripherals by standardizing the required interface.
BASIC FEATURES OF C167CR-LM
Several key features contribute to the high performance of the C167CR (the indicated timings refer to
a CPU clock of 25/33 MHz).
1. High Performance 16-bit CPU with Four-Stage Pipeline.
2. Control Oriented Instruction Set with High Efficiency.
3. Integrated On-chip Memory.
4. External Bus Interface.
5. 16 – Priority Level Interrupt System.
6. 8 – Channel Peripheral Event Controller.
7. Intelligent On-chip Peripherals Subsystems.
8. 111 IO Lines with Individual Bit Addressability.
9. Different Temperature Ranges.
10.Infineon CMOS Process.
11.144-pin Plastic Metric Quad Flat Pack (MQFP) Package.
The diagram on the next page is a description of the pin diagram of C167CR-LM.
9. SERIAL COMMUNICATION
Computer transfer data in two ways: parallel and serial. In parallel data transfer, often 8 or
more lines (wire conductors) are used to transfer data to a device that is only a few feet away.
Example of parallel transfer are printers and hard disks; each use cable with many wire strips.
Although in such cases a lot of data can be transferred in a short time by using many wires in
parallel, the distance cannot be great. To transfer to a device located many meters away, the
serial method used. In serial communication, the data is sent one bit at a time, in contrast to
parallel communication, the data is sent a byte or more at a time.
Serial transfer
Parallel Transfer
D0
D7
BASICS OF SERIAL COMMUNICATION
When a microprocessor communicates with the outside world, it provides the data in byte-
sized chunk. In some cases, such as printers, the information is simply grabbed from the 8-bit
data bus and presented to the 8-bit data bus to the printer. This can only if the cable is not too
long, since the cable diminish and even distort signals. Furthermore, an 8-bit data path is
expensive, for these reason, serial communication is used for transferring data between two
system located of hundreds of feet to millions of miles a parts.
The fact that in serial communication a single data lines is used instead of the 8-bit line of
parallel communication makes it not only much cheaper but also make it possible for two
computer located in two computers located in two different cities to communicate over the
telephone.
For serial data communication to work, the byte of data must be converted to serial bits using
a parallel-in-serial-out register; then it can be transmitted over a single data line. This also
means that at the receiving end must be a serial-in-parallel-out shift register to receive the
serial data and pack them into a byte. Of course, if data is to be transferred on the telephone
Sender
s
Receive
rs
ReceiverSender
10. line, it must be converted from 0s and 1s audio tones, which are sinusoidal- shaped signals.
This conversion is performed by a peripheral device called a modem.
The Asynchronous/Synchronous Serial Interface ASC0 provides serial communication
between the C167CR and other microcontrollers, microprocessors or external peripherals.
The ASC0 supports full-duplex asynchronous communication up to 781 KBaud/ 1.03 MBaud
and half-duplex synchronous communication up to 3.1/4.1 MBaud (@ 25/ 33 MHz CPU
clock). In synchronous mode, data are transmitted or received synchronous to a shift clock
which is generated by the C167CR. In asynchronous mode, 8- or 9-bit data transfer, parity
generation, and the number of stop bits can be selected. Parity, framing, and overrun error
detection is provided to increase the reliability of data transfers. Transmission and reception
of data is double-buffered. For multiprocessor communication, a mechanism to distinguish
address from data bytes is included. Testing is supported by a loop-back option. A 13-bit
baud rate generator provides the ASC0 with a separate serial clock signal.
Ports & Direction
Control
Alternate Functions
Data Registers Control Registers Interrupt Control
ODP3 E
DP3
P3
S0BG
S0TBUF
S0RBUF
S0CON S0TIC
S0RIC
S0EIC
S0TBIC E
ODP3 Port 3 Open Drain Control Register DP3 Port 3 Direction Control Register
S0BG ASC0 Baud Rate Generator/Reload Reg. S0TBUF ASC0 Transmit Buffer Register
S0TIC ASC0 Transmit Interrupt Control Register S0TBIC ASC0 Transmit Buffer Interrupt
Ctrl. Reg.
P3 Port 3 Data Register S0CON ASC0 Control Register
S0RBUF ASC0 Receive Buffer Register (read
only) S0RIC ASC0 Receive Interrupt Control
Register
S0EIC ASC0 Error Interrupt Control Register
11. Fig. SFRs and Port Pins Associated with ASC0
ASC0 Control RegisterS0CON
The operating mode of the serial channel ASC0 is controlled by its bit addressable control
register S0CON. This register contains control bits for mode and error check selection, and
status flags for error identification.
S0CON
ASC0 Control Register
15 14 13 12 11 10 9 8 7 6 5 4 3
2 1 0
S0R S0
LB
S0
BRS
S0
ODD
- S0
OE
S0
FE
S0
PE
S0
OEN
S0
FEN
PEN S0
REN
S0
STP
S0M
Bit Function
S0M ASC0 Mode Control
000: 8-bit data synchronous operation
001: 8-bit data asynchronous operation
010: Reserved. Do not use this combination!
011: 7-bit data + parity asynchronous operation
100: 9-bit data asynchronous operation
101: 8-bit data + wake up bit asynchronous operation
110: Reserved. Do not use this combination!
111: 8-bit data + parity asynchronous operation
12. S0STP Number of Stop Bits Selection asynchronous operation
0: One stop bit
1: Two stop bits
S0REN ReceiverEnable Bit
0: Receiver disabled
1: Receiver enabled
(Reset by hardware after reception of byte in synchronous mode)
S0PEN Parity Check Enable Bit asynchronous operation
0: Ignore parity
1: Check parity
S0FEN Framing Check Enable Bit asynchronous operation
0: Ignore framing errors
1: Check framing errors
S0OEN Framing Check Enable Bit
0: Ignore overrun errors
1: Check overrun errors
13. S0PE Parity Error Flag
Set by hardware on a parity error (S0PEN = ‘1’). Must be reset by
software.
S0FE Framing Error Flag
Set by hardware on a framing error (S0FEN = ‘1’). Must be reset by
software.
S0OE Overrun Error Flag
Set by hardware on an overrun error (S0OEN = ‘1’). Must be reset by
Software
S0ODD Parity Selection Bit
0: Even parity (parity bit set on odd number of ‘1’s in data)
1: Odd parity (parity bit set on even number of ‘1’s in data)
S0BRS Baudrate Selection Bit
0: Divide clock by reload-value + constant (depending on mode)
1: Additionally reduce serial clock to 2/3rd
S0LB Loop Back Mode Enable Bit
0: Standard transmit/receive mode
1: Loop back mode enabled
S0R Baud rate Generator Run Bit
0: Baud rate generator disabled (ASC0 inactive)
1: Baud rate generator enabled
A transmission is started by writing to the Transmit Buffer register S0TBUF (via an
instruction or a PEC data transfer). Only the number of data bits which is determined by the
14. selected operating mode will actually be transmitted, i.e. bits written to positions 9 through
15 of register S0TBUF are always insignificant. After a transmission has been completed, the
transmit buffer register is cleared to 0000H. Data transmission is double-buffered, so a new
character may be written to the transmit buffer register, before the transmission of the
previous character is complete. This allows the transmission of characters back-to-back
without gaps.
Data reception is enabled by the Receiver Enable Bit S0REN. After reception of a character
has been completed, the received data and, if provided by the selected operating mode, the
received parity bit can be read from the (read-only) Receive Buffer register S0RBUF. Bits in
the upper half of S0RBUF which are not valid in the selected operating mode will be read as
zeros. Data reception is double-buffered, so that reception of a second character may already
begin before the previously received character has been read out of the receive buffer
register. In all modes, receive buffer overrun error detection can be selected through bit
S0OEN. When enabled, the overrun error status flag S0OE and the error interrupt request flag
S0EIR will be set when the receive buffer register has not been read by the time reception of
a second character is complete. The previously received character in the receive buffer is
overwritten. The Loop-Back option (selected by bit S0LB) allows the data currently being
transmitted to be received simultaneously in the receive buffer. This may be used to test serial
communication routines at an early stage without having to provide an external network. In
loop-back mode the alternate input/output functions of the Port 3 pins are not necessary.
Asynchronous Operation
Asynchronous mode supports full-duplex communication, where both transmitter and
receiver use the same data frame format and the same baud rate. Data is transmitted on pin
TXD0 and received on pin RXD0. These signals are alternate port functions.
Asynchronous Data Frames
8-bit data frames either consist of 8 data bits D7 … D0 (S0M = ‘001B’), or of 7 data bits D6
… D0 plus an automatically generated parity bit (S0M = ‘011B’). Parity may be odd or even,
depending on bit S0ODD in register S0CON. An even parity bit will be set, if the modulo-2-
sum of the 7 data bits is ‘1’. An odd parity bit will be cleared in this case. Parity checking is
enabled via bit S0PEN (always OFF in 8-bit data mode). The parity error flag S0PE will be
set along with the error interrupt request flag, if a wrong parity bit is received. The parity bit
itself will be stored in bit S0RBUF.7.
15. Fig. Asynchronous 8-bit Data Frames
9-bit data frames either consist of 9 data bits D8 … D0 (S0M = ‘100B’), of 8 data bits D7
… D0 plus an automatically generated parity bit (S0M = ‘111B’) or of 8 data bits D7 … D0
plus wake-up bit (S0M = ‘101B’). Parity may be odd or even, depending on bit S0ODD in
register S0CON. An even parity bit will be set, if the modulo-2-sum of the 8 data bits is ‘1’.
An odd parity bit will be cleared in this case. Parity checking is enabled via bit S0PEN
(always OFF in 9-bit data and wake-up mode). The parity error flag S0PE will be set along
with the error interrupt request flag, if a wrong parity bit is received. The parity bit itself will
be stored in bit S0RBUF.8.
In wake-up mode received frames are only transferred to the receive buffer register, if the 9th
bit (the wake-up bit) is ‘1’. If this bit is ‘0’, no receive interrupt request will be activated and
no data will be transferred. This feature may be used to control communication in multi-
processor system: When the master processor wants to transmit a block of data to one of
several slaves, it first sends out an address byte which identifies the target slave. An address
byte differs from a data byte in that the additional 9th bit is a ‘1’ for an address byte and a ‘0’
for a data byte, so no slave will be interrupted by a data ‘byte’. An address ‘byte’ will
interrupt all slaves (operating in 8-bit data + wake-up bit mode), so each slave can examine
the 8 LSBs of the received character (the address). The addressed slave will switch to 9-bit
data mode (e.g. by clearing bit S0M.0), which enables it to also receive the data bytes that
will be coming (having the wake-up bit cleared). The slaves that were not being addressed
remain in 8-bit data + wake-up bit mode, ignoring the following data bytes.
16. Fig. Asynchronous 9-bit Data Frames
ASC0 Interrupt Control
Four bit addressable interrupt control registers are provided for serial channel ASC0. Register
S0TIC controls the transmit interrupt, S0TBIC controls the transmit buffer interrupt, S0RIC
controls the receive interrupt and S0EIC controls the error interrupt of serial channel ASC0.
Each interrupt source also has its own dedicated interrupt vector. S0TINT is the transmit
interrupt vector, S0TBINT is the transmit buffer interrupt vector, S0RINT is the receive
interrupt vector, and S0EINT is the error interrupt vector. The cause of an error interrupt
request (framing, parity, overrun error) can be identified by the error status flags in control
register S0CON.
S0TIC
ASC0 Transmitter Interrupt Control Register
15 14 1 3 12 11 10 9 8 7 6 5 4 3 2 1 0
- - - - - - - - S0TIR S0TIE ILVL GLVL
S0RIC
ASC0 Receiver Interrupt Control Register
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- - - - - - - - S0RIR S0RIE ILVL GLVL
Parallel Ports
17. In order to accept or generate single external control signals or parallel data, the
C167CR provides up to 111 parallel IO lines organized into one 16-bit IO port (Port 2),eight
8-bit IO ports (PORT0 made of P0H and P0L, PORT1 made of P1H and P1L, Port 4, Port 6,
Port 7, Port 8), one 15-bit IO port (Port 3), and one 16-bit input port (Port 5). These port lines
may be used for general purpose Input/output controlled via software or may be used
implicitly by the C167CR’s integrated peripherals or the External Bus Controller.
All port lines are bit addressable, and all input/output lines are individually (bit-wise)
programmable as inputs or outputs via direction registers (except Port 5, of course). The IO
ports are true bidirectional ports which are switched to high impedance state when configured
as inputs. The output drivers of five IO ports (2, 3, 6, 7, 8) can be configured (pin by pin) for
push/pull operation or open-drain operation via control registers. The logic level of a pin is
clocked into the input latch once per state time, regardless whether the port is configured for
input or output.
Fig. SFRs and Pins associated with the Parallel Ports
A write operation to a port pin configured as an input causes the value to be written into the
port output latch, while a read operation returns the latched state of the pin itself. A read-
modify-write operation reads the value of the pin, modifies it, and writes it back to the output
latch.
Data Input /
Output
Registers
Direction Control
Registers
Port Driver
Control
Register
Diverse Control
Registers
P0L
P0H
P1L
P1H
P2
P3
P4
P5
P6
P7
P8
DP0L E
DP0H E
DP1L E
DP1H E
DP2
DP3
DP4
DP6
DP7
DP8
PDCR E PICON E
ODP2 E
ODP3 E
ODP6 E
ODP7 E
ODP8 E
18. Writing to a pin configured as an output (DPx.y = ‘1’) causes the output latch and the pin to
have the written value, since the output buffer is enabled. Reading this pin returns the value
of the output latch. A read-modify-write operation reads the value of the output latch,
modifies it, and writes it back to the output latch, thus also modifying the level at the pin.
Port 3
If this 15-bit port is used for general purpose IO, the direction of each line can be configured
via the corresponding direction register DP3. Most port lines can be switched into push/pull
or open drain mode via the open drain control register ODP3 (pins P3.15 and P3.12 do not
support open drain mode!).
P3
Port 3 Data Register
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
P3
.15
- P3
.13
P3
.12
P3
.11
P3
.10
P3.9 P3.8 P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0
Bit Function
P3.y Port data register P3 bit y
DP3
P3 Direction Ctrl. Register
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DP3
.15
- DP3
.13
DP3
.12
DP3
.11
DP3
.10
DP3.
9
DP3.
8
DP3.
7
DP3.
6
DP3.
5
DP3.
4
DP3.
3
DP3.
2
DP
3.1
DP
3.0
Bit Function
DP3.y Port direction register DP3 bit y
DP3.y = 0: Port line P3.y is an input (high-impedance)
19. DP3.y = 1: Port line P3.y is an output
Interrupt Enable bit IEN
Globally enables or disables PEC operation and the acceptance of interrupts by the CPU.
When IEN is cleared, no new interrupt requests are accepted by the CPU. Requests that
already have entered the pipeline at that time will process, however. When IEN is set to ‘1’,
all interrupt sources, which have been individually enabled by the interrupt enable bits in
their associated control registers, are globally enabled.
General Purpose Timer Units
The General Purpose Timer Units GPT1 and GPT2 represent very flexible multifunctional
timer structures which may be used for timing, event counting, pulse width measurement,
pulse generation, frequency multiplication, and other purposes.
They incorporate five 16-bit timers that are grouped into the two timer blocks GPT1 and
GPT2. Block GPT1 contains 3 timers/counters with a maximum resolution of 16 TCL, while
block GPT2 contains 2 timers/counters with a maximum resolution of 8 TCL and a 16- bit
Capture/Reload register (CAPREL). Each timer in each block may operate independently in a
number of different modes such as gated timer or counter mode, or may be concatenated with
another timer of the same block. The auxiliary timers of GPT1 may optionally be configured
as reload or capture registers for the core timer. In the GPT2 block, the additional CAPREL
register supports capture and reload operation with extended functionality, and its core timer
T6 may be concatenated with timers of the CAPCOM units (T0, T1, T7, and T8). Each block
has alternate input/output functions and specific interrupts associated with it.
Timer Block GPT1
From a programmer’s point of view, the GPT1 block is composed of a set of SFRs as
summarized below. Those portions of port and direction registers which are used for alternate
functions by the GPT1 block are shaded.
20. Fig. SFRs and Port Pins Associated with Timer Block GPT 1
All three timers of block GPT1 (T2, T3, T4) can run in 4 basic modes, which are timer, gated
timer, counter and incremental interface mode, and all timers can either count up or down.
Each timer has an alternate input function pin (TxIN) associated with it which serves as the
gate control in gated timer mode, or as the count input in counter mode. The count direction
(Up/Down) may be programmed via software or may be dynamically altered by a signal at an
external control input pin. Each overflow/underflow of core timer T3 is latched in the toggle
Flip-Flop T3OTL and may be indicated on an alternate output function pin. The auxiliary
timers T2 and T4 may additionally be concatenated with the core timer, or used as capture or
reload registers for the core timer.
The current contents of each timer can be read or modified by the CPU by accessing the
corresponding timer registers T2, T3, or T4, which are located in the non-bit addressable SFR
space. When any of the timer registers is written to by the CPU in the state immediately
before a timer increment, decrement, reload, or capture is to be performed, the CPU write
operation has priority in order to guarantee correct results.
GPT1 Core Timer T3
The core timer T3 is configured and controlled via its bit addressable control register
T3CON.
21. T3CON (Timer 3 Control register)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- - - - - T3
OTL
T3
OE
T3
UDE
T3
UD
T3R T3M T3I
BIT Function
T3I Timer 3 Input Selection
Depends on the operating mode, see respective sections
T3M Timer 3 Mode Control (Basic Operating Mode)
000: Timer Mode
001: Counter Mode
010: Gated Timer with Gate active low
011: Gated Timer with Gate active high
100: Reserved. Do not use this combination.
101: Reserved. Do not use this combination.
110: Incremental Interface Mode
111: Reserved. Do not use this combination
T3R Timer 3 Run Bit
0: Timer/Counter 3 stops
1: Timer/Counter 3 runs
T3UD Timer 3 Up/Down Control 1)
T3UDE Timer 3 External Up/Down Enable 1)
T3OE Alternate Output Function Enable
0: Alternate Output Function Disabled
1: Alternate Output Function Enabled
T3OTL Timer 3 Output Toggle Latch
Toggles on each overflow/underflow of T3. Can be set or reset by
Software.
22. Timer 3 Run Bit
The timer can be started or stopped by software through bit T3R (Timer T3 Run Bit). If T3R
= ‘0’, the timer stops. Setting T3R to ‘1’ will start the timer. In gated timer mode, the timer
will only run if T3R = ‘1’ and the gate is active (high or low, as programmed).
Count Direction Control
The count direction of the core timer can be controlled either by software or by the external
input pin T3EUD (Timer T3 External Up/Down Control Input), which is the alternate input
function of port pin P3.4. These options are selected by bits T3UD and T3UDE in control
register T3CON. When the up/down control is done by software (bit T3UDE = ‘0’), the count
direction can be altered by setting or clearing bit T3UD. When T3UDE = ‘1’, pin T3EUD is
selected to be the controlling source of the count direction. However, bit T3UD can still be
used to reverse the actual count direction, as shown in Table 5-2. If T3UD = ‘0’ and pin
T3EUD shows a low level, the timer is counting up. With a high level at T3EUD the timer is
counting down. If T3UD = ‘1’, a high level at pin T3EUD specifies counting up, and a low
level specifies counting down. The count direction can be changed regardless of whether the
timer is running or not. When pin T3EUD/P3.4 is used as external count direction control
input, it must be configured as input, i.e. its corresponding direction control bit DP3.4 must
be set to ‘0’.
Table - GPT1 Core Timer T3 Count Direction Control
Pin TxEUD Bit TxUDE Bit TxUD Count Direction
X 0 0 Count Up
X 0 1 Count Down
1 0 0 Count Up
1 1 0 Count Down
0 1 1 Count Down
1 1 1 Count Up
Timer 3 in Timer Mode
Timer mode for the core timer T3 is selected by setting bit field T3M in register T3CON to
‘000B’. In this mode, T3 is clocked with the internal system clock (CPU clock) divided by a
23. programmable prescaler, which is selected by bit field T3I. The input frequency fT3 for timer
T3 and its resolution rT3 are scaled linearly with lower clock frequencies fCPU, as can be
seen from the following formula:
fT3 = fCPU / (8 2<T3I>) rT3 [s] =fCPU [MHz] / (8 2<T3I>)
Timer 3 in Gated Timer Mode
Gated timer mode for the core timer T3 is selected by setting bit field T3M in register
T3CON to ‘010B’ or ‘011B’. Bit T3M.0 (T3CON.3) selects the active level of the gate input.
In gated timer mode the same options for the input frequency as for the timer mode are
available. However, the input clock to the timer in this mode is gated by the external input
pin T3IN (Timer T3 External Input). To enable this operation pin T3IN must be configured as
input, i.e. the corresponding direction control bit must contain ‘0’. If T3M.0 = ‘0’, the timer
is enabled when T3IN shows a low level. A high level at this pin stops the timer. If T3M.0 =
‘1’, pin T3IN must have a high level in order to enable the timer. In addition, the timer can be
turned on or off by software using bit T3R. The timer will only run, if T3R = ‘1’ and the gate
is active. It will stop, if either T3R = ‘0’ or the gate is inactive.
Timer 3 in Counter Mode
Counter mode for the core timer T3 is selected by setting bit field T3M in register T3CONto
‘001B’. In counter mode timer T3 is clocked by a transition at the external input pin T3IN.
The event causing an increment or decrement of the timer can be a positive, a negative, or
both a positive and a negative transition at this pin. Bit field T3I in control register T3CON
selects the triggering transition (see Table 5-3).
Table - GPT1 Core Timer T3 (Counter Mode) Input Edge Selection
T3I Triggering Edge for Counter Increment/Decrement
0 0 0 None. Counter T3 is disabled
0 0 1 Positive transition (rising edge) on T3IN
0 1 0 Negative transition (falling edge) on T3IN
0 1 1 Any transition (rising or falling edge) on T3IN
1 X X Reserved. Do not use this combination
24. Interrupt Control for GPT1 Timers
When a timer overflows from FFFFH to 0000H (when counting up), or when it underflows
from 0000H to FFFFH (when counting down), its interrupt request flag (T2IR, T3IR or T4IR)
in register TxIC will be set. This will cause an interrupt to the respective timer interrupt
vector (T2INT, T3INT or T4INT) or trigger a PEC service, if the respective interrupt enable
bit (T2IE, T3IE or T4IE in register TxIC) is set. There is an interrupt control register for each
of the three timers.
T3IC
Timer 3 Interrupt Control Register
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- - - - - - - - T3IR T3IE ILVL GLVL
Bit Function
GLVL Group Level
Defines the internal order for simultaneous requests of the same
priority.
3: Highest group priority
0: Lowest group priority
ILVL Interrupt Priority Level
Defines the priority level for the arbitration of requests.
FH: Highest priority level
0H: Lowest priority level
25. Timer Block GPT2
From a programmer’s point of view, the GPT2 block is represented by a set of SFRs as
summarized below. Those portions of port and direction registers which are used for alternate
functions by the GPT2 block are shaded.
Fig. SFRs and Port Pins Associated with Timer Block GPT2
Timer block GPT2 supports high precision event control with a maximum resolution of 8
TCL. It includes the two timers T5 and T6, and the 16-bit capture/reload register CAPREL.
Timer T6 is referred to as the core timer and T5 is referred to as the auxiliary timer of GPT2.
Each timer has an alternate input function pin associated with it which serves as the gate
control in gated timer mode, or as the count input in counter mode. The count direction
(Up/Down) may be programmed via software. An overflow/underflow of T6 is indicated by
the output toggle bit T6OTL whose state may be output on an alternate function port pin
(T6OUT). In addition, T6 may be reloaded with the contents of CAPREL.
The toggle bit also supports the concatenation of T6 with auxiliary timer T5, while
concatenation of T6 with the timers of the CAPCOM units is provided through a direct
connection. Triggered by an external signal, the contents of T5 can be captured into register
CAPREL, and T5 may optionally be cleared. Both timer T6 and T5 can count up or down,
26. and the current timer value can be read or modified by the CPU in the nonbitaddressable
SFRs T5 and T6.
The Timer Clock Frequency
(10 ms represents the fraction of 10/26.2 38.16 % of the maximum period (420 ms); the
initial value of the timer register is therefore 65535 * 0.3816 25000)
65535
25000
42ms
10ms0ms
27. PROGRAM
The registers used in the following program are:
P3 |= 0x0400 (0000 0100 0000 0000) – We set the bit 10 of PORT 3 as a output and rest pins
are used as inputs by making them 0.
ODP3 |=0x0000 (0000 0000 0000 0000) - port 3 open drain control register is set in push-
pull mode.
DP3 |= 0x0400 (0000 0100 0000 0000) – We set the direction of bit 10 of PORT 3 by making
it 1 (output).
T3CON = 0x0486 (0000 0100 1000 0110) – We set bit 3, 4 & 5 ‘000’to use TIMER 3 in
timer mode and bit 8 and 7 is made ‘01’ to set for counting down.
T3IC = 0x007F (0000 0000 0111 1100) – We set bit 7 as ‘0’and 6 as ‘1’ to reset the interrupt
request bit and set interrupt enable bit for T3 respectively.
IEN = 1 – The interrupt enable bit is set.
T3R = 1 – Timer 3 run bit is set.
S0TIC = 0x80 (1000 0000)– We set bit 7 to activate the transmitter ineterrupt. This is
activated before the last bit of an asynchronous frame is transmitted.
S0RIC = 0x00 – To delete receive interrupt flag.
S0BG = 0x40 – We reload this value for baud rate of 9600 baud.
S0CON = 0x8011 (1000 0000 0001 0001) – We set the bit 0, bit 4 and bit 15 for 8-bit data
asynchronous operation, to set Reciver Enable Bit and to set the Baudrate Generator Run Bit.