Hello there,
Please help we with the following .
#include "S32K144.h" /* include peripheral declarations S32K144 */
#define PTD16 16
#define PTC13 13
void WDOG_disable (void){
WDOG->CNT = 0xD928C520;
WDOG->TOVAL = 0x0000FFFF;
WDOG->CS = 0x00002100;
}
int main(void){
int counter = 0;
WDOG_disable();
//Enable clocks to peripherals (Port Modules)
PCC->PCCn[PCC_PORTC_INDEX]=PCC_PCCn_CGC_MASK;
PCC->PCCn[PCC_PORTD_INDEX]=PCC_PCCn_CGC_MASK;
//Configure port C12 as GPIO input (BTN 0 [SW2] on EVB)
PTC->PDDR &= ~(1<<PTC13); /* Port C12: Data Direction= input (default) */
PORTC->PCR[13] = 0x00000110; /* Port C12: MUX = GPIO, input filter enabled */
// Configure port D0 as GPIO output (LED on EVB)
PTD->PDDR |= 1<<PTD16; /* Port D0: Data Direction= output */
PORTD->PCR[16] = 0x00000100; /* Port D0: MUX = GPIO */
for(;;) {
if (PTC->PDIR & (1<<PTC13))/* If Pad Data Input = 1 (BTN0 [SW3] pushed) */
{
PTD-> PCOR |= 1<<PTD16; /* Clear Output on port D0 (LED on) */
}
else
{ /* If BTN0 was not pushed */
PTD-> PSOR |= 1<<PTD16; /* Set Output on port D0 (LED off) */
}
counter++;
}
}
from the above code in the if ststement
if (PTC->PDIR & (1<<PTC13)) /*If Pad Data Input = 1 (BTN0 [SW3] pushed) */
the above line represesnt that the button is pushed. how can i create a if condition if button is not pushed.
if (??????????????????) /* If Pad Data Input = 0 (BTN0[SW3] not pushed) */
please help me fill up that space