Académique Documents
Professionnel Documents
Culture Documents
Laboratory Manual
Roll No.:_______________
Exam No.:______________
www.gecrajkot.org
GOVERNMENT ENGINEERING COLLEGE, RAJKOT
CERTIFICATE
Roll No. ______________of B.E. (E.C.) SEM-VIII has satisfactorily completed the
2
INDEX
Sr. Name of Experiment Page
No. No.
1. To understand architecture of ARM7TDMI 4
architecture
2. To understand ARM32 and Thumb instruction set 11
of ARM microcontroller and write simple programs
3. To understand features and block diagram of LPC- 17
2129 ARM processor. To download and execute
program to blink 8 LEDs connected at Port P0 of
LPC-2129 ARM7TDMI chip using LPC2000 flash
utility
4. To understand features of LPC-2294 ARM 24
processor and download programs to flash 8 LEDs
connected at Port P1 of LPC-2294 ARM Processor
5. Write program to blink LEDs one by one. 26
Download and execute program in LPC-2129 chip.
Modify this program according to given instruction
in exercise
6. To write and execute program to display message 29
“display “WELCOME GEC RAJKOT” on LCD screen
for ARM7
7. To read analog input voltage and display it on LCD 33
using LPC-2129
8. To understand architecture of Digital Signal 38
Processor ADSP-2181
9. To understand installation procedure of ADSPLite 44
software and ADSP Kit. To download and run
sample programs on ADSP kit.
10. To generate sine wave, square wave and other 49
complex waveforms using ADSP-2181
11. To filter input signal using FIR filter 53
implementation with ADSP-2181
12. To understand architecture of TMS320C6713 DSP 57
chip and code composer studio
13. To understand features of Cypress Programmable 66
System on Chip (PSoC). To download and execute
demo programs to display vertical bar graph using
LEDs depending on analog input voltage.
14. To read analog voltage and display it on LCD using 70
cypress kit
15. To become familiar with GCC compiler, WinARM 72
and crossware development tools
Assignment 74
3
Experiment No.1
Aim: To understand architecture of ARM7TDMI architecture
Brief Theory:
The ARM7TDMI is a member of the Advanced RISC Machines (ARM)
family of general purpose 32-bit microprocessors, which offer high
performance for very low power consumption and price. The ARM
architecture is based on Reduced Instruction Set Computer (RISC)
principles, and the instruction set and related decode mechanism are much
simpler than those of micro-programmed Complex Instruction Set
Computers. This simplicity results in a high instruction throughput and
impressive real-time interrupt response from a small and cost-effective chip.
Thumb Concept:
The THUMB set’s 16-bit instruction length allows it to approach twice the
density of standard ARM code while retaining most of the ARM’s
performance advantage over a traditional 16-bit processor using 16-bit
registers. This is possible because THUMB code operates on the same 32-bit
register set as ARM code.
4
THUMB code is able to provide up to 65% of the code size of ARM, and 160%
of the performance of an equivalent ARM processor connected to a 16-bit
memory system.
THUMB also has a major advantage over other 32-bit architectures with 16-
bit instructions. This is the ability to switch back to full ARM code and
execute at full speed. Thus critical loops for applications such as fast
interrupts and DSP algorithms can be coded using the full ARM instruction
set, and linked with THUMB code. The overhead of switching from THUMB
code to ARM code is folded into sub-routine entry time. Various portions of a
system can be optimized for speed or for code density by switching between
THUMB and ARM execution as appropriate.
5
ARM7TDMI has a total of 37 registers - 31 general-purpose 32-bit
registers and six status registers - but these cannot all be seen at once. The
processor state and operating mode dictate which registers are available to
the programmer.
In ARM state, 16 general registers and one or two status registers are
visible at any one time. In privileged (non-User) modes, mode-specific
banked registers are switched in. Register organization shown below. In
ARM state shows which registers are available in each mode: the banked
registers are marked with a shaded triangle. The ARM state register set
contains 16 directly accessible registers: R0 to R15. All of these except R15
6
are general-purpose, and may be used to hold either data or address values.
In addition to these, there is a seventeenth register used to store status
information
Register 15 holds the Program Counter (PC). In ARM state, bits [1:0] of
R15 are zero and bits [31:2] contain the PC. In THUMB state, bit [0] is
zero and bits [31:1] contain the PC.
7
Register 16 is the CPSR (Current Program Status Register). This
contains condition code flags and the current mode bits.
User, IRQ, Supervisor, Abort and Undefined each have two banked
registers mapped to R13 and R14, allowing each of these modes to have a
private stack pointer and link registers.
ABE (Address Bus Enable) pin is LOW, it puts the address bus into a
high impedance state. ABE must be tied HIGH when there is no system
requirement to turn off the address drivers.
[1] Hold information about the most recently performed ALU operation
[2] Control the enabling and disabling of interrupts
ARM employs load and store architecture. Instruction set will only process
values which are in registers and place result of process into register.
Process may be addition, subtraction, etc. Example: ADD R1,R2,R3 (This
8
instruction adds content of registers R2 and R3 and saves result into R1).
Operations related to memory are load and store operations only. Copy
memory values into registers are called load instructions and copy register
values into memory are called store instructions. ARM does not support
memory to memory operations.
WORKSHEET
[1] What is the difference between RISC machine and CISC machine?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
9
[2] What are the advantages of THUMB mode of ARM microcontroller?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[3] For what type of applications full arm instructions are better compared to
thumb and switching is required from thumb mode to full arm mode?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[4] What is load and store architecture? What kind of operations are not
permitted in load and store archictecture?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[5] List ARM development tools available for the development of ARM
applications.
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
10
Experiment No.2
Aim: To understand ARM32 and Thumb instruction set of ARM
microcontroller and write simple programs
ARM instruction is 32 bit long. All operands are 32 bit wide and come
from registers or are specified as literals in the instruction itself. Thumb
instruction set is 16 bit. It is compressed form of subset of ARM
instructions. It provides more code density. ARM processor which supports
Thumb instruction set, also executes standard 32 bit instruction set.
Instruction stream at particular time is determined by bit 5 of CPSR (T bit).
If T bit is set, ARM processor interprets instruction as 16 bit Thumb
instruction otherwise it interprets as standard 32 bit instruction. ARM core
start up after reset, executes normal 32 bit ARM instructions. The normal
way to switch into Thumb mode is by executing branch and exchange
instruction (BX).
4. Instruction set:
11
Load and store instructions: Load and store multiple data bytes
Some Examples:
12
[8] MOVS R0,#0
Explanation: Move value 0 in the register R0. S indicates that it will affect
CPSR also. Zero flag will set, negative flag reset, Carry and overflow flag not
effected.
Branch Instructions:
[1] B label : Branch unconditionally to label
[2] BCC label : Branch to label if carry flag is cleared
[3] BEQ label : Branch to label if zero flag is set
[4] MOV PC,#0 : Branch to location 0
[5] BL delay : Subroutine call to delay
13
Conditional Execution instructions:
[1] MOVCS R0,R1
Explanation: This instruction will move value of register R1 to register R0
only if carry flag is set.
[2] MOVEQ R0,R1
Explanation: This instruction will move value of register R1 to register R0
only if zero flag is set.
WORKSHEET
[1] Write instructions for the following operations
[a] Move content of register R6 into R5
_____________________________________________________________________
[b] Move immediate data #66 in the register R4
_____________________________________________________________________
14
[c] Add content of register R3 and R4. Save result in register R6
_____________________________________________________________________
[d] Multiply content of register R1 and R2. Save result in register R3.
_____________________________________________________________________
[e] Write instruction to multiply content of register R4 with 5. Use ADD
instruction in combination with logical shift instruction.
_____________________________________________________________________
_____________________________________________________________________
[f] Write instruction to multiply and accumulate. Use registers R4,R5,R6 and
R7.
_____________________________________________________________________
_____________________________________________________________________
[g] Write instruction to copy CPSR register into register R0.
_____________________________________________________________________
[2] Write a program to add elements of array. Consider three elements in the
array. Load data from the array using instruction LDR and add it. Store
the result in register R0.
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
15
[3] Explain execution of following instructions with suitable example:
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[b] MOV R0,R1,ROR #2
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[c] AND R0,R1,R2
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[d] ORR R0,R1,R2
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[e] EOR R0,R1,R2
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
16
Experiment No.3
Aim: To understand features and block diagram of LPC-2129 ARM
processor. To download and execute program to blink 8 LEDs connected at
Port P0 of LPC-2129 ARM7TDMI chip using LPC2000 flash utility
Brief Theory:
The ARM microcontrollers are high-performance, 16/32 bit RISC Core
devices. The ARM market is one of the fastest growing market for
microcontrollers. TheLPC2119/LPC2129 are based on a 16/32bit
ARM7TDMI-S™ CPU with 256 kB of embedded high speed flash memory. A
128-bit wide memory interface and a unique accelerator architecture enable
32-bit code execution at maximum clock rate. For critical code size
applications, the alternative 16-bit Thumb Mode reduces code by more than
30% with minimal performance penalty.
LPC2129 comes with 64 pin package, low power consumption, various
32-bit timers, 4-channel 10-bitADC, 2 advanced CAN channels, PWM
channels and 46 GPIO lines with up to 9 external interrupt pins these
microcontrollers are particularly suitable for automotive and industrial
control applications as well as medical systems and fault-tolerant
maintenance buses. With a wide range of additional serial communications
interfaces, they are also suited for communication gateways and protocol
converters as well as many other general-purpose applications.
The advantage of ARM microcontrollers are:
It is very fast: ARM7 core run at 60 MHz and ARM9 runs at 150 MHz
Low power dissipation: Typical power dissipation for ARM7 is 0.5-1
mA/MHz
Great range of peripherals: ADC, DAC, USB, SPI,UART, I2C, CAN,
Ethernet, SDRAM
Internal Flash (32 KB to 1 MB depending on chip) and RAM (4 to 256 KB)
The salient features of LPC-2129 are listed below:
16/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package. 16kB
on-chip Static RAM. 128/256kB on-chip Flash Program Memory.
128-bit wide interface/accelerator enables high speed 60MHz operation.
In-System Programming (ISP) and In-Application Programming (IAP) via
on-chip boot-loader software. Flash programming takes 1 ms per 512
byte line. Single sector or full chip erase takes 400ms.
Embedded ICE-RT interface enables breakpoints and watch points.
Interrupt service routines can continue to execute whilst the foreground
task is debugged with the on-chip Real Monitor software.
Embedded Trace Macrocell enables non-intrusive high speed real-time
tracing of instruction execution. Two interconnected CAN interfaces with
advanced acceptance filters.
Four channel 10-bit A/D converter with conversion time as low as 2.44
µs.
Multiple serial interfaces including two UARTs (16C550), Fast I2c 400
kbps and two SPIs™.
17
60MHz maximum CPU clock available from programmable on-chip
Phase-Locked Loop.
Vectored Interrupt Controller with configurable priorities and vector
addresses.
18
sensitive external interrupt pins available.
On-chip crystal oscillator with an operating range of 1MHz to 30MHz.
Two low power modes, Idle and Power-down.
Processor wake-up from Power-down mode via external interrupt.
Individual enable/disable of peripheral functions for power optimization.
Dual power supply:
o CPU operating voltage range of 1.65V to 1.95V (1.8V ±0.15V).
o I/O power supply range of 3.0V to 3.6V (3.3V ±10%) with 5V tolerant
I/O pads.
Pin Diagram of LPC2129:
Features of LPC2129:
19
In-System Programming (ISP) and In-Application Programming (IAP) via
on-chip boot-loader software. Flash programming takes 1 ms per 512
byte line. Single sector or full chip erase takes 400ms.
4 channel 10-bit A/D converter with conversion time as low as 2.44 µs.
Multiple serial interfaces including two UARTs (16C550), Fast I2C 400
kbps two SPIs™.
Dual power supply: CPU operating voltage range of 1.65V to 1.95V (1.8V
±0.15V).
I/O power supply range of 3.0V to 3.6V (3.3V ±10%) with 5V tolerant I/O
pads.
LEDs are connected with LPC-2129 chip with port pins P0.2 to P0.7, P0.22
and P0.9. Bit Configuration is shown below. First row is bit position, second
row is corresponding bit and third row is equivalent hexadecimal value.
20
31 …. 24 23 22 21 20 ….. 17 16 15 14 …10 9 8 7 6 5 4 3 2 1 0
00 40 02 FC
Program:
Create project and write above program using KEIL IDE tool. (Create New
Project, write C program in new file, Add C file in your project, Add
necessary header files such as LPC21xx.h, timer.c and timer.h in your
project). Build program to generate HEX file.
Use Philips LPC2000 flash utility to download your program HEX file in
the chip. Screen looks as shown in the figure in the next page
Philips LPC2000 Flash utility connects PC’s serial port (COM port) to the
serial port of LPC2129 chip and provides in system flash programming
(ISP).
Select device LPC2129, Change crystal frequency 12000 KHz (12 MHz)
(Or press “Read device Id” command button, it will select device
automatically)
21
Before downloading HEX file in the chip, ensure that switch SW5 of the
ARM board is in left position. Press RESET key before downloading
After downloading the program, make switch SW5 in the right side and
press the reset key to start execution.
WORKSHEET
[1] Modify program of this practical to change blinking interval. Generate
HEX file of modified program, download it and observe the result
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
22
[2] What is use of watchdog timer?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
23
Experiment No.4
Aim: To understand features of LPC-2294 ARM processor and download
programs to flash 8 LEDs connected at Port P1 of LPC-2294 ARM Processor
Features of LPC-2294:
The LPC-2294 microcontroller is based on a 16-bit/32-bit ARM 7 TDMI-S
It has 256 KB of embedded high - speed flash memory. It has 16 KB on
chip static RAM. A 128-bit wide memory interface and unique accelerator
architecture enable 32-bit code execution at the maximum clock rate. For
critical code size applications, the alternative 16-bit Thumb mode reduces
code by more than 30% with minimal performance penalty.
LPC-2294 ARM chip has 144-pin, low power consumption, various 32-bit
timers, 8-channel 10-bit ADC, 2 advanced CAN channels, PWM channels
and up to nine external interrupt pins these microcontrollers are
particularly suitable for automotive and industrial control applications
as well as medical systems and fault-tolerant maintenance buses. The
number of available GPIO's ranges from 76 (with external memory)
through 112 (single-chip). With a wide range of additional serial
communications interfaces, they are also suited for communication
gateways and protocol converters as well as many other general-purpose
applications.
Procedure:
1. To program IC via serial port, short the 1-2 pin of the jumpers J7 &
J6 (left side). Connect the serial cable to any functional COM port of
your PC and SP2 (DB-9 Connector) port of the trainer (in PC interface
& ISP section).
2. To program IC via USB, short the 2-3 pin of the jumpers J7 &
J6 (right side). Connect the USB cable with PC
3. Change the position of Run/ISP switch 'On' the trainer to ISP mode.
4. Connect the power cable to the trainer and switch 'On' the power
switch.
5. Compile program using KEIL compiler and generate hex file LED.hex
6. Start the Philips flash utility LPC210x_ISP.exe
7. Program LED.hex in LPC-2294 using programmer.
8. Switch 'Off’ the power supply and change the position of Run/ISP
switch 'On' the trainer to Run mode.
9. Switch 'On' the supply, then press reset switch.
10. Observe the blinking of LED's according to program.
24
Program:
//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
void main(void)
{
initilise_led();
while (1)
{
blink_led();
}
LEDs are connected with port pins P1.16 to P1.23 of LPC-2294 chip. Following
program will also work without using library file Nvis2294.LIB
25
Experiment No.5
Aim: Write program to blink LEDs one by one. Download and execute
program in LPC-2129 chip. Modify this program according to given
instruction in exercise
Program:
#include <LPC21xx.h> /* LPC21xx definitions in header file */
while (1)
{
for (j = 0x00000004; j < 0x00000800; j <<= 1) /* Blink LED one by
one*/
{ IOSET0 = j; /* Turn on LED */
wait (); /* call wait function */
IOCLR0 = j; /* Turn off LED */
wait();
}
}
}
WORKSHEET
Modify above program in such a way that first four LED glow and other four
LEDs remains OFF for a while and then first four LED switched OFF and
other four LEDs becomes ON as shown in following figure (Alternate Nibble
ON-OFF).
26
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
27
Buzzer is connected at pin number P0.20 via buffer at LPC-2129. Write a
program to get beep on the buzzer. Compile and execute program. Change
beep duration
(Hint: IODIR0 = 0x00300000 and short jumper R35 to get beep in buzzer)
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
28
Experiment No.6
Aim: To write and execute program to display message “display
“WELCOME GEC RAJKOT” on LCD screen for ARM7
Program:
#include <LPC21XX.H>
#define uchar unsigned char
#define uint unsigned int
#define RS 18
#define EN 19
29
{
unsigned char i;
for(i=0;i<8;i++)
{
if(data&1) {Io_Set1(i+16);}
else {Io_Clr1(i+16);}
data=data>>1;
}
}
void delay(unsigned int i)
{
unsigned int k=1000;
while(i>0)
{
i--;
}
while(k>1)k--;
}
}
void LcdWrite_D( char dataW )
{
Io_Set(RS); /* Select Data Register of LCD*/
delay(1);
Sent_Byte(dataW);
30
delay(1);
Io_Set(EN); /* Enable LCD*/
delay(1);
Io_Clr(EN); /* Disable LCD */
delay(2);
delayms(10);
}
LcdWrite_D( Wdata );
}
Compile and build above program with Keil compiler and generate
HEX file. Download HEX file in the chip LPC2129 and execute the program
by pressing RESET key
31
WORKSHEET
[1] What are the pins available on the LCD for interfacing with ARM
processor? Describe functions of the pins.
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[1] Modify LCD program to display character string “Saurashtra” on the first
line and University on the second line. Write modified program again.
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
32
Experiment No.7
Aim: To read analog input voltage and display it on LCD using LPC-2129
ADC introduction and interfacing details:
Functions of various bits of ADDR and ADCR registers are explained below:
33
19:17 CLKS This field selects the number of clocks used for each conversion 000
in Burst mode, and the number of bits of accuracy of the result in
the LS bits of ADDR, between 11 clocks (10 bits) and 4 clocks
(3bits): 000=11 clocks/9 bits.... 111=4 clocks/3 bits
When the Burst bit is 0, these bits control whether and when an
A/D conversion is started:000: no start (this value should be
used clearing PDN to 0
26:24 Start 010: Start conversion when the edge selected by bit 27 occurs 000
on P0.16/EINT0/MAT0.2/CAP0.2
Note: for choices 100-111 the MAT signal need not be pinned
out:
34
A/D Data Register (ADDR) :
35
Procedure:
1. To program IC via serial port, short the 1-2 pin of the jumpers J7 &
J6 (left side). Connect the serial cable to any functional COM port of
your PC and SP2 (DB-9 Connector) port of the trainer (in PC interface
& ISP section).
2. To program IC via USB, short the 2-3 pin of the jumpers J7 &
J6 (right side). Connect the USB cable with PC
3. Change the position of Run/ISP switch 'On' the trainer to ISP mode.
4. Connect the power cable to the trainer and switch 'On' the power
switch.
5. Compile program using KEIL compiler and generate hex file
ADC_Interface.hex
6. Start the Philips flash utility LPC210x_ISP.exe
7. Program ADC_Interface.hex in LPC-2294 using programmer.
8. Switch 'Off’ the power supply and change the position of Run/ISP
switch 'On' the trainer to Run mode.
9. Close 1-2 pin of jumper J1 (left side).
10. Switch ‘On’ the supply, then press reset switch.
12. Examine the voltage on TP1, when voltage on TP1 is 0V, LCD shows
0000 in decimal and when TP1 is 3.3V, LCD shows 1024 in decimal
on LCD (10 bit ADC).
Pin P0.27 (Pin No. 23 is analog input pin) used for this program. There are
total four ADC input pins are available (P0.27, P0.28, P0.29 and P0.30)
Program:
//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
void main(void)
{
adc_initialise();
36
while (1)
{
adc_runmode();
}
}
// Adc.h file
#ifndef ADC_H
#define ADC_H
//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
static unsigned int a,b,c,d,x,y,z;
static unsigned int adcdata;
#endif
:: WORKSHEET ::
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[3] Write decimal value displayed on LCD for following input voltage
Brief Theory:
The ADSP-2181 is a single-chip microcomputer optimized for digital
signal processing (DSP) and other high speed numeric processing
applications. The ADSP-2181 combines the ADSP-2100 family base
architecture (three computational units, data address generators and a
program sequencer) with two serial ports, a 16-bit internal DMA port, a byte
DMA port, a programmable timer, Flag I/O, extensive interrupt capabilities,
and on-chip program and data memory.
38
Functional block diagram of the ADSP-2181 is shown in the following
figure.
39
returns in a single cycle. With internal loop counters and loop stacks, the
ADSP-2181 executes looped code with zero overhead; no explicit jump
instructions are required to maintain loops. Two data address generators
(DAGs) provide addresses for simultaneous dual operand fetches (from data
memory and program memory). Each DAG maintains and updates four
address pointers. Whenever the pointer is used to access data (indirect
addressing), it is post-modified by the value of one of four possible modify
registers. A length value may be associated with each pointer to implement
automatic modulo addressing for circular buffers.
Efficient data transfer is achieved with the use of five internal buses:
The two address buses (PMA and DMA) share a single external
address bus, allowing memory to be expanded off-chip, and the two data
buses (PMD and DMD) share a single external data bus. Byte memory space
and I/O memory space also share the external buses.
Program memory can store both instructions and data, permitting the
ADSP-2181 to fetch two operands in a single cycle, one from program
40
memory and one from data memory. The ADSP-2181 can fetch an operand
from program memory and the next instruction in the same cycle. In
addition to the address and data bus for external memory connection, the
ADSP-2181 has a 16-bit Internal DMA port (IDMA port) for connection to
external systems. The IDMA port is made up of 16 data/address pins and
five control pins. The IDMA port provides transparent, direct access to the
DSPs on-chip program and data RAM. An interface to low cost byte-wide
memory is provided by the Byte DMA port (BDMA port). The BDMA port is
bidirectional and can directly address up to four megabytes of external RAM
or ROM for off-chip storage of program overlays or data tables.
Interrupts:
Serial Ports:
41
• SPORTs can use an external serial clock or generate their own serial
clock internally.
QUESTIONS
[1] What is the difference between Digital Signal Processor and General
Purpose Microprocessor?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
[2] How many pins are there in ADSP-2181. What types of packages are
available?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
42
[4] List five internal bus used for efficient data transfer
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
43
Experiment No.9
Aim: To understand installation procedure of ADSPLite software and ADSP
Kit. To download and run sample programs on ADSP kit.
Brief Theory:
ADSP2181 Kit has following features:
Analog Inputs
o One stereo pair of 2V RMS AC coupled line-level inputs
o One stereo pair of 20mV RMS AC coupled microphone
inputs
• Analog Outputs
o One stereo pair of 1V RMS AC coupled line-level outputs
• Power Source
o 8 to 10V DC at 300mA
• RS-232 Interface
44
Board Layout;
Remove the EZ-KIT Lite board from the package. Be careful while
handling the board to avoid the discharge of static electricity, which may
damage some components.
Plug the provided cord into a 230 Volt AC receptacle and plug the
connector at the other end of the cable into J4 on the evaluation board.
Visually verify that all of the LEDs light up briefly. The power FL1 blinks.
If the LED does not light (green) LED remains on and up, check the
power connections.
To configure the ADSP-2181 board, we can take advantage of the audio
capabilities of the demos, use the following procedure.
Open Jumper JP2 to GND to enable the AD1847 codec. (This is the board
default).
45
Install EZ-KIT Lite software to download software in the ADSP-2181 chip.
After installation of the software, click on the short cut. Following screen will
appear.
The file loads and the Load Complete message appear in the Output window
when the load process has completed.
• Write ADSP program using any text editor and than save it using .dsp
extension.
46
- .INT : Initialization data file
- test.int
- test.cde
- test.obj
Example program:
{
fixdpadd.dsp - Fixed point double precision addition experiment.
}
.module/RAM/ABS=0 example;
.include <c:\adi_dsp\macros\begin1.dsp>;
ax1 = 0x0005;
ax0 = 0x0001;
ay1 = 0x0000;
ay0 = 0x0005;
AR = AX0+AY0; {Add LSWs}
SR0 = AR,AR = AX1+AY1+C; {Add MSWs}
SR1 = AR;
dm(0) = sr0;
dm(1) = sr1;
rts;
.endmod;
Assemble and link above program to generate ROM image
47
WORKSHEET
Write program for addition of two numbers in C language, for 8051 and for
ADSP-2181 and give your comments
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
Write steps to generate ROM image from the assembly language file
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
48
Experiment No.10
Aim: To generate sine wave, square wave using ADSP-2181
Brief Theory:
To generate sine wave using DSP, look up table is prepared. Magnitude of
samples of sine wave is stored in the look up table hex format. Hex value is
transferred to output port one by one. Output port is connected to digital to
analog converter which provides analog output. Accuracy of sine wave
depends on how many number of samples are used to create it. To smooth
the sine wave output of DAC is passed through low pass filter.
Program:
{
Sine wave generation program
}
.module/RAM/ABS=0 wavegen;
.include <c:\adi_dsp\macros\wavgen.dsp>;
.const D = 4000;
.var/dm/circ sine[D]; { Min frequaency f1 = fs/D = 8/4 = 2Hz}
.init sine: <sinetbl.hex>; { Load one period of the wave table}
.const A = 0x1a00; { A = 0.5 = signal amplitude}
.const c = 1000; { Signal frequency f = c * f1 = 1000Hz}
wait: idle; jump wait; {wait for interrupt and loop forever}
49
{interrupt service routine starts here}
input_samples: ena sec_reg; {enable secondary register set}
rti;
.include <c:\adi_dsp\macros\end.dsp>;
.endmod;
Sine Table:
0000,0033,0067,009a,00ce,0101,0135,0168,019c,01cf,0203,0236,026a,029d,02d1,0304,
0337,036b,039e,03d2,0405,0439,046c,04a0,04d3,0506,053a,056d,05a1,05d4,0608,063b,
066e,06a2,06d5,0709,073c,076f,07a3,07d6,080a,083d,0870,08a4,08d7,090a,093e,0971,0
9a4,09d8,0a0b,0a3e,0a72,0aa5,0ad8,0b0b,0b3f,0b72,0ba5,0bd8,0c0c,0c3f,0c72,0ca5,0cd9
,0d0c,0d3f,0d72,0da5,0dd9,0e0c,0e3f,0e72,0ea5,0ed8,0f0b,0f3f,0f72,0fa5,0fd8,100b,103e,
1071,10a4,10d7,110a,113d,1170,11a3,11d6,1209,123c,126f,12a2,12d5,1308,133b,136d,
13a0,13d3,1406,1439,146c,149f,14d1,1504,1537,156a,159c,15cf,1602,1634,1667,169a,
16cc,16ff,1732,1764,1797,17ca,17fc,182f,1861,1894,18c6,18f9,192b,195e,1990,19c3,19f5,
1a27,1a5a,1a8c,1abe,1af1,1b23,1b55,1b88,1bba,1bec,1c1e,1c51,1c83,1cb5,1ce7,1d19,
1d4b,1d7d,1daf,1de2,1e14,1e46,1e78,1eaa,1edc, 1f0d,1f3f,1f71,1fa3,1fd5,2007,2039,206b
…………….7fff,
7fff,7fff,7ffe,7ffd,7ffd,7ffc,7ffb,7ffa,7ff9,7ff8,7ff7,7ff6,7ff4,7ff3,7ff1,7ff0,7fee,7fec,7feb,7fe9,
7fe7,………..,009a,0067,0033,0000
{
Square.dsp – Square wave generated from a wavetable
}
.module/RAM/ABS=0 wavegen;
.include <c:\adi_dsp\macros\wavgen.dsp>;
wait: idle; jump wait; {wait for interrupt and loop forever}
{interrupt service routine starts here}
input_samples: ena sec_reg; {enable secondary register set}
{--- sample processing algorithm -----------------------------------------}
wavgen(i6, m6, A, c, mx1); {mx1 = A * sin(2*pi*f*t)}
{--- write output samples to codec ---------------------------------------}
dm(tx_buf+1) = mx1; {left output sample}
dm(tx_buf+2) = mx1; {right output sample}
WORKSHEET
51
Change sine wave hex table, assemble and link program file again and
observe change in the waveform. Plot modified waveform in the following
space.
QUESTIONS
[1] Explain following instructions for ADSP-2181 processor.
AR=AX0+AY0, AX0=MR2;
AX0=DM(I2,M0), AY0=PM(I4,M6);
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
52
Experiment No.11
Aim: To filter input signal using FIR filter implementation with ADSP-2181
Brief Theory:
In FIR filter, response to impulse becomes zero after a finite number of
samples. Finite duration impulse response filter (FIR) has a system function
of the form:
M 1
H ( z ) b0 b1 z 1 .......... bM 1 z 1 M bn z n
n 0
53
Program:
{ FIR Low pass filter: lowpass.dsp }
ax0 = 0;
dm(v1) = ax0; { clear feedback delay, v1 = 0}
zero(i2, m2, L2); { clear delay line}
wait: idle; jump wait; { wait for interrupt and loop forever}
{ Interrupt service routine starts here}
input_samples: ena sec_reg; {enable secondary register set}
{--- sample processing algorithm --- process right channel only ----------}
mx0 = a;
my1 = dm(v1); {state v1}
54
mr = mr + mx0 * my1 (rnd); {mr = v0 = sD + a * v1}
if mv sat mr;
sr0 = mr1; { Save v0 for later updating v1}
my0 = b0;
mr = mr1 * my0 (ss); {mr = b0 * v0}
mx0 = b1;
mr = mr + mx0 * my1 (rnd); {mr = u = b0 * v0 + b1 * v1}
if mv sat mr;
WORKSHEET
55
:: WORKSHEET::
[1] Change filter coefficients in the program:
Instead of b0 = 0.2 and b1=0.1 use b0=0.5 and b1=-0.5. Assemble and link
program again. Download ROM image in ADSP kit and run it. Observe
variation in amplitude with frequency.
[2] What is the difference between FIR filter and IIR filter?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
56
Experiment No.12
Aim: To understand architecture of TMS320C6713 DSP chip
The general purpose DSP processors are available from Intel, Texas
Instruments, Motorola, Analog devices, Agere, DSP groups etc.
TMS320C6713 is manufactured by Texas. DSP systems are embedded into
larger systems to perform specialized DSP functions. Texas Instruments
introduced fixed point and floating point processors. The examples of 16 bit
fixed point DSP processors from the Texas are: TMS320C2000 (C24x and
C28x), TMS320C5000 (C54x and C55x), TMSC6000 (C62x and C64x). 32 Bit
floating point processors are: TMS320C3x (C30, C31, C32 and C33),
TMS320C40 and TMS320C67xx (TMS320C6711, TMS320C6712,
TMS320C6713).
Let us understand brief introduction of TMS320C6000 platform. The
TMS320C6000 has performance of 2000 MIPS (Million instructions per
second) at 250 MHz. TMS320C6000 platform provides good solution for the
multi-channel, multifunction applications such as Audio processing,
Imaging, Pooled modems, Wireless local loop base stations, Beam-forming
base stations, Remote access servers (RAS), Digital subscriber loop (DSL)
systems, Cable modems, Multi-channel telephony systems, Virtual reality 3-
D graphics, Speech recognition, Radar, Atmospheric modeling etc.
TMS320C6000 processors consists of three main parts: CPU (or the
core), peripherals, and memory. The DSP core CPU consists of 32 general-
purpose registers of 32-bit word length and eight functional units:
Two multipliers
Six ALUs
Above eight functional units operate in parallel, with two similar sets
of the basic four functional units. The units communicate using a cross
path between two register files, each of which contains 16 32-bit registers.
Program parallelism is defined at compile time because there is no data
dependency checking done in hardware during run time. The 256-bit-wide
program memory fetches eight 32-bit instructions every single cycle.
The general block diagram of TMS320C6000 DSP is shown in the
Fig.1. The C6000 devices comes with on-chip program and data memory,
which may be configured as cache on some devices. Different devices have
varying size of data memory. Peripherals include a direct memory access
(DMA) controller, power-down logic, external memory interface (EMIF), serial
port(s), expansion bus or host port, and timer(s)
57
Fig. 1 General Block diagram of TMS320C6000 DSP
58
64K Bytes of the 256K Bytes in L2 memory can be configured as mapped
memory, cache, or combinations of the two. The remaining 192K Bytes in L2
serves as mapped SRAM. The C6713/13B has a rich peripheral set that
includes two Multi-channel Audio Serial Ports (McASPs), two Multi-channel
Buffered Serial Ports (McBSPs), two Inter-Integrated Circuit (I2C) buses, one
dedicated General-Purpose Input/Output (GPIO) module, two general-
purpose timers, a host-port interface (HPI), and a glueless external memory
interface (EMIF) capable of interfacing to SDRAM, SBSRAM, and
asynchronous peripherals.
The two McASP interface modules each support one transmit and one
receive clock zone. Each of the McASP has eight serial data pins which can
be individually allocated to any of the two zones. The serial port supports
time-division multiplexing on each pin from 2 to 32 time slots. The
C6713/13B has sufficient bandwidth to support all 16 serial data pins
transmitting a 192 kHz stereo signal. Serial data in each zone may be
transmitted and received on multiple serial data pins simultaneously and
formatted in a multitude of variations on the Philips Inter-IC Sound (I2S)
format. In addition, the McASP transmitter may be programmed to output
multiple S/PDIF, IEC60958, AES-3, CP-430 encoded data channels
simultaneously, with a single RAM containing the full implementation of
user data and channel status fields. The McASP also provides extensive
error-checking and recovery features, such as the bad clock detection circuit
for each high-frequency master clock which verifies that the master clock is
within a programmed frequency range.
The two I2C ports on the TMS320C6713/13B allow the DSP to easily
control peripheral devices and communicate with a host processor. In
addition, the standard multi-channel buffered serial port (McBSP) may be
used to communicate with serial peripheral interface (SPI) mode peripheral
devices.
The TMS320C6713/13B device has two bootmodes: one is from the
HPI or other is from external asynchronous ROM.
TMS320C6713 DSP chip comes in 272 ball BGA package and 208 pin
Plastic Quad Flat Pack (PQFP). For the detail ball diagram and pin diagram,
students should refer datasheet of TMS3206713.
The general block diagram of TMS320C6713 is shown in Fig. 2.
59
Fig. 2 General block diagram of TMS320C6713 DSP chip
60
instructions, the six out of eight functional units (.L1, .S1, .M1, .M2, .S2,
and .L2) also execute floating-point instructions. The remaining two
functional units (.D1 and .D2) also execute the new LDDW instruction
which loads 64 bits per CPU side for a total of 128 bits per cycle.
Another key feature of the C67x CPU is the load/store architecture,
where all instructions operate on registers (as opposed to data in memory).
Two sets of data-addressing units (.D1 and .D2) are responsible for all data
transfers between the register files and the memory. The data address driven
by the .D units allows data addresses generated from one register file to be
used to load or store data to or from the other register file. The C67x CPU
supports a variety of indirect addressing modes using either linear- or
circular-addressing modes with 5- or 15-bit offsets. All instructions are
conditional, and most can access any one of the 32 registers. Some
registers, however, are singled out to support specific addressing or to hold
the condition for conditional instructions (if the condition is not
automatically “true”). The two .M functional units are dedicated for
multiplies. The two .S and .L functional units perform a general set of
arithmetic, logical, and branch functions with results available every clock
cycle. The processing flow begins when a 256-bit-wide instruction fetch
packet is fetched from a program memory. The 32-bit instructions destined
for the individual functional units are “linked” together by “1” bits in the
least significant bit (LSB) position of the instructions. The instructions that
are “chained” together for simultaneous execution (up to eight in total)
compose an execute packet. A “0” in the LSB of an instruction breaks the
chain, effectively placing the instructions that follow it in the next execute
packet. If an execute packet crosses the fetch-packet boundary (256 bits
wide), the assembler places it in the next fetch packet, while the remainder
of the current fetch packet is padded with NOP instructions. The number of
execute packets within a fetch packet can vary from one to eight. Execute
packets are dispatched to their respective functional units at the rate of one
per clock cycle and the next 256-bit fetch packet is not fetched until all the
execute packets from the current fetch packet have been dispatched. After
decoding, the instructions simultaneously drive all active functional units
for a maximum execution rate of eight instructions every clock cycle. While
most results are stored in 32-bit registers, they can be subsequently moved
to memory as bytes or half-words as well. All load and store instructions are
byte-, half-word, or word-addressable.
61
Fig. 3 TMS320C6713 DSP Core description
The components of the data path for the TMS320C67xCPU are shown
in the Fig. 3. These components consist of:
Two general-purpose register files (A and B)
Eight functional units (.L1, .L2, .S1, .S2, .M1, .M2, .D1, and .D2)
Two load-from-memory data paths (LD1 and LD2)
Two store-to-memory data paths (ST1 and ST2)
Two data address paths (DA1 and DA2)
Two register file data cross paths (1X and 2X)
62
address pointers, or condition registers. Most data lines in the CPU support
32-bit operands, and some support long (40-bit) and double word (64-bit)
operands. Each functional unit has its own 32-bit write port into a general-
purpose register file.
Functional units:
The eight functional units in the C6713 data paths can be divided into two
groups of four; each functional unit in one data path is almost identical to
the corresponding unit in the other data path. The functional units are
described in the following table.
Most data lines in the CPU support 32-bit operands, and some support long
(40-bit) and double word (64-bit) operands. Each functional unit has its own
32-bit write port into a general-purpose register. All units ending in 1 (for
example, .L1) write to register file A, and all units ending in 2 write to
register file B. Each functional unit has two 32-bit read ports for source
operands src1 and src2. Four units (.L1, .L2, .S1, and .S2) have an extra 8-
bit-wide port for 40-bit long writes, as well as an 8-bit input for 40-bit long
reads. Because each unit has its own 32-bit write port, when performing 32-
bit operations all eight units can be used in parallel every cycle.
63
Memory load and store paths:
The C67x DSP has two 32-bit paths for loading data from memory to
the register file: LD1 for register file A, and LD2 for register file B. The
C67x DSP also has a second 32-bit load path for both register files A and
B. This allows the LDDW instruction to simultaneously load two 32-bit
values into register file A and two 32-bit values into register file B. For
side A, LD1a is the load path for the 32 LSBs and LD1b is the load path
for the 32 MSBs. For side B, LD2a is the load path for the 32 LSBs and
LD2b is the load path for the 32 MSBs. There are also two 32-bit paths,
ST1 and ST2, for storing register values to memory from each register
file. On the C6000 architecture, some of the ports for long and
doubleword operands are shared between functional units. This places a
constraint on which long or doubleword operations can be scheduled on
a data path in the same execute packet.
Two data address paths (DA1 and DA2):
The data address paths (DA1 and DA2) are each connected to the .D
units in both data paths. This allows data addresses generated by any
one path to access data to or from any register. The DA1 and DA2
resources and their associated data paths are specified as T1 and T2,
respectively. T1 consists of the DA1 address path and the LD1 and ST1
data paths. For the C67x DSP, LD1 is comprised of LD1a and LD1b to
support 64-bit loads. Similarly, T2 consists of the DA2 address path and
the LD2 and ST2 data paths. For the C67x DSP, LD2 is comprised of
LD2a and LD2b to support 64-bit loads. The T1 and T2 designations
appear in the functional unit fields for load and store instructions. For
example, the following load instruction uses the .D1 unit to generate the
address but is using the LD2 path resource from DA2 to place the data in
the B register file. The use of the DA2 resource is indicated with the T2
designation.
LDW .D1T2 *A0[3],B1
Two register file data cross paths (1X and 2X)
Each functional unit reads directly from and writes directly to the
register file within its own data path. That is, the .L1, .S1, .D1, and .M1
units write to register file A and the .L2, .S2, .D2, and .M2 units write to
register file B. The register files are connected to the opposite-side
register file’s functional units via the 1X and 2X cross paths. These cross
paths allow functional units from one data path to access a 32-bit
operand from the opposite side register file. The 1X cross path allows the
functional units of data path A to read their source from register file B,
and the 2X cross path allows the functional units of data path B to read
their source from register file A. On the C67x DSP, six of the eight
functional units have access to the register file on the opposite side, via a
cross path. The .M1, .M2, .S1, and .S2 units’ src2 units are selectable
between the cross path and the same side register file. In the case of the
.L1 and .L2, both src1 and src2 inputs are also selectable between the
cross path and the same-side register file. Only two cross paths, 1X and
64
2X, exist in the C6000 architecture. Thus, the limit is one source read
from each data path’s opposite register file per cycle, or a total of two
cross path source reads per cycle. In the C67x DSP, only one functional
unit per data path, per execute packet, can get an operand from the
opposite register file.
QUESTIONS
[1] What is the function of following units in DSP chip TMS320C6713?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
65
Experiment No. 13
Aim: To understand features of Cypress Programmable System on Chip
(PSoC). To download and execute demo programs to display vertical bar
graph using LEDs depending on analog input voltage.
Introduction:
Configurable analog and digital circuitry is the basis of the PSoC platform.
We can configure these blocks using pre-built library functions or by
creating our own. By combining several digital blocks, we can create 16-,
24-, or even 32-bit wide logic resources. The analog blocks are composed of
switch capacitor, op-amp, comparator, ADC, DAC, and digital filter blocks,
allowing complex analog signal flows
CPU Subsystem:
PSoC has sophisticated CPU subsystem with SRAM , EEPROM, and flash
memory, multiple core options and a variety of essential system resources
including:
PSoC devices also have dedicated communication interfaces like I2C, Full-
Speed USB 2.0, CAN 2.0, and on-chip debugging capabilities using JTAG
66
and Serial Wire Debug. The newest members of the PSoC family offer
industry-standard processors like the 8051 and ARM Cortex-M3.
We will use PSoC designer software to execute and download programs into
PSoC Device CY8C24894. Program reads analog input voltage which given
by preset available on the board. Depending on preset value, LEDs as
glowing.
Procedure:
1. LED_1
Select the Port, Pin and Drive mode
a. PORT -> Port_2
b. PIN -> Port_2_4
c. Drive -> Active High
2. LED_2
Select the Port, Pin and Drive mode
a. PORT -> Port_2
b. PIN -> Port_2_0
c. Drive -> Active High
3. LED_3
Select the Port, Pin and Drive mode
a. PORT -> Port_2
b. PIN -> Port_2_1
c. Drive -> Active High
4. LED_4
Select the Port, Pin and Drive mode
67
a. PORT -> Port_2
b. PIN -> Port_2_2
c. Drive -> Active High
5. LED_5
Select the Port, Pin and Drive mode
a. PORT -> Port_2
b. PIN -> Port_2_3
c. Drive -> Active High
6. LED_6
Select the Port, Pin and Drive mode
a. PORT -> Port_2
b. PIN -> Port_2_5
c. Drive -> Active High
7. ADCINC_1
Select the parameters as below
a. DataFormat -> UnSigned
b. Resolution -> 10bit
c. Data Clock -> VC1
d. ClockPhase -> Normal
e. PosInput -> ACB00
8. PGA_1
Select the parameters as below
a. Gain -> 1.000
b. Input -> AnalogColumnMuxBusSwitch_0
c. Reference -> VSS
d. AnalogBus -> Disable
WORD wData;
M8C_EnableGInt; // Enable Global Interrupts
PGA_1_Start(PGA_1_HIGHPOWER); // Apply power to the CT Block
ADCINC_1_Start(ADCINC_1_HIGHPOWER); // Apply power to the SC Block
ADCINC_1_GetSamples(0); // Have ADC run continuously
for(;;)
{
while(ADCINC_1_fIsDataAvailable() == 0); // Loop until value ready
wData = ADCINC_1_iClearFlagGetData(); // Clear ADC flag and get data
if(wData>186)
LED_2_On();
68
else
LED_2_Off();
if(wData>352)
LED_3_On();
else
LED_3_Off();
if(wData>518)
LED_4_On();
else
LED_4_Off();
if(wData>684)
LED_5_On();
else
LED_5_Off();
if(wData>850)
LED_6_On();
else
LED_6_Off();
}
4. Click Program at the top of the window. This will open the PSoC
Programmer application.
69
Experiment No. 14
Aim: To read analog voltage and display it on LCD using cypress kit
Description: This project displays a voltage input as a numeric value and as
a bar graph on an LCD display.
Board Section: Bottom Left
PSoC Device: CY8C27643
Project Location: \Projects\AnalogInputDriveLCD
Procedure for experiment:
1. ADCINC_1
Select the parameters as below
a. DataFormat -> Unsigned
b. Resolution -> 10bit
c. Data Clock -> VC1
d. ClockPhase -> Normal
e. PosInput -> ACB00
2. PGA_1
Select the parameters as below
a. Gain -> 1.000
b. Input -> AnalogColumn_InputMux_0
c. Reference -> VSS
d. AnalogBus -> Disable
3. LCD_1
Select the parameters as below
a. LCDPort -> Port_4
b. BarGraph -> Enable
WORD wData;
BYTE bBarPos
70
M8C_EnableGInt; // Enable Global Interrupts
PGA_1_Start(PGA_1_LOWPOWER);
ADCINC_1_Start(ADCINC_1_LOWPOWER); // Apply power to the SC Block
ADCINC_1_GetSamples(0); // Have ADC run continuously
LCD_1_Init();
LCD_1_Start(); // Initialize LCD
LCD_1_Position(1,0); // Place LCD cursor at row 0, col 5.
LCD_1_InitBG(LCD_1_SOLID_BG);
while(1)
{
while(ADCINC_1_fIsDataAvailable() == 0); // Loop until value ready
wData = ADCINC_1_iClearFlagGetData(); // Clear ADC flag and get data
bBarPos = ((float)wData/1024)*80;
LCD_1_DrawBG(0,0,16,bBarPos);
LCD_1_Position(1,0); // Place LCD cursor at row 1, col 0.
LCD_1_PrHexInt(wData);
}
4. Click Program at the top of the window. This will open the PSoC
Programmer application.
71
Experiment No.15
Aim: To become familiar with GCC compiler, WinARM and crossware
development tools. To assemble and run programs using crossware
tools
Write your program in the text editor provided in the Linux and save it with
extension .c for C .cpp for C++ and .s for assembly language
Give following command on command line (Dollar sign $ is shell prompt)
$ g++ test.cpp
This command will compile test.cpp file and generates binary file a.out because
we have not specified target file name
To run the program type:
$./a.out
We can also give output file option like following:
$ g++ -o test.o test.cpp
It will generate output file test.o
To run this file in shell prompt:
$ ./test
Write any c++ program and try above commands
Similarly C programs can be compiled by GNU GCC compiler
$ gcc test.c
$ gcc –o test test.c
-c option can be specified to compile only (It will compile but not link)
$ gcc –c test.c
Stop after assembling. Do not link…
(It will not generate executable file. This will check syntax error in the program)
Another option is –S.
$ gcc –s test.c
This will compile but not assemble and link the program.
-Wall option turn on all warning levels.
$ gcc –Wall –W test.c
To turn off all the warning use following command (Actually do not use it because it
will not give any warning which is dangerous during programming)
$ gcc –w test.c
$ g++ -w test.cpp (For C++)
72
$ as test.s
This will generate HEX file test.elf which can be further programmed into
the chip
Program 1:
MOV R1,#0x55
MOV R2,#0x33
ADD R3,R1,R2
SUB R4,R1,R2
LOOP: B LOOP
Program 2:
MOV R0,#0x64
MOV R1,#0x10
LOOP: ADD R1,R1,#1
CMP R1,R0
BLT LOOP
HERE: B HERE
73
:: ASSIGNMENT ::
74