Sign in

username:

password:



Not a member?

Search c54x



Search tips

Subscribe to c54x



c54x by Keywords

5409 | 5416 | AD5 | ADC | BIOS | Boot | Booting | Bootloader | C540 | C5402 | C5409 | C5416 | CCS | Codec | DMA | Dmad | DSK | DSKPlus | Dsplib | EVM | FFT | FIR | Flash | GPIO | HPI | Initialization | Interrupt | JTAG | LOG_printf | MCBSP | RFFT | RTDX | Sampling | STLM | UART | VC540


Discussion Groups

Discussion Groups | TMS320C54x | Please help me- switch don't function

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).

  

Post a new Thread

Please help me- switch don't function - daya...@yahoo.com - Mar 5 21:14:30 2008



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



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: Please help me- switch don't function - ahma...@yahoo.com - Mar 6 7:38:35 2008

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



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )