Download Print this page
XMOS XK-1A Manual
Hide thumbs Also See for XK-1A:

Advertisement

Quick Links

XK-1A Development Board Tutorial
IN TH I S D OCU MENT
Introduction
Illuminate an LED
Flash an LED
Flash and cycle LEDs at different rates
Run tasks concurrently
What to read next
1 Introduction
The XK-1A is a low-cost development board based on the XMOS XS1-L1 device. It
includes a single L1, four LEDs, two press-buttons, SPI flash memory, two 16-way
IDC connectors and an XSYS debugging interface.
This tutorial shows you how to write some simple XC programs that control and
respond to the XK-1A board components. In this tutorial you learn how to:
illuminate the LEDs
flash the LEDs at a fixed rate
flash the LEDs in sequence
respond to a button press
connect multiple boards together
2 Illuminate an LED
This part of the tutorial shows you how to illuminate an LED on your XK-1A, using
an XC port and an output statement.
2.1 Create a project
2.2 Add the application code
The program below illuminates an LED on an XK-1A.
# include < xs1 .h >
out port led = XS1_PORT_4F ;
Publication Date: 2012/11/8
XMOS © 2012, All Rights Reserved
Document Number: X7366A

Advertisement

loading
Need help?

Need help?

Do you have a question about the XK-1A and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for XMOS XK-1A

  • Page 1 2 Illuminate an LED This part of the tutorial shows you how to illuminate an LED on your XK-1A, using an XC port and an output statement. 2.1 Create a project 2.2 Add the application code...
  • Page 2 Take a look at the code in the editor. The declaration out port led = XS1_PORT_4F; declares an output port named led , which refers to the 4-bit port 4F. On the XK-1A, the I/O pins of port 4F are connected to the LEDs labeled LED0, LED1, LED2 and LED3.
  • Page 3 XK-1A Development Board Tutorial 3/20 XC input and output statements make it easy to express I/O operations on ports. The statement led <: 0b0001; causes the value specified to the right of <: to be output to the port specified to its left ( led ).
  • Page 4 7. In Device options, in Run on, select the option hardware, and in Target, ensure that the option “XMOS XTAG-2 connected to L1[0]” is selected. If your hardware is not displayed, ensure that your XK-1A is connected to your PC, and then click Refresh list.
  • Page 5 XK-1A Development Board Tutorial 5/20 3. On your XK-1A, verify that all four LEDs are illuminated, and then click the Terminate button () to stop your application running. 3 Flash an LED This part of the tutorial shows you how to flash an LED at a fixed rate, using an XC timer and an input statement.
  • Page 6 “XMOS XTAG-2 connected to None”. 9. Click Run to save your configuration and run it. The XDE loads the binary onto your XK-1A, displaying its progress in the Console. When the binary is loaded, the Console is cleared.
  • Page 7 6. To build and run, just click the Run button. The XDE launches the Run Configuration you most recently selected. 7. On your XK-1A, verify that LED0 is flashing on-off at half the rate it was flashing previously, and then click the Terminate button () to stop your application running.
  • Page 8 0; 2. Run your application. 3. On your XK-1A, verify that the two LEDs are flashing at different speeds, and then click the Terminate button () to stop your application running. 4 Flash and cycle LEDs at different rates This part of the tutorial shows you how to flash an LED while cycling it along the...
  • Page 9 XK-1A Development Board Tutorial 9/20 select { case tmrF when timerafter ( timeF ) : > void : /* add code to respond to timeout */ break ; case tmrC when timerafter ( timeC ) : > void : /* add code to respond to timeout */ break ;...
  • Page 10 8. In C/C++ Application, click Search Project to open the Program Selection dialog, select your application binary, and then click OK. 9. In Device options, in Run on, select the option hardware, and in Target, ensure that the option “XMOS XTAG-2 connected to L1[0]” is selected. X7366A...
  • Page 11 The XDE loads the application binary onto your XK-1A, displaying its progress in the Console. When the binary is loaded, the Console is cleared. 11. On your XK-1A, verify that a flashing LED is cycled between the four LEDs, and then click the Terminate button () to stop your project running.
  • Page 12 XK-1A Development Board Tutorial 12/20 Follow these steps: 2. At the top of your source file, include the header file stdio.h . 3. Define an input port named but1 and initialize it with the value XS1_PORT_1K . 4. In the select statement, add the following case statement: case but1 when pinseq(0) :>...
  • Page 13: Create A Project

    “released” to be displayed and the flashing LED should continue cycling. Note that you may need to push the button down firmly on your XK-1A to operate it. 8. In the Console, click the Terminate button () to stop your application running.
  • Page 14 To complete this part of the tutorial, perform the following tasks: 1. Build your project, create a new Run Configuration, and run it. 2. Verify that a flashing LED cycles between the four LEDs on your XK-1A. Pressing and holding button BUT1 should cause the message “pressed” be displayed in the Console and the LEDs should continue to flash.
  • Page 15 XK-1A Development Board Tutorial 15/20 5.3 Communicate between threads A channel provides a synchronous, bidirectional link between two threads. It consists of two channel ends, which two threads can use to interact on demand using the XC input and output statements.
  • Page 16 XK-1A Development Board Tutorial 16/20 After the button is released, output a value 0 to this channel. 3. In the function flashLEDs4bitPort : Add a parameter declaration chanend c . Add a variable declaration unsigned direction and initialize to 0.
  • Page 17 A flashing LED should cycle between the four LEDs on one of the XK-1As. 5. On your XK-1A, verify that pressing and releasing button BUT1 causes the flashing LED to change direction, and then click the Terminate button () to stop your project running.
  • Page 18 : xsi = " http :// www . w3 . org /2001/ XMLSchema - instance " xsi : schema Locati on = " http :// www . xmos . com http :// www . xmos . com " >...
  • Page 19 XK-1A Development Board Tutorial 19/20 </ Package > </ Packages > < Links > < Link Encoding = " 2 wire " Delays = " 4 ,4 " > < LinkEndpoint NodeId = " Master " Link = " X0LD " / >...
  • Page 20: What To Read Next

    Copyright © 2012, All Rights Reserved. Xmos Ltd. is the owner or licensee of this design, code, or Information (collectively, the “Information”) and is providing it to you “AS IS” with no warranty of any kind, express or implied and shall have no liability in relation to its use.

This manual is also suitable for:

Xk-1a-brd