
Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).
Hi,
Could someone please tell me what's wrong with my program ? There are no error for this program
but the switch doesn't work. Here is my program. Thanks.
#include <dsk5416.h>
#define GPIOCR (*(volatile unsigned int*)(0x3C))
#define GPIOCR_ADDR 0x3C
#define GPIOSR (*(volatile unsigned int*)(0x3D))
#define GPIOSR_ADDR 0x3D
void delay(void)
{
long i, j=0;
for(i=0;i<1000000;i++)
{
j++;
}
}
void main()
{
DSK5416_init();
DSK5416_LED_init();
DSK5416_DIP_init();
GPIOCR=0xff;
while(1)
{
if (DSK5416_DIP_get(1) == 1)
{
//=================================================================================
//DIP switch 1 is on & motor move
GPIOSR=0x01;
delay();
GPIOSR=0x02;
delay();
GPIOSR=0x04;
delay();
GPIOSR=0x08;
delay();
}
else if (DSK5416_DIP_get(2) == 1)
{
//=================================================================================
//DIP switch 2 is on & motor stop
GPIOSR=0x00;
}
else if (DSK5416_DIP_get(3) == 1)
{
//=================================================================================
//DIP switch 3 is on & motor move to the right
GPIOSR=0x08;
delay();
GPIOSR=0x04;
delay();
GPIOSR=0x02;
delay();
GPIOSR=0x01;
delay();
DSK5416_LED_off(3);
}
else
{
(DSK5416_DIP_get(4) == 1);
//=================================================================================
//DIP switch 4 is on & motor move to the left
GPIOSR=0x01;
delay();
GPIOSR=0x02;
delay();
GPIOSR=0x04;
delay();
GPIOSR=0x08;
delay();
DSK5416_LED_off(4);
}
}
}
Regards,
Dayah
Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution
for Commercial & Consumer End Equipment: www.ti.com/dm6467
Dear dir
It may be because of different format of else if syntax in CCS for example try on
"elsif" or other formats.
regards
Hi,
>
>Could someone please tell me what's wrong with my program ? There are no error for this
program but the switch doesn't work. Here is my program. Thanks.
>
>#include
>#define GPIOCR (*(volatile unsigned int*)(0x3C))
>#define GPIOCR_ADDR 0x3C
>#define GPIOSR (*(volatile unsigned int*)(0x3D))
>#define GPIOSR_ADDR 0x3D
>
>void delay(void)
>{
>
> long i, j=0;
> for(i=0;i
Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution
for Commercial & Consumer End Equipment: www.ti.com/dm6467