User guide
84 CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev. *B
MoBL-USB Development Kit Firmware Examples
Notes:
1. IE, EIE, IP, EIP, TCON, EXIF, and EICON are all SFRs. For a description of these SFRs,
refer to the MoBL-USB Technical Reference Manual
2. Active low interrupts are falling edge triggered and active high interrupts are rising edge trig-
gered. In the example, the below register configurations are done in "extr_int.c” for setting up the
interrupts:
//INT0 and INT1
PORTACFG = 0x03; // PA0 and PA1 are pins for INT0 and INT1 respectively.
TCON |= 0x05; // INT0 and INT1 are configured as Edge triggered inter-
rupts.
The Interrupt service routines for each of these external interrupts are defined in "isr.c". These rou-
tines clear the interrupt and toggle the relevant Port pin and anyone of the LED D2-D5.
void ISR_EXTR0(void) interrupt 0
{
TCON &= 0xFD; // Clear INT0 TCON.1 Flag
// Yes . You do not need to clear this flag as it is
// cleared by hardware
IOB ^= 0x01; // Toggle pin 19-P1 header of PortB
}
The example is compiled using the Keil IDE similar to previous examples and corresponding images
for RAM (extr_intr.hex) and EEPROM (extr_intr.iic) can be generated. Both the images are located
at <Installed_directory>\<version\extr_intr. Download the images using the process outlined in sec-
tion Method to Download Firmware Image to MoBL-USB Internal RAM Memory on page 62 and
Method to Download Firmware Image to External I2C EEPROM on page 63.
8.11.1 Testing the Example
The function generator can be set to generate a square wave of known frequency(Use low fre-
quency like 100hz-1Khz).Connect the input to 20 pin header P2(19th pin) which is PA.0 for triggering
INT0 interrupt. Similarly feed the square waveform to P2(18th pin) which is PA.1.This triggers INT1
interrupt. The corresponding ISR for each of these interrupts get triggered and PORTB pins on P1
header P1-pin 19(PB.0 for INT0) and P1-pin18(PB1 for INT1) generate square wave form. The
square waveform can be observed using an oscilloscope.
8.12 Vend_ax Example
This example demonstrates the use of different vendor commands. Vendor commands are used to
accomplish unique tasks like MoBL-USB reset, RAM download, setting different frequency for I2C
interface, etc. The vendor commands are defined in vend_ax.c source file of the example. Open the
project by clicking on vend_ax.uv2.