XK-1A Development Board Tutorial
int p a t t e r n [] = {0 b0011 ,
0 b0010 ,
0 b0011 ,
0 b0010 ,
0 b0001 ,
0 b0000 ,
0 b0001 ,
0 b 0 0 0 0 };
int m a i n ( v o i d ) {
t i m e r tmr ;
u n s i g n e d t ;
u n s i g n e d i = 0;
tmr : > t ;
w h i l e (1) {
t += F L A S H _ P E R I O D ;
tmr w h e n t i m e r a f t e r ( t ) : > v o i d ;
led <: p a t t e r n [ i ];
i = ( i +1) % 8;
}
r e t u r n 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
LEDs on your XK-1A.
4.1
Create an application
The program below inputs from one of two timers in a loop.
# i n c l u d e < xs1 . h >
# d e f i n e F L A S H _ P E R I O D 1 0 0 0 0 0 0 0
# d e f i n e C Y C L E _ P E R I O D 5 0 0 0 0 0 0 0
out p o r t led = X S 1 _ P O R T _ 4 F ;
int m a i n ( v o i d ) {
t i m e r tmrF , t m r C ;
u n s i g n e d timeF , t i m e C ;
t m r F : > t i m e F ;
t m r C : > t i m e C ;
w h i l e (1) {
X7366A