how to configure gpio for dsk5416 ?

Status
Not open for further replies.

Hidayah

Newbie level 2
Joined
Jan 25, 2008
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,319
define delay of dsk5416

Hi there,

Below is my program to use gpio of dsk5416 as output pin to a stepper motor. But this program have error. I use Code Composer Studio v3.1 software to run this program. Can you help me to correct or provide me the correct the coding ? Thanks.


-------------------------------------------------------------------------------------------

#include <dsk5416.h>
#include <csl_gpio.h>
#define GPIO_PIN0 ((Uint16)(0x0001))
#define GPIO_PIN1 ((Uint16)(0x0002))
#define GPIO_PIN2 ((Uint16)(0x0004))
#define GPIO_PIN3 ((Uint16)(0x0008))
#define GPIO_OUTPUT0 ((Uint16)(0x0001))
#define GPIO_OUTPUT1 ((Uint16)(0x0002))
#define GPIO_OUTPUT2 ((Uint16)(0x0004))
#define GPIO_OUTPUT3 ((Uint16)(0x0008))
#define DELAY 0xfffff

void delay(void)
{
long i, j=0;
for(i=0;i<DELAY;i++){
j++;
}

}

void main()
{


GPIO_pinEnable(GPIO_PIN0);
GPIO_pinEnable(GPIO_PIN1);
GPIO_pinEnable(GPIO_PIN2);
GPIO_pinEnable(GPIO_PIN3);

GPIO_pinDirection(GPIO_PIN0,GPIO_OUTPUT0);
GPIO_pinDirection(GPIO_PIN1,GPIO_OUTPUT1);
GPIO_pinDirection(GPIO_PIN2,GPIO_OUTPUT2);
GPIO_pinDirection(GPIO_PIN3,GPIO_OUTPUT3);

GPIO_pinWrite(GPIO_PIN0,0);
GPIO_pinWrite(GPIO_PIN1,0);
GPIO_pinWrite(GPIO_PIN2,0);
GPIO_pinWrite(GPIO_PIN3,1);

delay();

GPIO_pinWrite(GPIO_PIN0,0);
GPIO_pinWrite(GPIO_PIN1,0);
GPIO_pinWrite(GPIO_PIN2,1);
GPIO_pinWrite(GPIO_PIN3,0);

delay();

GPIO_pinWrite(GPIO_PIN0,0);
GPIO_pinWrite(GPIO_PIN1,1);
GPIO_pinWrite(GPIO_PIN2,0);
GPIO_pinWrite(GPIO_PIN3,0);

delay();

GPIO_pinWrite(GPIO_PIN0,1);
GPIO_pinWrite(GPIO_PIN1,0);
GPIO_pinWrite(GPIO_PIN2,0);
GPIO_pinWrite(GPIO_PIN3,0);

delay();

}


------------------------------------------------------------------------------------------


Regards,
Dayah[/code]
 

i am also a newby to dsp , but i think you should use gpio handle .
i am working on it and it is working.

omid
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…