You have no items in your shopping cart.

Subtotal: 0.00

User Manual for PSoC 3 Development Kit

Introduction

PRIMER-PSoC 3 Kit, is proposed to smooth the progress of developing and debugging of various designs encompassing of High speed 8-bit MCU from Cypress. The board supports most of the Cypress components devices and some peripheral options in the PSoC Creator2.1. It integrates on board UART, LEDs, Relays, Motor Interface, keypads, an ADC input and LCD Display to create a stand-alone versatile test platform.

Specifications

MCU

CYPRESS’s PSoC3 CY8C3866AXI-040 ( 8051 MCU )

Memory

64KB Flash – Program Memory 2KB EEPROM + 8KB SRAM – Data Memory

Clock

24MHz crystal for maximum (67MHz CPU clock) | 32 KHz RTC crystal

On-Board Peripherals

 

  • 2 Nos. Cap Sense Buttons
  • Cap Sense Linear Slider
  • 8 Nos. Point LEDs
  • 8 Nos. Digital Input(Slide Switch)
  • 4x4 Matrix Keypad
  • 2X16 Character LCD with back Light
  • 4 Nos. 7-Segment Display
  • 2 Nos. Analog Input (Potentiometer)
  • Temperature Sensor
  • Stepper Motor Interface
  • 2 Nos. of SPDT Relay
  • RTC with Batter-Backup (I2C)
  • 4KB SERIAL EEPROM (I2C)
  • UART(RS232) interface
  • USB 2.0 device interface
  • Buzzer (Alarm)
  • Digital/Analog Output
  • Interrupts Study, Reset Button
  • Traffic Light Study controller, Led

 

Power

  • 9-12V, AC/DC- Adaptors,Power form USB (+5V) (+3.3V, 800mA)

Connectors

 

  • JTAG (Programming/ Debugging)
  • D-SUB Connector (Serial Port, ISP)
  • 20 – PIN Expansion Connector
  • Ext Analog Input Connector
  • Ext Relay Input Connector
  • Power Connector
  • Usb Connector

 

General Block Diagram





CY8C3866 Processor Features

 

  • Single Cycle 8051 CPU 8-bit PSoC 3 Cypress microcontroller in a 100 pin TQFP package.
  • Up to 8 KB SRAM, Up to 2 KB electrically erasable programmable read-only memory (EEPROM), 1 M cycles, and 20 years retention
  • Flash program memory, up to 64 KB, 100,000 write cycles,20 years retention, and multiple security features
  • Versatile I/O system : 28 to 72 I/O (62 GPIOs, eight special input/outputs (SIO),two USBIOs[2]). Any GPIO to any digital or analog peripheral routability
  • Digital peripherals : 20 to 24 programmable logic device (PLD) based universal, digital blocks (UDB), Full CAN 2.0b 16 Rx, 8 Tx buffers, Full-speed (FS) USB 2.0 12 Mbps using internal oscillator, Up to four 16-bit configurable timer, counter, and PWM blocks, 67 MHz, 24-bit fixed point digital filter block (DFB) toimplement FIR and IIR filters
  • Library of standard peripherals : - 8-, 16-, 24-, and 32-bit timers, counters, and PWMs - Serial peripheral interface (SPI), universal asynchronous transmitter receiver (UART), and I2C
  • Analog peripherals (1.71 V ≤ VDDA ≤ 5.5 V): - Configurable delta-sigma ADC with 8- to 20-bit resolution -Sample rates up to 192 ksps & Programmable gain stage: ×0.25 to ×16 -12-bit mode, 192 ksps, 66-dB signal to noise and distortion ratio (SINAD), ±1-bit INL/DNL -16-bit mode, 48 ksps, 84-dB SINAD, ±2-bit INL, ±1-bit DNL - Up to four 8-bit, 8-Msps IDACs or 1-Msps VDACs - Four comparators with 95-ns response time - Up to four uncommitted opamps with 25-mA drive capability - Up to four configurable multifunction analog blocks. Example configurations are programmable gain amplifier (PGA), transimpedance amplifier (TIA), mixer, and sample and hold - CapSense support
  • Programming, debug, and trace: - JTAG (4-wire), serial wire debug (SWD) (2-wire), and single wire viewer (SWV) interfaces - Bootloader programming supportable through I2C, SPI,UART, USB, and other interfaces

 

Jumper & Connector Details

 

Stepper / Relay

JP1

Internal Supply (+5V)

External Supply(+5V)

Analog I/P1 (P0.2)

J10

External Analog Input-1 select

On-Board Analog Input(+3.3V)

Analog I/P2 (P0.3)

J21

External Analog Input-2 select

On-Board Analog Input(+3.3V)

Buzzer (P0.7)

J16

Disable Buzzer

Enable Buzzer

Temp Sensor(P0.1)

J22

Disable

Enable

LED

J15

Enable LEDs, Port (P0.0 – P0.7)

Disable LEDs.

Voltage

J5

VBUS = 5V

VREG = 5V

Voltage

J3

VDDD = 5V

VDDD = 3.3V

 



Note: The bolded jumper settings should be in right position before the power on the kit.

Connector Details

20-Pin Expansion Connector





JTAG Connector





POWER SUPPLY

The external power can be AC or DC, with a voltage between (9V/12V,1A output) at 230V AC input. The PSoC board produces +5V using an LM7805 voltage regulator, which provides supply to the peripherals. LM1117 Fixed +3.3V positive regulator used for processor & processor related peripherals. USB socket meant for power supply and USB communication. Separate On/Off Switch (SW1) for controlling power to the board.

 

On/Off

SW1

Power on

Power off

 



ON-BOARD PERIPHERALS

The Development kit comes with many interfacing options

 

  • Cap Sense Linear Slider
  • 2 Nos. Cap Sense Buttons
  • 8-Nos. of Point LED’s (Digital Outputs)
  • 8-Nos. of Digital Inputs (slide switch)
  • 2 Lines X 16 Character LCD Display
  • 4 Digit Seven-segment display
  • 4 X 4 Matrix keypad
  • Stepper Motor Interface
  • 2 Nos. Relay Interface
  • 2 Nos. Analog Input (Potentiometer)
  • UART for serial port communication through PC
  • USB 2.0 device interface
  • I2C Serial EEPROM
  • I2C Real Time Clock with battery backup
  • Temperature Sensor
  • Buzzer(Alarm Interface)
  • DAC output
  • Interrupts Study, Reset Button
  • Traffice Light Control study, Led
  • GLCD (Optional)
  • Traffic Light Module(Optional)

 

Light Emitting Diodes

 

  • Light Emitting Diodes (LEDs) are the most commonly used components, usually for displaying pin’s digital states.
  • The PSoC 3 kit has 8 nos., of Point LEDs, connected with port pins (P0.1 to P0.7), to glow a led make a port pins high.

 

 

Point LEDs

CY8C3866A lines

LED Selection

DIGITAL OUTPUTS

D17

P0.0

D18

P0.1

D19

P0.2

D20

P0.3

D21

P0.4

D22

P0.5

D23

P0.6

D24

P0.7

 



Digital Inputs

 

  • This is another simple interface, of 8-Nos. of slide switch, mainly used to give an input to the port lines, and for some control applications also.
  • The PSoC 3 kit, slide switches (SW23 to SW31) is connected with port pins (P3.0 to P3.7), user can give logical inputs ‘HIGH’ .
  • The switches are connected to ground, in order to detect a switch state, pull-up resistor should be used.

 

 

Slide Switch

CY8C3866A lines

Input Logic Selection

DIGITAL INPUTS

SW23

P3.0

SW24

P3.1

SW25

P3.2

SW26

P3.3

SW27

P3.4

SW28

P3.5

SW30

P3.6

SW31

P3.7

 



LCD 2x16 IN 4-BIT MODE

The PSoC 3 kit, have 2x16 character LCD. 7 pins are needed to create 4-bit interface; 4 data bits (P2.0 – P2.3, D4-D7), address bit (RS-P2.5), read/write bit (R/W-P2.6) and control signal (E-P2.4). The LCD controller is a standard KS0070B or equivalent, which is a very well-known interface for smaller character based LCDs.

Figure below illustrate the LCD part of the design and which pins are used for the interface. The LCD is powered from the 5V power supply enabled by switch SW29.

 

 

LCD MODULE

CY8C3866A LINES

2x16 LCD Selection

CONTROL

RS

P2.5

RW

P2.6

E

P2.4

DATA LINES

D0-D3

NC

D4

P2.0

D5

P2.1

D6

P2.2

D7

P2.3

 

Make switch SW29 to ‘LCD’ label marking position

 



Seven Segment Display

In PSoC 3 kit, 4 nos. of common anode seven segment displays are controlled by Enable pin using four gpio(P6.0 – P6.3) and data Port pin (P4.0-P4.7). The 7-segmend display is powered from the 5V power supply enabled by switch SW29.

 

7-SEG Display

7-SEG

CY8C3866A LINES

7-SEG PWR Selection

A

P4.0

B

P4.1

C

P4.2

D

P4.3

E

P4.4

F

P4.5

G

P4.6

DP

P4.7

SEG1

P6.0

SEG2

P6.1

SEG3

P6.2

 

SEG4

P6.3

 

 

Make switch SW29 to ‘7SEG’ label marking position

 



128x64 GLCD Graphical LCD

The PSoC 3 kit is the GLCD. 14 pins are needed to create 8-bit interface; 8 data bits (P0.8 – P0.15, DB0-DB7), two chip select line P0.0(CS1) and P0.1(CS2), address bit (R/S-P0.4), read/write bit (R/W-P0.5) and control signal (E-P0.6) and Reset (RST-P0.7). The GLCD controller is a standard S6B0108 or equivalent, which is a very well-known interface for Graphical based LCDs.

Figure below illustrate the GLCD part of the design and which pins are used for the interface. The GLCD is powered from the 5V power supply enabled by switch SW28.

 

 

GLCD

CY8C3866A LINES

128x64 GLCD Selection

CONTROL L LINES

CS1

P0.0

CS2

P0.1

RS

P0.4

R/W

P0.5

E

P0.6

LCD – DATA LINES

DB0

P0.8

DB1

P0.9

DB2

P0.10

DB3

P0.11

DB4

P0.12

DB5

P0.13

DB6

P0.14

DB7

P0.15

RST

P0.7

 

Make switch SW28 and SW30 to ‘GLCD’ label marking position

 



Pin Details of GLCD





4x4 Matrix keypad

Keypads arranged by matrix format, each row and column section pulled by high or low by selection J5, all row lines(P3.0 – P3.3) and column lines(P3.4 to P3.7) connected directly by the port pins.

 

 

4x4 Matrix Lines

CY8C3866A lines

4x4 Matrix Keypad

ROW

ROW-0

P3.0

 

ROW-1

P3.1

ROW-2

P3.2

ROW-4

P3.3

COLUMN

COLUMN-0

P3.4

COLUMN-1

P3.5

COLUMN-2

P3.6

COLUMN-3

P3.7

 



Note:

While using Keypad ensure slide switches (SW23-SW26) to On position. (The same lines used for both slide switches and matrix keypads)

Stepper Motor

The ULN2803A is a high-voltage, high-current Darlington transistor array. The device consists of eight NPN Darlington pairs that feature high-voltage outputs with common-cathode clamp diodes for switching inductive loads. The collector-current rating of each Darlington pair, 500 mA.

ULN2803 is used as a driver for port I/O lines, drivers output connected to stepper motor, connector provided for external power supply if needed.

 

 

Stepper Motor(5V)

CY8C3866A lines

Stepper Motor PWR Select

STEPPER MOTOR

COIL-A

P0.0

COIL-B

P0.1

COIL-C

P0.2

COIL-D

P0.3

Make switch SW29 to SM/RL label

marking position.

 



For Motor/relay section obtain power from on-board (internal) or external supply through jumper JP1.

Relay Interface

ULN2803 is used as a driver for port I/O lines, drivers output connected to relay modules. Connector provided for external power supply if needed.

Relay Module : Port P0 pins (Realy1 – P0.4) and (Relay2-P0.5) for relay module, make port pins to high, relay will activated

 

 

RELAY SPDT

CY8C3866A lines

RELAY Power Select

RELAY Modules

Relay-1

P0.4

Relay-2

P0..5

Note : Relay selection make switch SW29 to SM/RL label marking position

 



For Motor/relay section obtain power from on-board (internal) or external supply through jumper JP8.

RS-232 Communication

 

  • RS-232 communication enables point-to-point data transfer. It is commonly used in data acquisition applications, for the transfer of data between the microcontroller and a PC.
  • The voltage levels of a microcontroller and PC are not directly compatible with those of RS-232, a level transition buffer such as MAX3232 be used.

 

 

UART DB-9 Connector

CY8C3866A lines

Serial Port Section

UART

P1

RX

P4.4

TX

P4.5

RTS

P4.6

CTS

P4.7

 





Note : Make Switch SW5 to uart on position as label marking position

Serial EEPROM

The AT24C01A/02/04/08/16 provides 1024/2048/4096/8192/16384 bits of serial electrically erasable and programmable read-only memory (EEPROM) organized as 128/256/512/1024/2048 words of 8 bits each. The device is optimized for use in many industrial and commercial applications where low-power and low-voltage operation are essential.

Features of AT24Cxx:

 

  • Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K)
  • 2-wire Serial Interface
  • Bi-directional Data Transfer Protocol
  • 100 kHz (1.8V, 2.5V, 2.7V) and 400 kHz (5V) Compatibility
  • Write Protect Pin for Hardware Data Protection
  • 8-byte Page (1K, 2K), 16-byte Page (4K, 8K, 16K) Write Modes –Data Retention: 100 Years.

 

 

I2C EEPROM

CY8C3866A lines

Serial EEPROM

AT 24xx

SCL

SCL1 - (P12.0)

SDA

SDA1 - (P12.1)

 



Real Time Clock (DS1307)

The Real Time Clock (RTC) is a set of counters for measuring time when system power is on, and optionally when it is off. It uses little power in Power-down mode. On the PSoC 3 Board, the RTC can be clocked by a separate 32.768 KHz oscillator, or by a programmable prescale divider based on the VPB clock. Also, the RTC is powered by its own power supply pin, VBAT, which can be connected to a battery or to the same 3.3 V supply used by the rest of the device.

Features

 

  • Measures the passage of time to maintain a calendar and clock.
  • Ultra Low Power design to support battery powered systems.
  • Provides Seconds, Minutes, Hours, Day of Month, Month, Year, Day of Week, Day of Year.
  • Dedicated 32 kHz oscillator or programmable pre-scalar from VPB clock.
  • Dedicated power supply pin can be connected to a battery or to the main 3.3 V.

 

 

I2C RTC

CY8C3866A lines

Real Time Clock

DS1307

SCL

SCL1 - (P12.0)

SDA

SDA1 - (P12.1)

 



On-Chip ADC





Features

 

  • Selectable resolutions, 8 to 20 bits (device dependent)
  • Eleven input ranges for each resolution
  • Sample rate 10 sps to 384 ksps
  • Operational modes: -Single sample - Multi-sample - Continuous mode - Multi-sample (Turbo)
  • High input impedance input buffer -Selectable input buffer gain (1, 2, 4, 8) or input buffer bypass
  • Multiple internal or external reference options
  • Automatic power configuration
  • Up to four run-time ADC configurations

 

General Description

The Delta Sigma Analog to Digital Converter (ADC_DelSig) provides a low-power, low-noise front end for precision measurement applications. You can use it in a wide range of applications, depending on resolution, sample rate, and operating mode. It can produce 16-bit audio; high speed and low resolution for communications processing; and high-precision 20-bit low-speed conversions for sensors such as strain gauges, thermocouples, and other high-precision sensors. When processing audio information, the ADC_DelSig is used in a continuous operation mode. When used for scanning multiple sensors, the ADC_DelSig is used in one of the multi-sample modes. When used for single-point high-resolution measurements, the ADC_DelSig is used in single-sample mode.

Delta-sigma converters use oversampling to spread the quantization noise across a wider frequency spectrum. This noise is shaped to move most of it outside the input signal's bandwidth. An internal low-pass filter is used to filter out the noise outside the desired input signal bandwidth. This makes delta-sigma converters good for both high-speed medium-resolution (8 to 16 bits) applications, and low-speed high-resolution (16 to 20 bits) applications. The sample rate can be adjusted between 10 and 384000 samples per second, depending on mode and resolution. Choices of conversion modes simplify interfacing to single streaming signals such as audio, or multiplexing between multiple signal sources.

The ADC_DelSig is composed of three blocks: an input amplifier, a third-order delta-sigma modulator, and a decimator (see Figure 1). The input amplifier provides a high-impedance input and a user-selectable input gain. The decimator block contains a four-stage CIC decimation filter and a post-processing unit. The CIC filter operates on the data sample directly from the modulator. The post-processing unit optionally performs gain, offset, and simple filter functions on the output of the CIC decimator filter.





In PSoC 3 kit, for testing on-board analog input, port lines P0.2 and P0.3 connected through 10K potentiometer selected by jumpers. The signals P0.2 and P0.3 can be used as general purpose pins if the analog inputs are not used and in this case the analog voltages can easily be removed by removing the two jumpers on J10 and J21.

 

On-Chip ADC

ADC Inputs

CY8C3866A lines

ADC Select

 

POT (R22)

ADC1

P0.2

 

POT (R74)

ADC2

P0.3

 



On-Chip Digital-to-Analog Converter (DAC)





Features

 

  • Voltage output ranges: 1.020-V and 4.080-V full scale
  • Software- or clock-driven output strobe
  • Data source can be CPU, DMA, or Digital components

 

General Description

The VDAC8 component is an 8-bit voltage output Digital to Analog Converter (DAC). The output range can be from 0 to 1.020 V (4 mV/bit) or from 0 to 4.08 V (16 mV/bit). The VDAC8 can be controlled by hardware, software, or a combination of both hardware and software.

In PSoC 3 kit, DAC(P0.7) output terminated at Test point(TP7).



On-Chip DAC

DAC Output

CY8C3866A lines

TP7

Aout

P0.7

 



Temperature Sensor-LM35

The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling.

The LM35 does not require any external calibration or trimming to provide typical accuracies of ±¼°C at room temperature and ±¼°C over a full -55 to +150°C temperature range. Low cost is assured by trimming and calibration at the wafer level. It can be used with single power supplies, or with plus and minus supplies. The LM35 is rated to operate over a -55° to +150°C temperature range, while the LM35C is rated for a -40° to +110°C range (-10° with improved accuracy).

Features

 

  • Calibrated directly in ° Celsius (Centigrade)
  • Linear + 10.0 mV/°C scale factor
  • 0.5°C accuracy guarantee-able (at +25°C)
  • Rated for full -55° to +150°C range
  • Operates from 4 to 30 volts.

 

PSoC 3 kit

In PSoC 3, LM35 Temp sensor connected at P0.1.

 

 

Temp Sensor

CY8C3866A lines

Temperature Sensor

LM35

Temp

Output

P0.1

 



Buzzer

A small piezoelectric buzzer on the PSoC 3 kit, by pulling pin P0.7 low, current will flow through the buzzer and a relatively sharp, single-tone frequency will be heard.

The buzzer can be disconnected by removing jumper JP1, and this is also the default position for this jumper since the buzzer sound can be quite annoying if always left on.

 

Buzzer

Buzzer

CY8C3866 Lines

Buzzer Selection

 

LS1

Buzzer Input

P0.7

 



Traffic Light Controller

Traffic light controller section consists of 12 Nos. point leds are arranged by 4Lanes. Each lane has Go(Green), Listen(Yellow) and Stop(Red) LED is being placed. Each LED has provided for current limiting resistor to limit the current flows to the LEDs.

 

LAN Direction

CY8C3866A lines

LED’s

Traffic Light Controller

NORTH

P2.1

D10-Stop

 

P2.2

D9-Listen

P2.3

D8-Go

WEST

P1.5

D12-Stop

P1.4

D5-Listen

P2.0

D11-Go

SOUTH

P6.2

D13-Stop

P1.7

D7-Listen

P1.6

D6-Go

EAST

P6.3

D14-Stop

P6.5

D16-Listen

P6.4

D15-Go

Note : Make SW22 to “Traffic” label marking position

 



Interrupts

Features

 

  • Defines hardware-triggered interrupts
  • Provides a software method to pend interrupts

 

General Description

The Interrupt component defines hardware triggered interrupts. It is an integral part of the Interrupt Design-Wide Resource system (see PSoC Creator Help, Design-Wide Resources section).

There are three types of system interrupt waveforms that can be processed by the interrupt controller:

Level – IRQ source is sticky and remains active until firmware clears the source of the request with an action (for example, clear on read). Most fixed-function peripherals have level-sensitive interrupts, including the UDB FIFOs and status registers.

Pulse – Ideally, a pulse IRQ is a single bus clock, which logs a pending action and ensures that the ISR action is only executed once. No firmware action to the peripheral is required.

Edge – An arbitrary synchronous waveform is the input to an edge-detect circuit and the positive edge of that waveform becomes a synchronous one-cycle pulse (Pulse mode).

Note: These interrupt waveform types are different from the settings made in the Configure dialog for the InterruptType parameter. The parameter only configures the multiplexer select lines. It processes the “IRQ” signal to be sent to the interrupt controller based on the multiplexer selection (Level, Edge).

PSoC 3 kit

In PSoC 3 kit, two external interrupts lines are terminated at (EXINT1-P15.4) and (EXINT2-P15.5).

 

 

Interrupts

CY8C3866A lines

Interrupts

Tactile Switch

 

 

 

 

DS1307

SW3 – (INT0)

P15.4

SW4 – (INT1)

P15.5

 



BOARD LAYOUT





EXAMPLE PROGRAMS ON CYPRESS PSoC 3 kit

Blinking LED

Project Description:

This example code show the indication of LED On/Off. By driving a High logic to output port pin illuminate an LED. Driving High and Low logic with delay LED turns On and Off alternatively.

Hardware Connections:

 

HARDWARE PIN OUT

CONNECTIONS

OUTPUT

LED1

P0.0

Place a Jumper J15 to Enable Led

LED’s will be Turned ON and OFF at 1000ms interval.

LED2

P0.1

LED3

P0.2

LED4

P0.3

LED5

P0.4

LED6

P0.5

LED7

P0.6

LED8

P0.7

 



Source Code:

Blinking An LED on PSoC 3 kit

#include 

void main()

{

/* Place your initialization/startup code here (e.g. MyInst_Start()) */ /* CyGlobalIntEnable;

*/ /* Uncomment this line to enable global interrupts.

*/ for(;;)

{

/* Place your application code here.

*/ LED_Write(0xFF); CyDelay(1000);

LED_Write(0x00); CyDelay(1000);

}

}

/* [] END OF FILE */

Verfiy Output:

The Led Will On and Off alternatively.

Switch and Led

Project Description:

This example code show the indication of LED according to SWITCH state. By Reading a switch state from port 3 and writing the corresponding value to port 0 illuminates an LED.

Hardware Connections:

 

HARDWARE PIN OUT

CONNECTIONS

OUTPUT

LED1

P0.0

Place a Jumper J15 to Enable Led

LED’s will be Turned ON according to switch state.

LED2

P0.1

LED3

P0.2

LED4

P0.3

LED5

P0.4

LED6

P0.5

LED7

P0.6

LED8

P0.7

SW1

P3.0

 

SW2

P3.1

SW3

P3.2

SW4

P3.3

SW5

P3.4

SW6

P3.5

SW7

P3.6

SW8

P3.7

 



Source Code:

Switch and Led on PSoC 3 kit

#include 

void main()

{

uint8 a0; /* Place your initialization/startup code here (e.g. MyInst_Start()) */ /* CyGlobalIntEnable;

*/ /* Uncomment this line to enable global interrupts. */ for(;;)

{

/* Place your application code here.

*/ a0 = SW_Read();

LED_Write(a0);

}

}

/* [] END OF FILE */

Verfiy Output:

The Led Will On or Off according to switch state.

Buzzer

Project Description:

This example code to power up the buzzer using gpio line. By driving a High logic to output port pin buzzer will sound. Driving High and Low logic with delay buzzer will On and Off alternatively.

Hardware Connections:

 

HARDWARE PIN OUT

CONNECTIONS

OUTPUT

BUZZER

P0.7

Place a Jumper J16 to Enable Buzzer

Buzzer will be Turned ON and OFF at 1000ms interval.

 



Source Code:

Buzzer on PSoC 3 kit

#include <device.h> void main() { /* Place your initialization/startup code here (e.g. MyInst_Start()) */ /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */ for(;;) { BUZZER_Write(1); CyDelay(1000); BUZZER_Write(0); CyDelay(1000); /* Place your application code here. */ } } /* [] END OF FILE */

Verfiy Output:

The Buzzer Will On and Off alternatively.

Relay

Project Description:

This example code to power up the Relay using gpio line. By driving a High logic to output port pin relay will on. Driving High and Low logic with delay relay will On and Off alternatively.

Hardware Connections:

 

HARDWARE PIN OUT

CONNECTIONS

OUTPUT

Relay1

P0.4

Place a Jumper JP1 to use internal voltage & Make SW29 to on SM/RL

Relay will be Turned ON and OFF at 1000ms interval.

Relay2

P0.5

 



Source Code:

Relay on PSoC 3 kit

#include <device.h> void main() { /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */ for(;;) { RELAY1_Write(1); CyDelay(1000); RELAY1_Write(0); CyDelay(1000); RELAY2_Write(1); CyDelay(1000); RELAY2_Write(0); CyDelay(1000); } } /* [] END OF FILE */

Verfiy Output:

The Relay1 and Relay2 Will On and Off alternatively.

Seven Segment

Project Description:

This example code shows the segment output from 0 to 9. By driving a corresponding hex code to output Port4 pin with selection line for each segment.

Hardware Connections:

 

HARDWARE PIN OUT

CONNECTIONS

OUTPUT

A

P4.0

Make switch SW29 to ‘7SEG’ on position

It displays From 0 to 9 in all Segment

B

P4.1

C

P4.2

D

P4.3

E

P4.4

F

P4.5

G

P4.6

DP

P4.7

SEG1

P6.0

SEG2

P6.1

SEG3

P6.2

SEG4

P6.3

 



Source Code:

Seven Segment on PSoC 3 kit

#include <device.h> void main() { uint8 a[10] = {192,249,164,176,153,146,130,248,128,144}; uint8 i=0,k=0,data1=192; /* Place your initialization/startup code here (e.g. MyInst_Start()) */ /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */ S1_Write(1); S2_Write(1); S3_Write(1); S4_Write(1); for(;;) { for(i=0;i<10;i++) { SEGMENT_Write(a[i]); CyDelay(1000); /* Place your application code here. */ } } } /* [] END OF FILE */

Verfiy Output:

The Segments will display from 0 to 9 continuously.

LCD

Project Description:

This example code shows the string on LCD.

Hardware Connections:

 

HARDWARE PIN OUT

CONNECTIONS

OUTPUT

RS

P2.5

Make switch SW29 to ‘LCD’ on position

It displays a string

RW

P2.6

E

P2.4

D0-D3

NC

D4

P2.0

D5

P2.1

D6

P2.2

D7

P2.3

 



Source Code:

LCD on PSoC 3 kit

#include <device.h> void main() { LCD_Char_Start(); /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */ LCD_Char_Position(0,0); LCD_Char_PrintString("LCD Interfacing"); LCD_Char_Position(1,0); LCD_Char_PrintString("Pantech Solution"); for(;;) { /* Place your application code here. */ } } /* [] END OF FILE */

Verfiy Output:

The Strings are displayed at LCD

ADC

Project Description:

This example code shows the converted digital value of 0 to 3.3v input through potentiometer in LCD. The analog to digital Converted value will be displayed at LCD.

Hardware Connections:

 

HARDWARE PIN OUT

CONNECTIONS

OUTPUT

R22

P0.2

Place a Jumper J10 to Enable ADC1

ADC output is displayed at LCD

R74

P0.3

Place a Jumper J21 to Enable ADC2

 



Source Code:

ADC on PSoC 3 kit

#include <device.h> void main() { uint16 output; /* Start the components */ LCD_Start(); ADC_DelSig_1_Start(); /* Start the ADC conversion */ ADC_DelSig_1_StartConvert(); /* Display the value of ADC output on LCD */ LCD_Position(0, 0); LCD_PrintString("ADC_1_Output"); for(;;) { if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_WAIT_FOR_RESULT)) { output = ADC_DelSig_1_GetResult16(); //output = (0xFF & output); if(output<256) { LCD_Position(1, 0); LCD_PrintInt8(output); CyDelay(100); } else { LCD_Position(1, 0); LCD_PrintInt8(255); CyDelay(100); } } } } /* [] END OF FILE */

Verfiy Output:

The ADC1 or ADC2 output are displayed at LCD.

Temperature Sensor LM75

Project Description:

This example code shows the converted Temperature value in LCD. The LM35 . The analog to digital Converted value will be displayed at LCD.

Hardware Connections:

 

HARDWARE PIN OUT

CONNECTIONS

OUTPUT

Q1

P0.1

Place a Jumper J22 to Enable LM35

Temperature Sensor output is displayed at LCD

 



Source Code:

Temperature Sensor on PSoC 3 kit

#include <device.h> uint8 output; void main() { LCD_Start(); ADC_DelSig_1_Start(); ADC_DelSig_1_StartConvert(); /* Start the ADC conversion */ /* Display the value of ADC output on LCD */ LCD_Position(0, 0); LCD_PrintString("Temp. in Celcius"); for(;;) { if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_WAIT_FOR_RESULT)) { output = ADC_DelSig_1_GetResult8(); output = (output/1.8); LCD_Position(1, 0); LCD_PrintInt8(output); CyDelay(100); } } }

Verfiy Output:

The Temperature Value in Degree celcious is displayed at LCD.

UART

Project Description:

This example code shows the transmitted character on Hyper terminal in pc.

Hardware Connections:

 

HARDWARE PIN OUT

CONNECTIONS

OUTPUT

RX

P4.4

Make Switch SW5 to uart on position

 

Output will be displayed in hyper terminal

TX

P4.5

RTS

P4.6

CTS

P4.7


uart-slt-for-psoc-3

Source Code:

UART on PSoC 3 kit

#include <device.h> #define LCD_NUM_COLUMNS 16 #define START_CHAR_VALUE 0x20 #define END_CHAR_VALUE 0x7E uint8 trigger = 0; void main() { uint8 ch; /* Data sent on the serial port */ uint8 count = 0; /* Initializing the count value */ uint8 pos = 0; CyGlobalIntEnable; isr_1_Start(); /* Initializing the ISR */ UART_1_Start(); /* Enabling the UART */ LCD_Char_1_Start(); /* Enabling the LCD */ for(ch = START_CHAR_VALUE; ch <= END_CHAR_VALUE; ch++) { UART_1_WriteTxData(ch); /* Sending the data */ count++; if(count % LCD_NUM_COLUMNS == 0) /* If the count value reaches the count 16 start from first location */ { pos = 0; /* resets the count value */ LCD_Char_1_WriteControl(LCD_Char_1_CLEAR_DISPLAY); /* Display will be cleared when reached count value 16 */ } LCD_Char_1_Position(0,pos++); /* LCD position to the count++ */ LCD_Char_1_PutChar(ch); /* print the value in the LCD */ LCD_Char_1_Position(1,0); LCD_Char_1_PrintInt8(count); /* prints the count in the LCD */ CyDelay(200); } for(;;) {} }

Verfiy Output:

The output is displayed at hyper terminal in pc.

DAC

Project Description:

This example code generate the square wave using dac.

Hardware Connections:


HARDWARE PIN OUT

CONNECTIONS

OUTPUT

TP7

P0.7

-

Square wave at TP7

 


Source Code:

DAC on PSoC 3 kit

#include <device.h> void main() { /* Start the LCD component and clear */ LCD_Char_1_Start(); LCD_Char_1_ClearDisplay(); /* Start VDAC */ VDAC8_1_Start(); /* Set the value 200 in VDAC data register */ VDAC8_1_SetRange(VDAC8_1_RANGE_4V); VDAC8_1_SetValue(200); LCD_Char_1_Position(0,0); LCD_Char_1_PrintString("VDAC DEMO"); for(;;) { VDAC8_1_SetValue(0xFF); CyDelay(1000); //1000 = 1000ms VDAC8_1_SetValue(0x00); CyDelay(1000); } } /* [] END OF FILE */

Verfiy Output:

The Square wave is Generated at TP7(P0.7).

Interrupt

Project Description:

This example code shows the functionality of interrupt. When interrupt occurs execute the interrupt isr code.

Hardware Connections:


HARDWARE PIN OUT

CONNECTIONS

OUTPUT

INT0

P15.4

-

Buzzer is on when interrupt occur

INT1

P15.5

 


Source Code:

Interrupt on PSoC 3 kit

#include <device.h> void int0(); void main() { uint8 a; INT0_Write(0xFF); for(;;) { a = INT0_Read(); if(a==1) { LED_Write(0xFF); } else { int0(); } } } void int0() { LED_Write(0x00); BUZZER_Write(1); CyDelay(1000); BUZZER_Write(0); } /* [] END OF FILE */

Verfiy Output:

The led output is diplayed normally, when interrupt occurs buzzer will on.

Traffic Light Control

Project Description:

This example code shows to control the four way road traffice signal. With certain delay automatically signal will run.

Hardware Connections:


HARDWARE PIN OUT

CONNECTIONS

OUTPUT

P2.1

D10-Stop

Make switch sw22 to on Traffic

Four way Traffic signal will glow

P2.2

D9-Listen

P2.3

D8-Go

P1.5

D12-Stop

P1.4

D5-Listen

P2.0

D11-Go

P6.2

D13-Stop

P1.7

D7-Listen

P1.6

D6-Go

P6.3

D14-Stop

P6.5

D16-Listen

P6.4

D15-Go

 


Source Code:

Traffic Signal Control on PSoC 3 kit

#include <device.h> void main() { /* Place your initialization/startup code here (e.g. MyInst_Start()) */ /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */ for(;;) { // LEDX_0 - RED LEDX_1 - YELLOW LEDX_2 - GREEN LEDA_0_Write(0); LEDA_1_Write(0); LEDA_2_Write(1); LEDB_0_Write(1); LEDB_1_Write(0); LEDB_2_Write(0); LEDC_0_Write(1); LEDC_1_Write(0); LEDC_2_Write(0); LEDD_0_Write(1); LEDD_1_Write(0); LEDD_2_Write(0); CyDelay(10000); LEDA_0_Write(0); LEDA_1_Write(1); LEDA_2_Write(0); CyDelay(3000); LEDA_0_Write(1); LEDA_1_Write(0); LEDA_2_Write(0); LEDB_0_Write(0); LEDB_1_Write(0); LEDB_2_Write(1); LEDC_0_Write(1); LEDC_1_Write(0); LEDC_2_Write(0); LEDD_0_Write(1); LEDD_1_Write(0); LEDD_2_Write(0); CyDelay(10000); LEDB_0_Write(0); LEDB_1_Write(1); LEDB_2_Write(0); CyDelay(3000); LEDA_0_Write(1); LEDA_1_Write(0); LEDA_2_Write(0); LEDB_0_Write(1); LEDB_1_Write(0); LEDB_2_Write(0); LEDC_0_Write(0); LEDC_1_Write(0); LEDC_2_Write(1); LEDD_0_Write(1); LEDD_1_Write(0); LEDD_2_Write(0); CyDelay(10000); LEDC_0_Write(0); LEDC_1_Write(1); LEDC_2_Write(0); CyDelay(3000); LEDA_0_Write(1); LEDA_1_Write(0); LEDA_2_Write(0); LEDB_0_Write(1); LEDB_1_Write(0); LEDB_2_Write(0); LEDC_0_Write(1); LEDC_1_Write(0); LEDC_2_Write(0); LEDD_0_Write(0); LEDD_1_Write(0); LEDD_2_Write(1); CyDelay(10000); LEDD_0_Write(0); LEDD_1_Write(1); LEDD_2_Write(0); CyDelay(3000); /* Place your application code here. */ } } /* [] END OF FILE */

Verfiy Output:

The four way traffic signal is verified with Led’s

Matrix Keypad

Project Description:

This example code show the matrix key value in LCD.

Hardware Connections:


HARDWARE PIN OUT

CONNECTIONS

OUTPUT

ROW-0

P3.0

-

Matrix key value is displayed at LCD

ROW-1

P3.1

ROW-2

P3.2

ROW-4

P3.3

COLUMN-0

P3.4

COLUMN-1

P3.5

COLUMN-2

P3.6

COLUMN-3

P3.7

 


Source Code:

Matrix Keypad on PSoC 3 kit

#include <device.h> void main() { uint8 a; LCD_Start(); LCD_Position(0,0); LCD_PrintString("Press Any Key"); for(;;) { /* Place your application code here. */ ROW_Write(0x01); a = COLUMN_Read(); if(a==0x08) { LCD_Position(1,0); LCD_WriteData('F'); } else if(a==0x04) { LCD_Position(1,0); LCD_WriteData('E'); } else if(a==0x02) { LCD_Position(1,0); LCD_WriteData('D'); } else if(a==0x01) { LCD_Position(1,0); LCD_WriteData('C'); } ROW_Write(0x02); a = COLUMN_Read(); if(a==0x08) { LCD_Position(1,0); LCD_WriteData('B'); } else if(a==0x04) { LCD_Position(1,0); LCD_WriteData('A'); } else if(a==0x02) { LCD_Position(1,0); LCD_WriteData('9'); } else if(a==0x01) { LCD_Position(1,0); LCD_WriteData('8'); } ROW_Write(0x04); a = COLUMN_Read(); if(a==0x08) { LCD_Position(1,0); LCD_WriteData('7'); } else if(a==0x04) { LCD_Position(1,0); LCD_WriteData('6'); } else if(a==0x02) { LCD_Position(1,0); LCD_WriteData('5'); } else if(a==0x01) { LCD_Position(1,0); LCD_WriteData('4'); } ROW_Write(0x08); a = COLUMN_Read(); if(a==0x08) { LCD_Position(1,0); LCD_WriteData('3'); } else if(a==0x04) { LCD_Position(1,0); LCD_WriteData('2'); } else if(a==0x02) { LCD_Position(1,0); LCD_WriteData('1'); } else if(a==0x01) { LCD_Position(1,0); LCD_WriteData('0'); } `2 } } /* [] END OF FILE */

Verfiy Output:

The Matrix key value is displayed in LCD.

RTC

Project Description:

The example code shows the Real Time and Date in LCD.

Hardware Connections:


HARDWARE PIN OUT

CONNECTIONS

OUTPUT

SCL

SCL1 - (P12.0)

-

Time and Date is displays in LCD

SDA

SDA1 - (P12.1)

 


Source Code:

RTC on PSoC 3 kit

#include <device.h> #include "utils.h" void main() { uint8 tmpVar = 0u; RTC_TIME_DATE Start; /* Fill struct with date and time */ Start.Sec = 55u; Start.Min = 59u; Start.Hour = 11u; Start.DayOfMonth = 23u; Start.Month = 12u; Start.Year = 2012u; /* Enable all interrupts */ CyGlobalIntEnable; /* Set date and time */ RTC_WriteTime(&Start); /* Set interval mask - handling of interrupt stubs of the RTC component */ RTC_WriteIntervalMask(RTC_INTERVAL_SEC_MASK | RTC_INTERVAL_MIN_MASK | RTC_INTERVAL_HOUR_MASK | RTC_INTERVAL_DAY_MASK | RTC_INTERVAL_WEEK_MASK | RTC_INTERVAL_MONTH_MASK | RTC_INTERVAL_YEAR_MASK); /* Start RTC */ RTC_Start(); /* Start LCD */ LCD_Start(); /* Prepare 0th column */ LCD_Position(0u, 0u); LCD_PrintString("RTC : : "); /* Print current time */ tmpVar = RTC_ReadSecond(); PrintDecNumber(tmpVar, 0u, 11u); tmpVar = RTC_ReadMinute(); PrintDecNumber(tmpVar, 0u, 8u); tmpVar = RTC_ReadHour(); PrintDecNumber(tmpVar, 0u, 5u); /* Prepare 1st column */ LCD_Position(1u, 0u); LCD_PrintString(" - - "); /* Get and print day of month */ tmpVar = RTC_ReadDayOfMonth(); PrintDecNumber(tmpVar, 1u, 0u); /* Get and print month */ tmpVar = RTC_ReadMonth(); PrintDecNumber(tmpVar, 1u, 3u); /* Get and print year */ tmpVar = (uint8)(RTC_ReadYear() % 100u); PrintDecNumber(tmpVar, 1u, 6u); /* Get and print day of week */ tmpVar = RTC_currentTimeDate.DayOfWeek; LCD_Position(1u, 9u); LCD_PutChar(tmpVar + 0x30u); /* Get status */ tmpVar = RTC_ReadStatus(); /* Get and print if year is leap */ if(RTC_STATUS_LY & tmpVar) { LCD_Position(1u, 11u); LCD_PutChar('L'); } else { LCD_Position(1u, 11u); LCD_PutChar(' '); } /* Get and print daytime AM/PM */ if(RTC_STATUS_AM_PM & tmpVar) { LCD_Position(0u, 14u); LCD_PrintString("PM"); } else { LCD_Position(0u, 14u); LCD_PrintString("AM"); } while(1); } /* [] END OF FILE */

Verfiy Output:

The real Time and Date is displays in LCD.

Serial EEPROM

Project Description:

This example code shows that writing EEPROM and reading EEPROM is displays in LCD.

Hardware Connections:


HARDWARE PIN OUT

CONNECTIONS

OUTPUT

SCL

SCL1 - (P12.0)

-

Output is displays in LCD

SDA

SDA1 - (P12.1)

 


Source Code:

Serial EEPROM on PSoC 3 kit

#include <device.h> #include <project.h> void main() { uint16 Index; reg8 * RegPointer; int err = 0; cystatus eraseStatus; cystatus writeStatus; uint8 TestData1[SIZEOF_EEPROM_ROW] = {1, 2, 2, 4, 5, 1, 2, 3, 4, 6, 9, 2, 5, 4, 5, 4}; /* Prepare components */ #if (CY_PSOC3 || CY_PSOC5LP) EEPROM_Start(); #endif /* (CY_PSOC3 || CY_PSOC5LP) */ CharLCD_1_Start(); eraseStatus = 0xff; writeStatus = 0xff; /* Erase all sectors. */ for(Index = 0; Index < CY_EEPROM_NUMBER_ARRAYS; Index++) { eraseStatus = EEPROM_EraseSector(Index); } /* Check that all EEPROM is zero */ RegPointer = (reg8 *)CYDEV_EE_BASE; for(Index = 0; Index < EEPROM_EEPROM_SIZE; Index++) { if(RegPointer[Index] != 0) { CharLCD_1_Position(1,0); CharLCD_1_PrintString("ERASE FAILED"); err ++; } } /* Get the die temp. */ if(CySetTemp() == CYRET_SUCCESS) { /* Write TestData1 to EEPROM row 0 */ writeStatus = EEPROM_Write(TestData1, 0); } /* Check Data */ RegPointer = (reg8 *) CYDEV_EE_BASE; for(Index = 0; Index < SIZEOF_EEPROM_ROW; Index++) { if(TestData1[Index] != RegPointer[Index]) { CharLCD_1_Position(1, 0); CharLCD_1_PrintString("WRITE FAILED"); err ++; } CharLCD_1_Position(0, 0); CharLCD_1_PrintInt8(RegPointer[Index]); CyDelay(500); } if(eraseStatus == CYRET_SUCCESS && writeStatus == CYRET_SUCCESS && err == 0) { CharLCD_1_Position(1, 0); CharLCD_1_PrintString("EEPROM TEST PASSED"); } else { CharLCD_1_Position(1, 0); CharLCD_1_PrintString("EEPROM TEST FAILED"); } for(;;) { } } /* [] END OF FILE */

Verfiy Output:

The writing and reading of EEPROM is displays the status in LCD.

CAPSENSE

Project Description:

This example code shows the Cap Sense button and slider output in LCD as well as in LED and Buzzer.

Hardware Connections:


HARDWARE PIN OUT

CONNECTIONS

OUTPUT

CSB1

P5.5

-

Displays in LCD as well as in LED & Buzzer

CSB2

P5.6

CSS1

P5.0

P5.1

P5.2

P5.3

P5.4

 


Source Code:

Cap Sense on PSoC 3 kit

#include <device.h> /* Define constants for capsense button and slider */ #define ON (1) #define OFF (0) #define NO_FINGER (0xFF) void main() { uint8 out; uint8 statusButton0 = OFF; uint8 statusButton1 = OFF; uint16 sliderPosition = NO_FINGER; uint16 lastPosition = NO_FINGER; CYGlobalIntEnable; LCD_Start(); LCD_Position(0,0); LCD_PrintString("Btn0 Btn1 Slider"); /* Start capsense and initialize baselines and enable scan */ CapSense_Start(); CapSense_InitializeAllBaselines(); CapSense_ScanEnabledWidgets(); while(1) { /* If scanning is completed update the baseline count and check if sensor is active */ if(!CapSense_IsBusy()) { /* Update baseline for all the sensors */ CapSense_UpdateEnabledBaselines(); CapSense_ScanEnabledWidgets(); /* Test if button widget is active */ statusButton0 = CapSense_CheckIsWidgetActive(CapSense_BUTTON0__BTN); statusButton1 = CapSense_CheckIsWidgetActive(CapSense_BUTTON1__BTN); sliderPosition =(uint8)CapSense_GetCentroidPos(CapSense_LINEARSLIDER0__LS); /* Display button 1 status on LCD */ LCD_Position(1,0); if( statusButton0 == ON ) { LCD_PrintString("On "); LED_Write(128); } else { LCD_PrintString("Off"); } /* Display button 1 status on LCD */ LCD_Position(1,5); if( statusButton1 == ON ) { LCD_PrintString("On "); LED_Write(128); } else { LCD_PrintString("Off"); } LCD_Position(1,10); if(sliderPosition == NO_FINGER) { LCD_PrintString("----"); LED_Write(0x00); } /* Finger detected on the slider */ else { /* If finger position on the slider is changed then update the LCD */ if(sliderPosition != lastPosition) { LCD_Position(1,10); LCD_PrintString(" "); LCD_Position(1,10); LCD_PrintNumber(sliderPosition); LCD_PutChar('%'); lastPosition = sliderPosition; out = ((1.5)*(sliderPosition)); out = out & 0x7F; LED_Write(out); } } } } } /* [] END OF FILE */

Verfiy Output:

The Cap Sense Button and Slider output is displays in LCD as well as in LED and Buzzer.

Stepper Motor

Project Description:

This example code run the stepper motor forward and reverse direction. The Direction is controlled in Switch (SW23)

Hardware Connections:


HARDWARE PIN OUT

CONNECTIONS

OUTPUT

COIL-A

P0.0

Make switch SW29 to ‘SMRL’ on position

Stepper Motor will run Forward and Reverse direction

COIL-B

P0.1

COIL-C

P0.2

COIL-D

P0.3

SW23

P3.0

ON

OFF

FORWARD DIRECTION

REVERSE DIRECTION

 


Source Code:

Stepper Motor on PSoC 3 kit

#include <device.h> void main() { uint8 i=0; STEPPER_Write(0x00); for(;;) { i=FOR_REV_Read(); if(i) // clockwise rotation { STEPPER_Write(0x08); CyDelay(25); STEPPER_Write(0x04); CyDelay(25); STEPPER_Write(0x02); CyDelay(25); STEPPER_Write(0x01); CyDelay(25); } else // anti-clockwise rotation { STEPPER_Write(0x01); CyDelay(25); STEPPER_Write(0x02); CyDelay(25); STEPPER_Write(0x04); CyDelay(25); STEPPER_Write(0x08); CyDelay(25); } /* Place your application code here. */ } } /* [] END OF FILE */

Verfiy Output:

The Stepper motor is run in forward or reverse direction depend upon the switch state.

USB

Project Description:

This example code shows that the USB is detected as Generic Device.

Hardware Connections:


HARDWARE PIN OUT

CONNECTIONS

OUTPUT

DM

P15.7

After Programmed , remove the USB cable from Programmer and Connect to the USB Section

Check system device manager

DP

P15.6

 


Source Code:

USB on PSoC 3 kit

#include <device.h> #define IN_EP (0x01u) #define OUT_EP (0x02u) #define BUF_SIZE (0x40u) uint8 buffer[BUF_SIZE]; uint8 length; void main() { /* Enable Global Interrupts */ CyGlobalIntEnable; /* Start USBFS Operation with 3V operation */ USBFS_1_Start(0u, USBFS_1_3V_OPERATION); /* Wait for Device to enumerate */ while(!USBFS_1_GetConfiguration()); USBFS_1_EnableOutEP(OUT_EP); while(1) { /* Wait for data received */ while(USBFS_1_GetEPState(OUT_EP) != USBFS_1_OUT_BUFFER_FULL); /* Read received bytes count */ length = USBFS_1_GetEPCount(OUT_EP); /* Unload the OUT buffer */ USBFS_1_ReadOutEP(OUT_EP, &buffer[0], length); /* Check for IN buffer is empty */ while(USBFS_1_GetEPState(IN_EP) != USBFS_1_IN_BUFFER_EMPTY); /* Load the IN buffer */ USBFS_1_LoadInEP(IN_EP, &buffer[0], length); } } /* [] END OF FILE */

Verfiy Output:

The USB device detects in the system device manager.