Switch & LED using TMS320C6745 DSP

Post on 16-Jul-2015

803 views 12 download

Tags:

transcript

LED & Switch Interfaceusing TMS320C6745

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

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.

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

Led Connection to C6745

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

GPIO Registers

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

GPIO Address

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

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

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

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;

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

DIP SWITCH INTERFACE

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

GPIO Input Data Registers (IN_DATAn)

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--;

}

}

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

?

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