Hello!
I'm really new one here so sorry if I will ask some strange questions.
I have C2000 Piccolo LAUNCHXL-F28027 and 4x4 matrix keypad(like on the first attached image).
I want to connect keypad to F28027 using GPIO pins(which indicated on the second attached image) but get some issues:
- What are the numbers of these pins(because I see some strange lettering "J2" and "J6")?
- How can I access them from C code(like GPIO_setMode(myGpio, %NUMBER_OF_MY_GPIO_PIN%, GPIO_0_Mode_GeneralPurpose))?
- How can I use PIE for interrupt when some key is pressed?
If you have any very simple code it will be very useful.
Thanks!
UPD:
void main(void)
{
CPU_Handle myCpu;
PLL_Handle myPll;
WDOG_Handle myWDog;
uint32_t TempX1Count;
uint32_t TempX2Count;
// Initialize all the handles needed for this application
myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj));
myCpu = CPU_init((void *)NULL, sizeof(CPU_Obj));
myFlash = FLASH_init((void *)FLASH_BASE_ADDR, sizeof(FLASH_Obj));
myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
myPie = PIE_init((void *)PIE_BASE_ADDR, sizeof(PIE_Obj));
myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj));
myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj));
// Perform basic system initialization
WDOG_disable(myWDog);
CLK_enableAdcClock(myClk);
(*Device_cal)();
//Select the internal oscillator 1 as the clock source
CLK_setOscSrc(myClk, CLK_OscSrc_Internal);
// Setup the PLL for x10 /2 which will yield 50Mhz = 10Mhz * 10 / 2
PLL_setup(myPll, PLL_Multiplier_10, PLL_DivideSelect_ClkIn_by_2);
// Disable the PIE and all interrupts
PIE_disable(myPie);
PIE_disableAllInts(myPie);
CPU_disableGlobalInts(myCpu);
CPU_clearIntFlags(myCpu);
// If running from flash copy RAM only functions to RAM
#ifdef _FLASH
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
#endif
// Setup a debug vector table and enable the PIE
PIE_setDebugIntVectorTable(myPie);
PIE_enable(myPie);
// Register interrupt handlers in the PIE vector table
PIE_registerPieIntHandler(myPie, PIE_GroupNumber_1, PIE_SubGroupNumber_4,
(intVec_t)&xint1_isr);
PIE_registerPieIntHandler(myPie, PIE_GroupNumber_1, PIE_SubGroupNumber_5,
(intVec_t)&xint2_isr);
// Clear the counters
Xint1Count = 0; // Count XINT1 interrupts
Xint2Count = 0; // Count XINT2 interrupts
LoopCount = 0; // Count times through idle loop
// Enable XINT1 and XINT2 in the PIE: Group 1 interrupt 4 & 5
// Enable INT1 which is connected to WAKEINT
PIE_enableInt(myPie, PIE_GroupNumber_1, PIE_InterruptSource_XINT_1);
PIE_enableInt(myPie, PIE_GroupNumber_1, PIE_InterruptSource_XINT_2);
CPU_enableInt(myCpu, CPU_IntNumber_1);
// Enable Global Interrupts
CPU_enableGlobalInts(myCpu);
// GPIO2 - GPIO5 are outputs
GPIO_setLow(myGpio, GPIO_Number_2);
GPIO_setMode(myGpio, GPIO_Number_2, GPIO_2_Mode_GeneralPurpose);
GPIO_setDirection(myGpio, GPIO_Number_2, GPIO_Direction_Output);
GPIO_setLow(myGpio, GPIO_Number_3);
GPIO_setMode(myGpio, GPIO_Number_3, GPIO_3_Mode_GeneralPurpose);
GPIO_setDirection(myGpio, GPIO_Number_3, GPIO_Direction_Output);
GPIO_setLow(myGpio, GPIO_Number_4);
GPIO_setMode(myGpio, GPIO_Number_4, GPIO_4_Mode_GeneralPurpose);
GPIO_setDirection(myGpio, GPIO_Number_4, GPIO_Direction_Output);
GPIO_setLow(myGpio, GPIO_Number_5);
GPIO_setMode(myGpio, GPIO_Number_5, GPIO_5_Mode_GeneralPurpose);
GPIO_setDirection(myGpio, GPIO_Number_5, GPIO_Direction_Output);
// GPIO0 and GPIO1 are inputs
GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose);
GPIO_setDirection(myGpio, GPIO_Number_0, GPIO_Direction_Input);
GPIO_setMode(myGpio, GPIO_Number_1, GPIO_1_Mode_GeneralPurpose);
GPIO_setDirection(myGpio, GPIO_Number_1, GPIO_Direction_Input);
// GPIO0 is XINT1, GPIO1 is XINT2
GPIO_setExtInt(myGpio, GPIO_Number_0, CPU_ExtIntNumber_1);
GPIO_setExtInt(myGpio, GPIO_Number_1, CPU_ExtIntNumber_2);
// Configure XINT1
PIE_setExtIntPolarity(myPie, CPU_ExtIntNumber_1,
PIE_ExtIntPolarity_RisingEdge);
PIE_setExtIntPolarity(myPie, CPU_ExtIntNumber_2,
PIE_ExtIntPolarity_RisingEdge);
// Enable XINT1 and XINT2
PIE_enableExtInt(myPie, CPU_ExtIntNumber_1);
PIE_enableExtInt(myPie, CPU_ExtIntNumber_2);
for(;;)
{
asm(" NOP");
}
}
__interrupt void xint1_isr(void)
{
Xint1Count++;
// Acknowledge this interrupt to get more from group 1
PIE_clearInt(myPie, PIE_GroupNumber_1);
}
__interrupt void xint2_isr(void)
{
Xint2Count++;
// Acknowledge this interrupt to get more from group 1
PIE_clearInt(myPie, PIE_GroupNumber_1);
}

