Embedded C programming

Hi!

I was programing in C Tiva TM4C123G microcontroler, but now I am trying to learn programing Arduino Due in C with Atmel studio! And I stuck with reading from a pin. I can write to a pin bat I can't read.

Can someone ples help me !

This is my code:

//PORT REGISTERS
#define PIOB_PER (*((volatile unsigned long*) 0x400E1000))  //PORT_B  ENABLE 
#define PIOB_PDR (*((volatile unsigned long*) 0x400E1004))  //PORT_B  DISABLE 
//PORT OUTPUT REGISTERS
#define PIOB_OER (*((volatile unsigned long*) 0x400E1010))  //PORT_B  OUTPUT ENABLE 
#define PIOB_ODR (*((volatile unsigned long*) 0x400E1014))  //PORT_B  OUTPUT DISABLE 
//OUTPUT DATA REGISTER
#define PIOB_SODR (*((volatile unsigned long*) 0x400E1030)) //PORT_B  SET DATA 
#define PIOB_CODR (*((volatile unsigned long*) 0x400E1034)) //PORT_B  CLEAR DATA 
#define PIOB_ODSR (*((volatile unsigned long*) 0x400E1038)) //PORT_B DATA STATUS 
//PULL UP RESISTOR REGISTERS
#define PIOB_PUDR (*((volatile unsigned long*) 0x400E1060)) //PORT_B  PULL UP DISABLE
#define PIOB_PUER (*((volatile unsigned long*) 0x400E1064)) //PORT_B  PULL UP ENABLE
//GLITCH INPUT FILTER REGISTER
#define PIOB_IFER (*((volatile unsigned long*) 0x400E1020)) //PORT_B  GLITCH INPUT FILTER ENABLE 
#define PIOB_IFDR (*((volatile unsigned long*) 0x400E1024)) //PORT_B  GLITCH INPUT FILTER DISABLE 
//PIN DATA STATUS REGISTER
#define PIOB_PDSR (*((volatile unsigned long*) 0x400E103C)) //PORT_B  PIN DATA STATUS 
//INTERRUPT REGISTERS
#define PIOB_IDR (*((volatile unsigned long*) 0x400E1044))  //PORT_B  INTERRUPT DISABLE 
//MULTI-DRIVER REGISTER
#define PIOB_MDDR (*((volatile unsigned long*) 0x400E1054)) //PORT_B  DISABLE MULTI-DRIVE
//OUTPUT WRITE REGISTER
#define PIOB_OWDR (*((volatile unsigned long*) 0x400E10A4)) //PORT_B  PIN DATA STATUS REGISTER



#define LED_13 0x08000000   //PB27 - digital 13
#define SW_1   0x02000000  //PB25  - digital 2

#include "sam.h"


/**
 * \brief Application entry point.
 *
 * \return Unused (ANSI-C compatibility).
 */
void Init(void);

int main(void)
{
    /* Initialize the SAM system */
    SystemInit();
    Init();

    while (1) 
    {
        //TODO:: Please write your application code
        if ((PIOB_PDSR&SW_1) != 0){PIOB_SODR |= LED_13;}
        else{PIOB_CODR |= LED_13;}
    }
}

void Init(void){
//LED 13    
    PIOB_PER |= LED_13; //ENABLE PORTB PB27
    PIOB_OER |= LED_13; //SET OUTPUT PB27
//SWITCH 1  
    PIOB_PER |= SW_1;   //ENABLE PORTB PB25
    PIOB_ODR |= SW_1;   //DISABLE OUTPUT 
    //PIOB_IFER |= SW_1;    //DISABLE GLITCH FILTER INPUT PB25
    //PIOB_CODR |= SW_1;    //CLEAR OUTPUT DATA REGISTER
    //PIOB_IDR |= SW_1; //DISABLE INTERRUPTS
    //PIOB_MDDR |= SW_1;    //DISABLE MULTIDRIVE
    PIOB_PUER |= SW_1;  //ENABLE PULL UP PB25
    //PIOB_OWDR |= SW_1;    //DISABLE OUTPUT WRITE REGISTER
}

I solve the problem!

I have to start the clock for PIO in PMC_PCER0 register!

PIOA - bit 11
PIOB - bit 12
PIOC - bit 13
PIOD - bit 14