Presentation is loading. Please wait.

Presentation is loading. Please wait.

1-3 GPIO_Output(LuminaryLibrary) 1.Alter the output current to 4mA 2.Let LED0 turn on but LED 1 turn off. Modify your program in E:\yourname\arm.

Similar presentations


Presentation on theme: "1-3 GPIO_Output(LuminaryLibrary) 1.Alter the output current to 4mA 2.Let LED0 turn on but LED 1 turn off. Modify your program in E:\yourname\arm."— Presentation transcript:

1 1-3 GPIO_Output(LuminaryLibrary) 1.Alter the output current to 4mA 2.Let LED0 turn on but LED 1 turn off. Modify your program in E:\yourname\arm

2 Find function in SW-DRL-UG-6075.pdf Stellaris® Peripheral Driver Library user’s guide which is in TIUserGuide.rar

3 Page 152 12.2.2.4 GPIODirModeSet Sets the direction and mode of the specified pin(s). Prototype: Void GPIODirModeSet( unsigned long ulPort, unsigned char ucPins, unsigned long ulPinIO) Parameters: ulPort is the base address of the GPIO port ucPins is the bit-packed representation of the pin(s). ulPinIO is the pin direction and/or mode. Description: This function configures the specified pin(s) on the selected GPIO port as either input or output under software control, or it configures the pin to be under hardware control. The parameter ulPinIO is an enumerated data type that can be one of the following values: GPIO_DIR_MODE_IN GPIO_DIR_MODE_OUT GPIO_DIR_MODE_HW where GPIO_DIR_MODE_IN specifies that the pin is programmed as a software controlled input, GPIO_DIR_MODE_OUT specifies that the pin is programmed as a software controlled output, and GPIO_DIR_MODE_HW specifies that the pin is placed under hardware control. The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.

4 GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_3, GPIO_DIR_MODE_OUT); Find GPIO_PIN_2 = ? GPIO_PIN_3 =? GPIO_PIN_2 | GPIO_PIN_3= ?

5 1-4 GPIO_InputOutput

6 6 SW_1 PB6 right SW_2 PE5 press SW_3PE4 up SW_4 PF1 down SW_5PB4 left

7 connectJP3PF2 disconnctJP35 JP2PF3JP39 JP43PB6JP20,JP28 JP41PE5JP24 JP42PE4JP25 JP44PF1JP30 JP45PB4JP48 Result: push button Left or Right , Only turn on (LED0) yellow one ; push button Up or Down , Only turn on (LED1) green one ; push button press , turn on (LED1) and (LED0) both ;

8 while(1) { if (((GPIOPinRead(GPIO_PORTB_BASE,GPIO_PIN_6)>>2) & GPIOPinRead(GPIO_PORTB_BASE,GPIO_PIN_4))==0) Why will we know whether PB6 or PB4 is pushed down by this sentence ?

9 Modify 1-4 to 1. After pushing button Up or Down and green LED being turned on, Key press is locked, which means even pushing button press , (LED1) and (LED0) are still off. 2.After pushing button Right or Left and yellow LED being turned on, Key press is unlocked, which means pushing button press , (LED1) and (LED0) are turned on both.


Download ppt "1-3 GPIO_Output(LuminaryLibrary) 1.Alter the output current to 4mA 2.Let LED0 turn on but LED 1 turn off. Modify your program in E:\yourname\arm."

Similar presentations


Ads by Google