> Hi
>
> Im currently trying to write a piece of code that will count unto 16(binary)
> on the 320C6713 dev board
>
> Could somebody please look at my (newbie) code and see if it will function
> correctly.
>
> Thank Tuurbo46
>
>
>
> #include "dsk6713.h"
>
> #include "dsk6713_led.h"
>
> #include "dsk6713_dip.h"
>
>
>
> void main()
>
> {
>
> DSK6713_init(); // Must initialise board first with this
> call
>
> DSK6713_LED_init(); // Set LED register in CPLD
>
> DSK6713_DIP_init(); // Set user switches register in CPLD
>
>
>
> while(1) //Your standard endless loop
>
> {
>
> // DSK6713_LED_toggle(0); //Change the state of LED0
>
>
>
> if (DSK6713_DIP_get(3) == 0) //Read SW3 if LO its
> pressed so turn
>
> // 0001
>
> DSK6713_LED_on(0); //on LED 0
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(0); //Turn off LED 0
>
> // 0010
>
> DSK6713_LED_on(1); //on LED 1
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(1); //Turn off LED 1
>
> // 0011
>
> DSK6713_LED_on(0); //on LED 0
>
> DSK6713_LED_on(1); //on LED 1
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(0); //Turn off LED 0
>
> DSK6713_LED_off(1); //Turn off LED 1
>
> // 0100
>
> DSK6713_LED_on(2); //on LED 2
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(2); //Turn off LED 2
>
> // 0101
>
> DSK6713_LED_on(0); //on LED 0
>
> DSK6713_LED_on(3); //on LED 3
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(0); //Turn off LED 0
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> // 0110
>
> DSK6713_LED_on(1); //on LED 1
>
> DSK6713_LED_on(2); //on LED 2
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(1); //Turn off LED 1
>
> DSK6713_LED_off(2); //Turn off LED 2
>
> // 0111
>
> DSK6713_LED_on(0); //on LED 0
>
> DSK6713_LED_on(1); //on LED 1
>
> DSK6713_LED_on(2); //on LED 2
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(0); //Turn off LED 0
>
> DSK6713_LED_off(1); //Turn off LED 1
>
> DSK6713_LED_off(2); //Turn off LED 2
>
> // 1000
>
> DSK6713_LED_on(3); //on LED 3
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> // 1001
>
> DSK6713_LED_on(0); //on LED 0
>
> DSK6713_LED_on(3); //on LED 3
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(0); //Turn off LED 0
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> // 1010
>
> DSK6713_LED_on(1); //on LED 1
>
> DSK6713_LED_on(3); //on LED 3
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(1); //Turn off LED 1
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> // 1011
>
> DSK6713_LED_on(0); //on LED 0
>
> DSK6713_LED_on(1); //on LED 1
>
> DSK6713_LED_on(3); //on LED 3
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(0); //Turn off LED 0
>
> DSK6713_LED_off(1); //Turn off LED 1
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> // 1100
>
> DSK6713_LED_on(2); //on LED 2
>
> DSK6713_LED_on(3); //on LED 3
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(2); //Turn off LED 2
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> // 1101
>
> DSK6713_LED_on(0); //on LED 0
>
> DSK6713_LED_on(2); //on LED 2
>
> DSK6713_LED_on(3); //on LED 3
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(0); //Turn off LED 0
>
> DSK6713_LED_off(2); //Turn off LED 2
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> // 1110
>
> DSK6713_LED_on(1); //on LED 1
>
> DSK6713_LED_on(2); //on LED 2
>
> DSK6713_LED_on(3); //on LED 3
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(1); //Turn off LED 1
>
> DSK6713_LED_off(2); //Turn off LED 2
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> // 1111
>
> DSK6713_LED_on(0); //on LED 0
>
> DSK6713_LED_on(1); //on LED 1
>
> DSK6713_LED_on(2); //on LED 2
>
> DSK6713_LED_on(3); //on LED 3
>
> DSK6713_waitusec(200000); //Delay for 200ms so flash
> is visible
>
> DSK6713_LED_off(0); //Turn off LED 0
>
> DSK6713_LED_off(1); //Turn off LED 1
>
> DSK6713_LED_off(2); //Turn off LED 2
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> else
>
> DSK6713_LED_off(0); //Turn off LED 0
>
> DSK6713_LED_off(1); //Turn off LED 1
>
> DSK6713_LED_off(2); //Turn off LED 2
>
> DSK6713_LED_off(3); //Turn off LED 3
>
> }
>
> }
I have a DSK6713, but I've never used those functions. The only way
I've ever used it was to create a project with a DSP/BIOS configuration
in Code Composer. That said, I don't see anything obviously wrong with
your program, though you could make it a lot shorter using some
loops... something like:
int i;
for( i = 0; i < 16; ++i )
{
int b;
for( b=0; b < 4; ++b )
{
if( i & (1<<b) )
DSK6713_LED_on( b );
else
DSK6713_LED_off( b );
}
DSK6713_waitusec( 200000 );
}
Cheers! --M
Reply by Tuurbo46●January 8, 20062006-01-08
Hi
Im currently trying to write a piece of code that will count unto 16(binary)
on the 320C6713 dev board
Could somebody please look at my (newbie) code and see if it will function
correctly.
Thank Tuurbo46
#include "dsk6713.h"
#include "dsk6713_led.h"
#include "dsk6713_dip.h"
void main()
{
DSK6713_init(); // Must initialise board first with this
call
DSK6713_LED_init(); // Set LED register in CPLD
DSK6713_DIP_init(); // Set user switches register in CPLD
while(1) //Your standard endless loop
{
// DSK6713_LED_toggle(0); //Change the state of LED0
if (DSK6713_DIP_get(3) == 0) //Read SW3 if LO its
pressed so turn
// 0001
DSK6713_LED_on(0); //on LED 0
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(0); //Turn off LED 0
// 0010
DSK6713_LED_on(1); //on LED 1
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(1); //Turn off LED 1
// 0011
DSK6713_LED_on(0); //on LED 0
DSK6713_LED_on(1); //on LED 1
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(0); //Turn off LED 0
DSK6713_LED_off(1); //Turn off LED 1
// 0100
DSK6713_LED_on(2); //on LED 2
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(2); //Turn off LED 2
// 0101
DSK6713_LED_on(0); //on LED 0
DSK6713_LED_on(3); //on LED 3
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(0); //Turn off LED 0
DSK6713_LED_off(3); //Turn off LED 3
// 0110
DSK6713_LED_on(1); //on LED 1
DSK6713_LED_on(2); //on LED 2
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(1); //Turn off LED 1
DSK6713_LED_off(2); //Turn off LED 2
// 0111
DSK6713_LED_on(0); //on LED 0
DSK6713_LED_on(1); //on LED 1
DSK6713_LED_on(2); //on LED 2
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(0); //Turn off LED 0
DSK6713_LED_off(1); //Turn off LED 1
DSK6713_LED_off(2); //Turn off LED 2
// 1000
DSK6713_LED_on(3); //on LED 3
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(3); //Turn off LED 3
// 1001
DSK6713_LED_on(0); //on LED 0
DSK6713_LED_on(3); //on LED 3
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(0); //Turn off LED 0
DSK6713_LED_off(3); //Turn off LED 3
// 1010
DSK6713_LED_on(1); //on LED 1
DSK6713_LED_on(3); //on LED 3
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(1); //Turn off LED 1
DSK6713_LED_off(3); //Turn off LED 3
// 1011
DSK6713_LED_on(0); //on LED 0
DSK6713_LED_on(1); //on LED 1
DSK6713_LED_on(3); //on LED 3
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(0); //Turn off LED 0
DSK6713_LED_off(1); //Turn off LED 1
DSK6713_LED_off(3); //Turn off LED 3
// 1100
DSK6713_LED_on(2); //on LED 2
DSK6713_LED_on(3); //on LED 3
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(2); //Turn off LED 2
DSK6713_LED_off(3); //Turn off LED 3
// 1101
DSK6713_LED_on(0); //on LED 0
DSK6713_LED_on(2); //on LED 2
DSK6713_LED_on(3); //on LED 3
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(0); //Turn off LED 0
DSK6713_LED_off(2); //Turn off LED 2
DSK6713_LED_off(3); //Turn off LED 3
// 1110
DSK6713_LED_on(1); //on LED 1
DSK6713_LED_on(2); //on LED 2
DSK6713_LED_on(3); //on LED 3
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(1); //Turn off LED 1
DSK6713_LED_off(2); //Turn off LED 2
DSK6713_LED_off(3); //Turn off LED 3
// 1111
DSK6713_LED_on(0); //on LED 0
DSK6713_LED_on(1); //on LED 1
DSK6713_LED_on(2); //on LED 2
DSK6713_LED_on(3); //on LED 3
DSK6713_waitusec(200000); //Delay for 200ms so flash
is visible
DSK6713_LED_off(0); //Turn off LED 0
DSK6713_LED_off(1); //Turn off LED 1
DSK6713_LED_off(2); //Turn off LED 2
DSK6713_LED_off(3); //Turn off LED 3
else
DSK6713_LED_off(0); //Turn off LED 0
DSK6713_LED_off(1); //Turn off LED 1
DSK6713_LED_off(2); //Turn off LED 2
DSK6713_LED_off(3); //Turn off LED 3
}
}