Post on 04-Apr-2018
transcript
7/29/2019 Report Psoc
1/24
CONTENTS
INTRODUCTION 51. Introduction to PSoC
2. Robotic research3. Introduction/Ics and Cables
ROBOTICS 9
1. BASIC PARTS OF ROBOTS 10o Locomotion System 11
o Power Supply 16
o Actuators 16
o Sensor 18
o Control System 21
2. HUMAN-ROBOT INTERACTION 24
CABELS 26a) WHAT IS CABLE 26b) SELECTION PARAMETERS OF CABLES 26
c) TYPES OF CABLE 27
ICS 29
a) ABOUT ICs 29b) DETAILS OF SOME ICs
CD-7680 31
TDA-2611 32
CD-7698 33
IC-8085 33
IC-8155 34
IC-8255 35
TDA-7285 36
CONCLUSION 36
BIBLOGRAPHY 37
Department of Electronics & Communication, BMIT Jaipur
1
7/29/2019 Report Psoc
2/24
CONTENTS
INTRODUCTION TO PSOC 3
1.1 System Overview 6 1.2 CPU 8 1.3 Frequency generator 9 1.4 Microcontroller power
consumption10
1.5 Reset 11
1.6 Digital inputs and outputs 12 1.7 Analog inputs and outputs 13 1.8 Accessing programmable
digital blocks14
1.9 Global input lines 14 1.10 Digital programmable
blocks15
1.11 Analog programmableblocks
17
1.12 MAC 18 1.13 Decimator 19
1.14 I2C controller 20
CONCLUSION 23
BIBLOGRAPHY 24
PSoC: Programmable System on Chip
Introduction
When developing more complex projects, there is often a need for additionalperipheral units, such as operational and instrument amplifiers, filters, timers,digital logic circuits, AD and DA convertors, etc.
Department of Electronics & Communication, BMIT Jaipur
2
http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#introhttp://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b1http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b2http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b3http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b4http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b4http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b5http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b5http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b6http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b7http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b8http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b8http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b9http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b10http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b10http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b11http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b11http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b14http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b15http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b16http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b10http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#introhttp://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#introhttp://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b1http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b2http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b3http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b4http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b4http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b5http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b6http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b7http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b8http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b8http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b9http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b10http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b10http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b11http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b11http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b14http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b15http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b16http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#b10http://c/Documents%20and%20Settings/dosi/Desktop/chapter1.html#intro7/29/2019 Report Psoc
3/24
The introduction of PSoC microcontrollers has made many engineers dreamcome true of having all their project needs covered in one chip. PSoC(Programmable System on Chip) represents a whole new concept inmicrocontroller development.
In addition to all the standard elements of 8-bit microcontrollers, PSoC chipsfeature digital and analog programmable blocks, which themselves allowimplementation of large number of peripherals. Digital blocks consist of smallerprogrammable blocks that can be configured to allow different developmentoptions. Analog blocks are used for development of analog elements, such asanalog filters, comparators, instrumentation (non)inverting amplifiers, as well as
AD and DA converters .
Theres a number of different PSoC families you can base your project upon,depending on the project requirements. Basic difference between PSoC familiesis the number of available programmable blocks and the number of input/output
pins. Number of components that can be devised is primarily a function of theavailable programmable blocks.
Depending on the microcontroller family, PSoC chips have 416 digital blocks,and 312 analog programmable blocks.
PSoC:
PSoC (Programmable System on Chip) represents a whole new concept inmicrocontroller development. In addition to all the standard elements of 8-bitmicrocontrollers, PSoC chips feature digital and analog programmable blocks,
which themselves allow implementation of large number of peripherals.
Digital blocks consist of smaller programmable blocks that can be configured toallow different development options. Analog blocks are used for development ofanalog elements, such as analog filters, comparators, intrumentational(non)inverting amplifiers, as well as AD and DA convertors.
Theres a number of different PSoC families you can base your project upon,depending on the project requirements. Basic difference between PSoC familiesis the number of available programmable blocks and the number of input/outputpins.
Number of components that can be devised is primarily a function of theavailable programmable blocks. Depending on the microcontroller family, PSoCchips have 416 digital blocks, and 312 analog programmable blocks.
Characteristics of PSoC microcontrollers
Department of Electronics & Communication, BMIT Jaipur
3
7/29/2019 Report Psoc
4/24
16k
Flash
POR
SROM
M8 CPU
BandGap
RAM
PUMP
MAC
PLL/Osc32K Osc
Dec.
GPIO
CY8C27XXX PSoC 1208
PSoC Die
Some of the most prominent features of PSoC microcontrollers are:
MAC unit, hardware 8x8 multiplication, with result stored in 32-bitaccumulator,
Changeable working voltage, 3.3V or 5V, Possibility of small voltage supply, to 1V,
Programmable frequency choice.
Programmable blocks allow you to devise:
16K bytes of programmable memory, 256 bytes of RAM, AD convertors with maximum resolution af 14 bits, DA convertors with maximum resolution of 9 bits, Programmable voltage amplifier, Programmable filters and comparators, Timers and counters of 8, 16, and 32 bits, Pseudorandom sequences and CRC code generators, Two Full-Duplex UARTs, Multiple SPI devices, Option for connection on all output pins, Option for block combining, Option for programming only the specified memory regions and write
protection, For every pin there is an option of Pull up, Pull down, High Z, Strong, or
Open pin state,
Department of Electronics & Communication, BMIT Jaipur
4
7/29/2019 Report Psoc
5/24
Possibility of interrupt generation during change of state on anyinput/output pin,
IC Slave or Master and Multi-Master up to speed of 400KHz, Integrated Supervisory Circuit, Built-in precise voltage reference.
Advantages of PSoC:
Perhaps the best way to recognize the true value of PSoC microcontrollers isthrough comparison with other options.
Major advantages of PSoC microcontroller include the following:
There is no other microcontroller that has programmable voltage,
instrumentational, inverting, and non-inverting amplifiers; Hardware generators of pseudorandom and CRC code, as well as analog
modulators, are unique to PSoC families; MAC (Multiply-accumulate) is an essential part of digital signal processors,
which allows implementation of digital signal processing algorithms. Itsworth noting that hardware accumulator multiplication is not a commonfeature of 8-bit microcontrollers;
Having the advantage of changeable working voltage doesnt really needa comment. This feature is particularly important for development of newdevices as it eliminates the need for redesigning the PCB andimplementing the level translator;
Option for low voltage supply (~1V) is a tremendous advantage in batteryoperated systems;
Timers, counters, and PWM units are more flexible than the usualimplementation;
Automatic code writing for accessing all the peripherals in use; In case you need a larger array of components, there is an option for
dynamic reconfiguration, allowing you to change peripherals during run-time. In this way, its possible to minimize the processor workload at antime, leaving the largest part of the job to the specialized hardware.
Limitations of PSoC:
On the other hand, there are certain limitations of PSoC that could influence thechoice of microcontroller for your design.
In systems which require highly precise or fast measurement, problemsmay occur with analog device characteristics. In this case, you shouldanalyze if speed of AD convertors and offset/noise of analog amplifiers areable to satisfy the project demands.
Department of Electronics & Communication, BMIT Jaipur
5
7/29/2019 Report Psoc
6/24
Analog components do not have the ability to work with usual negativesupply voltage. For example, zero voltage for inverting amplifiers is takento be the analog ground AGND (usually 2.5V). All voltages above AGNDare taken as positive, while voltages below AGND are taken as negative.
Most PSoC microcontrollers have 256 bytes of RAM, which could prove to
be insuficient for some projects.
1.1 System overview
PSoC microcontrollers are based on 8-bit CISC architecture. Their generalstructure with basic blocks is presented in the following image:
PSoC Architecture
InterruptController
LVDSupervisor
Watchdog
Sleep Timer
Decimator
SMPI2C
SRAM
Memory
(up to 2K)
M8C
CPU
Core
MAC MultiplyAccumulate (up to 2)
FlashProgram
Memory(up to
32K)
System
Clocking
Generator
24 MHz
Internal
Oscillator
Digital PSoC Block Array
Analog PSoC Block Array
ProgrammableInterconnectand Logic
Analog InputMuxing
Analog OutputDrivers
Port 5
Port 4
Port 3
Port 2
Port 1
Port 0
ConfigurableI/OPorts
System
Bus
BB
BB
BB
BB
CB
CB CB
CB
CT CT CT CT
SC
SC
SC SC
SC SC
SC
SC
Clocks
BB BB CB CB
BB BB CB CB
Port 6
Port 7
UART
PWM_16
FilterA
DC
ADC(Decimator)
ADC
I2C
Slave, Master,Multimaster
LCD
CPU unit is the main part of a microcontroller whose purpose is to executeprogram instructions and control workflow of other blocks.
Frequency generatorfacilitates signals necessary for CPU to work, as well as
an array of frequencies that are used by programmable blocks. These signalscould be based on internal or external referent oscillator.
Reset controllerenables microcontroller start action and brings amicrocontroller to regular state in the case of irregular events.
Watch Dog timeris used to detect software dead-loops.
Department of Electronics & Communication, BMIT Jaipur
6
7/29/2019 Report Psoc
7/24
Sleep timercan periodically wake up microcontroller from power saving modes.It could be also used as a regular timer.
Input-Output pins enable communication between the CPU unit, digital andanalog programmable blocks and outside world.
Digital programmable blocks are used to configure digital programmablecomponents which are selected by user.
Analog programmable blocks are used to configure analog components, likeAD and DA converters, filters, DTMF receivers, programmable, instrumental,inverting, non-inverting and operational amplifiers. Interrupt controller handlesnecessary operations in the case of interrupts.
I2C controllerEnables hardware realization of an I2C communication.
Voltage reference is vital for the work of analog components that reside insideof analog programmable blocks.
MAC unit is used for operations of hardware signed multiplication of 8-bitnumbers.
SMP is a system which can be used as a part of a voltage regulator. Forexample, it is possible to supply power to a PSoC microcontroller from a single1.5V battery.
1.2 CPU
During the programming, instructions are stored in program (FLASH) memory ina way which is familiar to microcontroller. CPU fetches one instruction at a time
from program memory, decodes it and executes appropriate operations. CPUunit has internal registers PC, SP, A, X and F, as well as ALU unit and instructiondecoding unit, that are associated to instruction execution process.
Internal Registers of CPU
Program counter (PC) is used as a pointer to the next program instruction thatshould be executed. With each new instruction value of program counter is being
Department of Electronics & Communication, BMIT Jaipur
7
7/29/2019 Report Psoc
8/24
set to point on the next instruction in program memory, which is going to bedecoded and executed.
Stack pointer (SP) points to the address of SRAM memory where data is writtento or read from in case of PUSH and POP instructions respectively. When these
instructions occur value stored in SP is internally incremented or decremented.
Accumulator register (A) is the main register which handles all arithmetical,logical or data transfer operations.
Index register (X) could behave as register A in large number of instructions.Also, register X is used in the case of index addressing.
Flag register (F) contains bits which describe result of a previously executedinstruction. It also has a role during selection of a RAM memory page in casewhen PSoC microcontroller has more than 256 bytes of RAM. Bit Flag Zero (Z)
marks that accumulator stores a zero, while Carry (C) marks that there has beencarrying during arithmetic or logic operations.
Arithmetic logic unit (ALU) is a standard part of a CPU, which is used forarithmetic operations like addition, subtracting and shifting (left or right), as wellas logic operations. Data handled by instructions could be stored in internalregisters A and X, or in RAM data memory
1.3 Frequency generator
Frequency generator is vital to CPU unit functioning, as well as programmable
blocks. Each of programmable components has certain demands regardingspeed. PSoC microcontrollers have a system for generation of differentfrequency signals, which is done by graphically selecting appropriate parameters.Picture shows two independent systems for generating signals SYSCLK andCLK 32k.
SYSCLK is the main internal clock signal with a speed of 24MHz. It is used as areference clock for most of other signals.
SYSCLKx2 is a clock signal with double frequency (48MHz) of SYSCLK signal.
24V1 is asignal derived by dividing frequency SYSCLK with parameter N1,which varies in range from 1 to 16. 24V1 frequency equals SYSCLK/N1, with afrequency from 1.5MHz (N1=16) to 24MHz (N1=1).
24V2 is a signal derived by dividing 24MHz frequency with parameter N1, whichvaries in range between 1 and 16. 24V2 signal frequency equals
Department of Electronics & Communication, BMIT Jaipur
8
7/29/2019 Report Psoc
9/24
SYSCLK/N1N2., which means that possible frequency ranges from 93.75kHz(N1,N2=16) to 24MHz (N1,N2=1).
24V3 signal is derived by dividing frequency of one of the signals 24V2, 24V1,SYSCLK or SYSCLKx2, with number N, in the range from 1 to 256.
CPU_CLK is used as a CPU unit frequency which has a direct impact oninstruction execution speed. CPU_CLK can have any of eight frequencies thatare in range from 93.75MHz to 24MHz.
Frequency 24V1, 24V2, 24V3 and CPUCLK selection is done easily, by settingappropriate parameters in Device Editor or during program runtime by selectingthree lower bits of OSCCR0 register.
CLK32K is a slow signal with a frequency of 32kHz. It can be used as aprogrammable component input. It can also be used for Sleep timer wake-up
operation in the case when other SYSCLK derived signals are inactive.
Signal SYSCLK can be acquired using internal main oscillator (IMO), whileCLK32K signal is acquired through internal local oscillator (ILO).
Fault tolerance of 2.5% in the case of internal frequency generation, is the limitfactor in a precise timing applications. In such case external SYSCLK clockreference should be used. External frequency ranges from 1 to 24MHz. Itconnects to PSoC through pin P1[4].
Similar situation is in the case of CLK32K, which also can be generated by
internal local oscillator (ILO), as said before, or more precise external 32kHzoscillator. In the both cases microcontroller starts with internal frequencygenerators, after which is necessary to satisfy appropriate procedure.
1.4 Microcontroller power consumption
Processor signal frequency CPUCLK is directly connected with the instructionexecution speed of the microcontroller. Doubling the frequency, programexecutes approximately twice faster. On the other hand, higher frequency doesnt
necessary always mean better overall performances. Main disadvantage in risingthe frequency is its unwanted effect on microcontroller power consumption,which is one of the main problems it the case of battery supply. Otherdisadvantage of higher frequency is more intensive generation ofelectromagnetic interference, which may affect on surrounding devices. Becauseof these problems general rule should be applied, which says that lowestpossible satisfactory frequency should be used.
Department of Electronics & Communication, BMIT Jaipur
9
7/29/2019 Report Psoc
10/24
Default value of PSoC microcontroller signal frequency is 3MHz, which is acompromise between speed and consumption.
To maintain the longest possible uninterrupted work time, it is an imperative tobring power consumption to its lowest satisfactory functional level in battery
operated devices. Most of microcontrollers operate only periodically, while beingin the idle state for the most of their time.
Major power saving can be achieved by bringing microcontroller to sleep modewhile microcontroller does no important role. Saving is achieved because of allthe frequencies, except CPU32K and SLEEP become inactive, while processorstops instruction execution. Microcontroller could be woken up from sleep modeonly by reset or a interrupt.
Interrupt could be generated by a sleep timer or some digital block which useCPU_32k frequency. Also GPIO pin or analog column interrupts can be used for
CPU waking-up. Sleep timer represents a special counter whose main role is togenerate periodic interrupts which enable waking microcontroller from powersaving mode. Sleep timer frequency interrupt ranges from 1 to 512Hz.
After waking microcontroller does all needed operations after which its beingswitched back to sleep mode and waits for another sleep timer interrupt. There isa appropriate type of interrupt needed to wake the microcontroller from sleepmode. Because of possibility for various irregularities to occurs during the work ofmicrocontroller there is a need to reset it in those cases, or in other words,brought to beginning state.
Begin state means all internal registers are initialized and program continues itsexecution from beginning.
1.5 Reset
POR
During the work of microcontroller, supply voltage variations occurs. It is verydangerous if voltage drops beneath certain limit, because microcontrollercan make some unpredictable actions.
Department of Electronics & Communication, BMIT Jaipur
10
7/29/2019 Report Psoc
11/24
In the case of such voltage drop detection, microcontroller is switched intoPower on Reset mode in which it remains until voltage stabilizes abovecritical limit which is defined by Trip Voltage parameter.
XRES
External reset allows user to bring microcontroller to start state by switching abutton. Reset is achieved when XRES pin reads logic ONE. Simplest reset circuitcan be made with pull-down resistor and one switch.
WDR
Watch dog reset (WDR) is used for avoiding software dead-loops or otherirregularities, bringing the system in the start state. Using WDR, it is watch dogtimer (WDT) is periodically restarted inside of a main program, after whichappropriate subprograms are executed.
In normal mode after certain time WDT is being restarted once again andsubprogram cycle continues. But, if program blocks in one of the subprogramsWDT is not reset, and WDR occurs.
1.6 Digital Inputs and Outputs
Connection between a PSoC microcontroller with an outside world is achievedover input-output pins. Eight pin group which could be accessed simultaneously
are parts of one port. Although port number differs from the type of themicrocontroller, write and read operations are done in the same way in any case.Port access registers are stored inside of register address space noted asPRT0DR, PRT1DR, PRT2DR, PRT3DR, PRT4DR or PRT5DR.
Department of Electronics & Communication, BMIT Jaipur
11
7/29/2019 Report Psoc
12/24
Digital Functions (subset)Timer
8, 16, 24, 32 bit
Counter8, 16, 24, 32 bit
PWM
8, 16, 24, 32 bit
Dead Band Generator
8, 16, 24, 32 bit
Pseudo Random Source
Cyclic Redundancy Check
Communication Interface
I2C Master
I2C Slave
SPI Master
SPI Slave
Full Duplex UART
Tx, Rx
Full Speed USB v2.0
Writing to port
Writing value to PRTxDR initializes register which through init circuit drives thestate of pins. Init circuit can pass the signal from PRTxDR register directly(strong), over pull-up or pull-down resistors or through open drain output. Besidethat, there is a possibility to isolate value of register from pin state (Hi-Z).
Reading port
Reading value from address PRTxDR digital state of voltage on pins is stored toregister A. In case that voltage is dictated by some external device, read valuecould differ from voltage on PRTxDR register.
Drive Mode
Selection of the way in which init register PRTxDR is connected to pins can beset inside of Device Editor or during runtime initializing registers PRTxDM2,PRTxDM1 and PRTxDM0. There is eight methods to initialize pins in total, which
enables connection to different types of devices, with considerate smaller amountof external components. Pin work modes are defined according to the followingtable depending on contents of appropriate bit from registers DM2, DM1 andDM0.
DM2 bit DM1 bit DM0 bit Mode Data = 0 Data = 1
Department of Electronics & Communication, BMIT Jaipur
12
7/29/2019 Report Psoc
13/24
DM2 bit DM1 bit DM0 bit Mode Data = 0 Data = 1
0 0 1 Strong Drive Strong Strong
0 1 0 High Impedance Hi-Z Hi-Z
0 1 1 Resistive Pull Up Strong Resistive
1 0 0 Open Drain, Drives High Hi-Z Strong (Slow)
1 0 1 Slow Strong Drive Strong (Slow) Strong (Slow)
1 1 0 High Impedance Analog Hi-Z Hi-Z
1 1 1 Open Drain, Drives Low Strong (Slow) Hi-Z
Strongmode is used when it is needed to connect the state on PRTxDR registerdirectly to pins. This way of connection is applied when pin is used as an input.
Analog Hi-Z mode is used when connecting analog signals, like AD converterinput. In this case, all internal connections between PRTxDR register and pin are
disconnected, so not to interfere with value of brought voltage.
Pull-up orpull-down resistors are used when connecting with buttons or someother devices which demand this type of components. These resistors aredefining the state on input when button is not pushed.
Open drain mode is used when it is needed to bring several devices to the sameline, when it is needed to add one external pull-up or pull-down resistor. This
mode is convenient for realization of a line which signals if there has been amistake to one of the microcontrollers. For example, when used pull-up resistorversion when zero (error) occurs on any of output pins state of this line will bezero. Pins on PSoC microcontroller allow user to generate interrupt on any pin,when signal changes, or on signal rising or falling edge.
1.7 Analog inputs and outputs
Some of input-output pins, beside their standard use can perform analog input or
output operation. Any pin of port P0 as well as lower four pins of port P2 can beused as analog input. Inputs of port P0 are connected to analog blocks overanalog multiplexers, while in case of port P2 they are connected directly toprogrammable SC blocks. Pins P2[4] and P2[6] can serve as external referentvoltage inputs. Outputs from analog blocks can be connected to 4 output buffers,which are connected to P0[2],P0[3],P0[4] and P0[5] pins.
Department of Electronics & Communication, BMIT Jaipur
13
7/29/2019 Report Psoc
14/24
Analog Functions (Subset)ADC
Incremental 6-14 bits
Delta Sigma 6-13 bits
DAC6, 8, and 9 bit
6 and 8 bit multiplying
Filters
2-pole Low-pass
2-pole Band-pass
DTMF Dialer
Modulator
Peak Detector
V to I Converter
Amplifiers
Programmable Gain
Instrumental
Inverting
Comparators
Programmable
HysteresisZero-Crossing
CapSense
1.8 Accessing programmable digital blocks
Digital components, which are stored inside of programmable blocks, arentconnected directly to input or output pins. It is done in a way shown on followingpicture, which depicts group of four digital programmable blocks. As it could be
seen, pin connection is established using global connection lines, multiplexer andlines of programmable blocks. PSoC microcontrollers can have one, two or fourdigital programmable block groups like this one depending on their family.
1.9 Global input lines
Global input lines establishes connection between the pins and inputmultiplexers. Global input lines are divided in two groups, depending on weatherthey can connect to ports with odd (GIO) or even (GIE) index. Rule of connection
is that it is possible to connect only between a line and a pin which have thesame index. For example, line GIO_0 can connect only to zero pin of some of theodd index ports (P1[0],P3[0],P5[0]).
Input multiplexers of block lines
Department of Electronics & Communication, BMIT Jaipur
14
7/29/2019 Report Psoc
15/24
Input multiplexer selects one of global lines and connects it to signal carrying linewhich leads to programmable blocks. Picture shows that input block lines can beconnected to GIO or GIE lines with same index, or with index with offset four.
1.10 Digital programmable blocks
Inside of digital programmable blocks user can configure components like timers,counters, PWM, PRS, CRC generators and devices for SPI, IrDA and UARTcommunication, which enables custom hardware adjustment of the system forspecific uses. The process of setting and connecting using PSoC Designer isvery simple to understand, but at first is necessary to understand the way thosecomponents function. Most components, like counters, PRS and CRC generatorscan be stored inside of any free block. On the other side, communicationcomponents like Rx, Tx, UART and SPI can be set on the right side of the
programmable blocks.
The number of necessary blocks which are used for component configurationshown in the table:
Number of blocks Components
1 Counter8, Timer8, PWM8, PRS8, RX8/TX8, SPIM/SPIS
2Counter16, Timer16, PWM16, PRS16, PWMDB8, CRC16,UART, IrDARx/IrDATx
3 Counter24, Timer24, PWMDB16
4 Counter32, Timer32
Frequency signal (CLK)
Frequency signal is needed for digital components to work. Depending onwanted speed there is a range of several built-in frequencies to choose from:
internal signal frequency VC1, VC2, VC3, SYSCLKx2, CPU_32 output from adjacent blocks common Broadcast line (BC) input (RI) or output (RO) block lines
Most common internal signals are VC1, VC2 and VC3, because when used withdifferent prescalers, they offer broad range of possible frequencies. In case thatsignals VC1,VC2 and VC3 could not offer specified frequency, outputs fromCounter, Timer or PWM, which can be used like like additional prescalers.Picture above shows in dotted line direct way to connect output of previous block
Department of Electronics & Communication, BMIT Jaipur
15
7/29/2019 Report Psoc
16/24
with the input of the next block. In case that signal needs to be routed acrossseveral blocks, connection is done over common frequency line BC.
Component input signal
Most of the components, beside frequency signal, has one or two digital inputs.For example, in the case of a counter and PWM generator input is used forenabling counting. There are different possibilities in selection of the componentinput signal:
block input lines (RI), which is a case of external signal block output lines (RO), in the case of component cascading analog block comparator lines signal of logic one(high) signal of logic zero (low)
Component output signals
Digital outputs of the component are used for connecting programmable blockswith output lines RO. Signal could be routed from output lines further towardoutput of the microcontroller or input of some other component. Outputmultiplexers are used for connecting lines of programmable blocks with globaloutput lines.
Multiplexer
Depending on the state of multiplexer, output (RO) or input (RI) line of
programmable block could be connected.
Logic circuit
Selected signal can be brought to the output of logic circuit. As other input couldbe used some of adjacent lines of programmable blocks (RO). Logic circuit can:
pass one of two signals invert input signals do logic operations AND, OR or XOR over input signals which could be
inverted previously.
Output drivers
Logic circuit output can be routed to four output drivers, which can makeconnection to one, or more, global output lines. Line of programmable blocks withsome index can be connected to GOO or GOE lines with same or by four higher
Department of Electronics & Communication, BMIT Jaipur
16
7/29/2019 Report Psoc
17/24
index. Global output lines makes connection between drivers and pins. They areseparated in two groups, depending on where they can be connected to portswith odd (FGIO) or even (GIE) index. Rule of connection says that only lines andpins with the same index can be interconnected. Beside that there is a possibilityto establish a connection between input and output lines, which enables
additional processing of the input signal.
1.11 Analog programmable blocks
Analog programmable blocks are grouped in columns of three programmableblocks. Depending on family of microcontroller, there could be 1, 2 or 4 analogcolumns. Each column has input multiplexer, one frequency line, output analogand a comparator line.
Analog multiplexers of port P0
Signals from port 0 are connected to analog ACB blocks over appropriate inputmultiplexers. Multiplexers can select even (Port0_even) or odd (Port0_Odd) pins,while two middle columns have the ability to choose either pins of port P0.
Analog inputs of port P2
Beside port P0, as analog inputs could be used four lower pins of port P2. Thispins can be connected directly to analog programmable blocks.
Analog columns
One column of analog blocks is made of three types of blocks: ACB, ASC i ASD.Outputs of these blocks can be routed to some of adjacent blocks, output analogline or comparator line.
ACB blocks are used to store amplifiers with rail-to-rail inputs and outputs, digitalcontrolled resistors and internal multiplexers. Depending on interconnectionsmade inside of ACB blocks, it is possible to implement inverting, noninverting,instrument amplifier or comparator. As input to ACB blocks can be used analogmultiplexer or output signal of some of adjacent blocks.
ASC and ASD blocks are of switched capacitor (SC) type. They containsamplifiers with rail-to-rail input and outputs, condensators and internalmultiplexers. AD, DA and analog filters could be implemented depending onconfiguration inside of these blocks. As inputs to SC blocks, input from someadjacent block could be used. It should be noted, that signals from analogmultiplexers couldnt be brought directly to SC blocks, but over ACB blocks.
Department of Electronics & Communication, BMIT Jaipur
17
7/29/2019 Report Psoc
18/24
Analog outputs
For every analog column is common to have an AnalogOutBus line. Analogoutput lines can be are connected, through a buffer, to four middle pins of port A.
Comparator outputs
Every analog column has one comparator line, to which could be connecteddigital output from one of analog blocks. Comparator output could be connectedto digital blocks (most common way of doing it is as counter signal, or timer).Before connecting, there is a possibility to modify or combine comparator outputof some column (A) with next comparator line (B), using some logic operation.
Frequency signal
Many components, such as AD, DA convertors and filters, need to have a
frequency signal in the specific range, which affects the components speed.Frequency signal selection done over appropriate multiplexers. For each of thecolumns it is possible to select:
internal frequency VC1 internal frequency VC2 output over some of the digital blocks, most commonly counter timer and
PWM generator, which is selected through the multiplexer.
1.12 Referent voltage generators
There are three stable voltage generators in PSoC microcontroller:
AGND RefH RefLo
AGNDis ground voltage for analog components. Voltage values higher thanAGND are considered as positive, while less are negative. PSoC microcontrollershave one-side power supply, so value of analog ground is somewhere inbetween GND and VDD. AGND value is selected by user.
RefHi and RefLo represent referent higher and lower voltage, for AD and DAcomponents. PSoC microcontrollers have a system that can generate severalreferent signal values AGND, RefHi and RefLo. This enables simple adjustmentto different types of voltage sensors. Referent voltages are made from internaltemperature stabilized bandgap voltage reference Vbg = 1.3V, supply voltageVDD or external signal as shown in the following table. PSoC microcontrollersare well adjusted to work with battery supply.
Department of Electronics & Communication, BMIT Jaipur
18
7/29/2019 Report Psoc
19/24
Ref Mux AGND [V] RefLo [V] RefHi [V]
Vdd/2 Vbg 2.5/1.65 1.2/0.35 3.8/2.95
Vdd/2 Vdd/2 2.5/1.65 0 5.0/3.3
Vbg Vbg 1.3 0 2.6
1.6Vbg 1.6Vbg 2.08 0 4.16
2Vbg Vbg 2.6 1.3 3.9
2Vbg P2[6] 2.6 1.6 3.6
P2[4] Vbg 2.2 0.9 3.5
P2[4] P2[6] 2.2 1.2 3.2
1.13 Switch Mode Pump
In the case of battery suply Switch Mode Pump (SMP) system can be used. Itsoperation is based on principle of BOOSTDC/DC convertor. This type ofconvertor gives voltage supply value higher than battery voltage, which makespossible power suplly with 1.5V battery. For SMP to function properly, it isnecessary to connect, beside battery, a diode, inductivity and a capacitive.
1.14 MAC
MAC unit is a device that implements operation of hardware multiplication of 8-bitsigned numbers, as well as sum of product. For execution of these operations
there is no special instruction, but all of the work is done by writing to and readingfrom certain registers.
Hardware multiplication
Multiplication operation is done by writing 8-bit inputs X and Y into registersMUL_X and MUL_Y, and reading output from 16-bit result from registersMUL_DH and MUL_DL.
;file: main.asm;project: MAC
mov reg[MUL_X],0x64 ;Initialize X = 100mov reg[MUL_Y],0x0C ;Initialize Y = 12mov A,reg[MUL_DH] ;Read high byte of result (0x04)mov A,reg[MUL_DL] ;Read low byte of result (0xB0)
Department of Electronics & Communication, BMIT Jaipur
19
7/29/2019 Report Psoc
20/24
mov reg[MUL_X],0xFE ;Initialize X = -2mov reg[MUL_Y],0x03 ;Initialize Y = 3mov A,reg[MUL_DH] ;Read high byte of result (0xFF)mov A,reg[MUL_DL] ;Read low byte of result (0xFA)
Sum of products:During multiplication, result can be added to previouslystored value inside of 32-bit accumulator. In that way is made sum product
operation, which represents most important operation of digital signalprocessing for correlations, convolutions and filtering. Beside that MAC
unit allows simple implementation of multibyte multiplication.
Summing products is done when data X and Y are initialized by writing intoregisters MAC_X or MAC_Y. Input data X and Y could also be initialized bywriting into registers MUL_X and MUL_Y, in which case operation of productsumming does not take place. Result of product summing operation is storedinside of registers ACC_DR3, ACC_DR2, ACC_DR1 i ACC_DR0. Starting value
of accumulator is set to zero by writing any value to register MAC_CL1 orMAC_CL0. In the next example shows method of initializing input data, as well asoperation of summing products.
1.15 Decimator
Decimator component is component that is used for digital data processingduring sigma delta, as well as some types of incremental AD conversion.
;file: main.asm;project: MAC
mov reg[MAC_CL0],0 ;Clear Accumulator;(Acc = 0)
mov reg[MUL_X],5 ;Initialize Xmov reg[MAC_Y],4 ;Initialize Y and execute MAC;(Acc = 0 + 5 * 4 = 20)
mov reg[MUL_X],6 ;Initialize Xmov reg[MAC_Y],5 ;Initialize Y and execute MAC;(Acc = 20 + 6 * 5 = 50)
mov reg[MUL_X],3 ;Initialize Xmov reg[MAC_Y],2 ;Initialize Y and execute MAC;(Acc = 50 + 3 * 2 = 56)
mov reg[MAC_Y],2 ;Initialize Y and execute MAC;(Acc = 56 + 3 * 2 = 62)
mov reg[MAC_X],4 ;Initialize X and execute MAC
Department of Electronics & Communication, BMIT Jaipur
20
7/29/2019 Report Psoc
21/24
;(Acc = 62 + 4 * 2 = 70)
mov A,reg[Acc_DR0] ;Read low byte of result;(0x46 = 70dec)
1.16 I2C Controller
I2C controller implements hardware serial I2C communication, and in that wayminimizes usage of CPU units resources. Most important operations of I2Ccontroller are:
Master or Slave, sending or receiving data Byte level data processing Connected to CPU over interrupts or polling mode. Transfer speed: 50K, 100K and 400K Frequency synching in case of larger number of masters 7or 10-bit addressing of I2C unit
1.17 Interrupt Controller
Interrupts are mechanisms inside of a microcontroller that allow responding tosome event immediately after its detection. Events could be internal (timeroverrun, end of AD conversion) or external (character receiving over serialconnection, pin state change). When interrupt occurs program execution isinterrupted (hence the name) by jumping to part of the program that is calledinterrupt routine. Upon ending of that routine program continues from place inprogram where interruption took place. Interrupt controller makes hardwareinterrupt detection, program flow interruption by jumping to interrupt routine, aswell as returning to interruption point from the routine. These operations areexecuted in several steps:
1. When event that triggers interruption takes place, interrupt controllerstores interrupt type.
2. End of current instruction is awaited.3. If interrupt is allowed and if global interrupt permit is set to 0ne (GIE = 1),
interrupt processing begins. For later continuing of instructions execution,stack holds values of PCH, PCL and F registers.
4. New interrupt occurrence is disabled by setting values of register F to zero(GIE = 0).
5. Program counter is set to address of interrupt routine, which is same asinterrupt type, after which execution jumps to interrupt routine address.
6. Program executes interrupt routine instructions.7. When it gets to instruction reti, which marks return from main program,
values of F register are restored from stack, and program counter is resetto old value before interrupt occurred.
Department of Electronics & Communication, BMIT Jaipur
21
7/29/2019 Report Psoc
22/24
Register PRTxIF is used as indication of GPIO interrupt on certain port, whilePRTxIC1and PRTxIC0 are appropriate control registers. Every interrupt type canbe masked or deleted, which is done with help of INT_MSK and INT_CLRregisters, which will be discussed in more detail in examples part.
1.18 Address space
PSoC microcontrollers have three address spaces:
ROM RAM registers
As in all Harvard architecture processors access to ROM memory is done withspecial lines, so microcontroller is able to acquire instructions and access data atthe same time.
Program memoryis the part of ROM, which is used for storing program code,which is written in this part of memory written by programming hardware.Program memory is implemented in FLASH technology, which allowssimple development time change of the program inside of microcontroller.Program memory size depends on the family of PSoC microcontrollers
and is 2, 4, 8, 16 and 32 kB.
Supervisory ROMis part of ROM which is used during start of PSoCmicrocontroller, as well as for calibration of components. With specialinstruction SSC, it is possible access this part of memory.
RAMenables storing of variables and stack which are used during work ofmicrocontroller. Size of RAM, in most PSoC microcontrollers, is 256 bytes.When microcontrollers have more than 256 bytes of RAM (seriesCY8C29xx and CY8C21x34), memory is organized in 256 byte pages,with stack residing on the last page. To access some variable, user apart
from 8-bit address must state appropriate page.
RegisterRegister address space contains registers used for peripheral's globalparameters and programmable blocks of a PSoC microcontroller. PSoCmicrocontrollers have 512 registers, which are grouped in two 256 bytes
banks. To access some register, beside stating its name, what is neededis to also state the name of the bank in which resides wanted register.
CONCLUSION
Department of Electronics & Communication, BMIT Jaipur
22
7/29/2019 Report Psoc
23/24
BIBLOGRAPHY
Department of Electronics & Communication, BMIT Jaipur
23
7/29/2019 Report Psoc
24/24
Websites
a) www.easypsoc.comb) www.wikipedia.comc) www.avnet-israel.com
Books
Microcontrolador PSoC - Uma Nova Tecnologia, Uma NovaTendencia:
Author(es): Robson Clayson Battellocchi dos Santos e Denys EmlioCampion NicolosiGupta)
24
http://www.wikipedia.com/http://www.roboticsforyou.com/http://www.cypress.com/?rID=3270http://www.cypress.com/?rID=3270http://www.wikipedia.com/http://www.roboticsforyou.com/http://www.cypress.com/?rID=3270http://www.cypress.com/?rID=3270