# [Updated]How to select the values to move in assembler?

I'm trying to make the led blinks on the tm4c1294ncpdt, so the basic idea its to make 2 routines , one to select the GPIO port (in this case the F) and other to keep up on and off.

the setup routine is the next code

PIO_Init
LDR R1,=0x400FE608
LDR R0,[R1]
ORR R0,R0,#0x20
STR RO,[R1]

LDR R1,=0x4005D400
MOV R0,#0x
   STR R0,[R1]

LDR R1,=0x4005D51C
MOV R0,#0x
STR R0,[R1]

BX LR

SWITCH_ON
LDR R1,=0x4005D000
MOV R0,#0x
STR R0,[R1]
BX LR

The idea its to select the PORTF using the base address and the offset (0x400F.E000+0x608), store it in the R0 and later orr it with 0x20 value.
Now these 0x20 is calculated this way, from the datasheet and the RCGCGPIO definition I'm using the F (6th) port so is this one

so this would be 0b 0010 0000 = 0x 20,

In the next part using the 0x4005D400/(GPIODIR) to configure the pin as output
this would be also the

0b 0010 0000 = 0x20

But this seems to do nothing and besides I remember to see in class that in similar GPIODIR configurations the number used was 0x02 (so I taked as a bad written number since I was using 0x20).

I don't know which one is right.

LDR R1,=0x4005D400
MOV R0,#0x20
STR R0,[R1]

or

LDR R1,=0x4005D400
MOV R0,#0x02
STR R0,[R1]

how must be calculated these values in the MOV instruction?

UPDATE from the gpio.h in the SW-TM4C-2.1.4.178.exe, under the section "Values that can be passed to GPIOIntEnable() and GPIOIntDisable() functions" // in the ui32IntFlags parameter.

I have found that

#define GPIO_INT_PIN_0          0x00000001
#define GPIO_INT_PIN_1          0x00000002
#define GPIO_INT_PIN_2          0x00000004
#define GPIO_INT_PIN_3          0x00000008
#define GPIO_INT_PIN_4          0x00000010
#define GPIO_INT_PIN_5          0x00000020
#define GPIO_INT_PIN_6          0x00000040
#define GPIO_INT_PIN_7          0x00000080
#define GPIO_INT_DMA            0x00000100

so the 0x00000002 is used and at the end the right version is

LDR R1,=0x4005D400
MOV R0,#0x02
STR R0,[R1]

As pointed by Ellio Anderson enabling the clock, selecting and using the port are different things.

And the right version of the code is

PIO_Init
LDR R1,=0x400FE608
LDR R0,[R1]
ORR R0,R0,#0x20
STR RO,[R1]

LDR R1,=0x4005D400
MOV R0,#0x02
   STR R0,[R1]

LDR R1,=0x4005D51C
MOV R0,#0x02
STR R0,[R1]

BX LR

SWITCH_ON
LDR R1,=0x4005D000
MOV R0,#0x02
STR R0,[R1]
BX LR
• Most programmers would prefer to use the manufacturers header provided for the specific chip. – Wouter van Ooijen Mar 12 at 19:08
• @WoutervanOoijen: where's the challenge in that? – TimWescott Mar 12 at 19:23
• It depends on the chip manufacturer, but all of the ones that I've used recently clearly try to keep things nicely symmetrical, so that bit 5 in the DIR register corresponds to bit 5 in the data register corresponds to bit 5 on the output. Read the data sheet. The datasheet is as close to truth as you can get until you have working hardware. – TimWescott Mar 12 at 19:24