Slider Switches

The 10 Slider Switches are mapped to a single 32-bit register whose bits correspond directly to each switch. For example, bit 0 gives the value for switch 0. Bits [31:10] are not used.

DeviceSlider Switches
ConfigurationOne 32-bit register
Input/OutputInput only
Address Base0xFF200040
Address Mapbase - maps directly to the register

Assembly Example: Read switches into r3

  .equ ADDR_SLIDESWITCHES, 0xFF200040

  movia r2,ADDR_SLIDESWITCHES
  ldwio r3,0(r2)                # Read switches 

C Example: Set red LEDs with switches, invert switch #4

#define SWITCHES ((volatile long *) 0xFF200040)
#define RLEDs ((volatile long *) 0xFF000000)
int main()
{ 
   long Swval;
   unsigned long Sw4val;
   while (1)
   {
      Swval = *SWITCHES;
      Sw4val = Swval ^ 0x10;	// Invert bit 4
      *RLEDs = Swval;
   }
}