15
Blinking LED Using TMS320C6745 https://www.pantechsolutions.net/products/dsp- dsc-boards/tms320c6745-tyro

Led blinking using TMS320C6745

Embed Size (px)

Citation preview

Page 1: Led blinking using TMS320C6745

Blinking LEDUsingTMS320C6745

https://www.pantechsolutions.net/products/dsp-dsc-boards/tms320c6745-tyro

Page 2: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

Features of GPIO

The GPIO peripheral consists of the following features

• Separate input/output registers

• All GPIO signals can be used as interrupt sources

• All GPIO signals can be used to generate events to the EDMA.

Page 3: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

Led Connection to C6745

Page 4: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

GPIO Registers

Page 5: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

GPIO Address

Page 6: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

GPIO Direction Registers (DIRn)

By default, all the GPIO pins are configured as inputs(bit value = 1)

1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0F 0 0 0

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1F F F F

0xF000FFFF

Page 7: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

GPIO Output Data Registers (OUT_DATAn)

0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 10 F F F

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0

0x0FFF00000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0

0x00000000

Page 8: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

STEPS FOR LED BLINKING

Declare two pointer variables for GPIO Direction register and GPIO Data Register

Set Byte Address for GPIO Direction register and GPIO Data Register

Configure GPIO as output in GPIO Direction Register

Configure Required Blinking data in GPIO Data Register

Page 9: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

Set Base Address

• gpio_dir01 = (Uint32 *)0x01E26010;• gpio_out_data01 = (Uint32 *)0x01E26014;

Configure Direction register as Output*gpio_dir01 = 0xF000FFFF;

Configure Data register as Output

*gpio_out_data01 = 0x0FFF0000;

Page 10: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

Program#define Uint32 unsigned int

void DelayMs(Uint32 Ms);

void main()

{

Uint32 *gpio_dir01,*gpio_out_data01;

gpio_dir01 = (Uint32 *)0x01E26010;

gpio_out_data01 = (Uint32 *)0x01E26014;

*gpio_dir01 = 0xF000FFFF;

while(1)

{

*gpio_out_data01 = 0x0FFF0000;

DelayMs(100);

*gpio_out_data01 = 0x00000000;

DelayMs(100);

}

}

void DelayMs(Uint32 Ms)

{

Uint32 i;

while(Ms>0)

{

for(i=0;i<300000;i++);

Ms--;

}

}

Page 11: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

DIP SWITCH INTERFACE

Page 12: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

GPIO Input Data Registers (IN_DATAn)

Page 13: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

Program#define Uint32 unsigned int

Uint32 Value,i;

void DelayMs(Uint32 Ms);

void main()

{

Uint32 *gpio_in_data01,*gpio_out_data01,*gpio_dir01;

gpio_in_data01 = (Uint32 *)0x01E26020;

gpio_dir01 = (Uint32 *)0x01E26010;

gpio_out_data01 = (Uint32 *)0x01E26014;

*gpio_dir01 = 0xF000FFFF;

while(1)

{

Value = *gpio_in_data01;

*gpio_out_data01 = Value<<16;

DelayMs(100);

}

}

void DelayMs(Uint32 Ms)

{

Uint32 i;

while(Ms>0)

{

for(i=0;i<30000;i++);

Ms--;

}

}

Page 14: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

?

Page 15: Led blinking using TMS320C6745

Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.

For more details

– www.pantechsolutions.net

– http://www.slideshare.net/pantechsolutions

– http://www.scribd.com/pantechsolutions

– http://www.youtube.com/pantechsolutions