WiCard PCInt (+Tutorial Video)

WiCard - Smart Programmable WiFi Controller Module

WiCard PCInt (+Tutorial Video)

wicard pcint feedback

WiCard PCInt (Pin Change Interrupt)

There are 22 lines of the pins available for the user to program. You can set 20 of these lines as logical input (GPI) and interrupt (PCInt). Also you can set 19 of them as logical output (GPIO).

PINPortBitRising Edge InterruptFalling Edge Interrupt
A01VCC 3.3v
A02Ground
A030**
A041**
A052**
A063**
A074**
A085**
A096**
A107**
A1116**
A1217**
A1318**
A1419
A1525
B0124  
B0223
B0322**
B0421**
B0520**
B0615**
B0714**
B0813**
B0912**
B1011**
B1110**
B129
B138
B14Ground
B15VCC 3.3v

 

PC Interrupt Handler function

The system will call “PCIntHandler()” function when a PC interrupt occurs. Also you should clear the PC interrupt flags at the end of this function. Otherwise the interrupt of that pin will not call this function again.

Example:

PCIntHandler()
{
    ClearPCIntRaisingFlag(0xFFFFFFFF);
    ClearPCIntFallingFlag(0xFFFFFFFF);
}

 

Setting Pin As PCInt Raising Edge

To setting pins as PC interrupt, raising edge input, there is a PCI function. The “SetPinsAsPCIntRaising(uiArg)” function has a 32bit argument. The argument determines which PortBit should be set as PCInt raising input with logical “1”. Another port bits will remain unchanged. For example to setting the A03 pin (PortBit 0) as an PCInt raising input, the argument should be “0x00000001”, which the first bit in the argument is logical “1”. Then if the pin state changes from low level to the high level voltage, The WiCard module will call the “PCIntHandler()” function.

The “uiReadPCIntRaisingFlag()” function, returns a 32bit value of the PCInt raising flag. Port bits which have set as PCInt raising and their pin had been changed to the high level voltage, will be logical “1” in the return value.

Example:

main()
{
    SetPinsAsOutput(0x1);
    SetPinsAsPCIntRaising(0x2);
}

PCIntHandler()
{
    uiPCIntFlag = uiReadPCIntRaisingFlag();

    if(uiPCIntFlag&0x2)
        SetPortLatch(0x1);

    ClearPCIntRaisingFlag(0xFFFFFFFF);
}

Setting Pin As PCInt Falling Edge

To setting pins as PC interrupt, falling edge input, there is a PCI function. The “SetPinsAsPCIntFalling(uiArg)” function has a 32bit argument. The argument determines which PortBit should be set as PCInt falling input with logical “1”. Another port bits will remain unchanged. For example to setting the A03 pin (PortBit 0) as an PCInt falling input, the argument should be “0x00000001”, which the first bit in the argument is logical “1”. Then if the pin state changes from high level to the low level voltage, The WiCard module will call the “PCIntHandler()” function.

The “uiReadPCIntFallingFlag()” function, returns a 32bit value of the PCInt falling flag. Port bits which have set as PCInt falling and their pin had been changed to the low level of voltage, will be logical “1” in the return value.

Example:

main()
{
    SetPinsAsOutput(0x1);
    SetPortLatch(0x2); //Internal Pull Up Resistor
    SetPinsAsPCIntFalling(0x2);
}

PCIntHandler()
{
    uiPCIntFlag = uiReadPCIntFallingFlag();

    if(uiPCIntFlag&0x2)
        SetPortLatch(0x1);

    ClearPCIntFallingFlag(0xFFFFFFFF);
}

Tutorial Vido:

Here’s the tutorial video of PCInt and also how to use “One Bit Feedback” of simulator:

Here’s is the schematic in the video’s circuit.

wicard pcint

 

To downloading the plans, schematics and firmware, please refer to: https://trial.wicard.net

Also to finding out another stuff about WiCard WiFi Module, please refer to our home page and blog.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

9 − nine =