WiCard PCInt (+Tutorial Video)

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).
PIN | PortBit | Rising Edge Interrupt | Falling Edge Interrupt |
A01 | VCC 3.3v | ||
A02 | Ground | ||
A03 | 0 | * | * |
A04 | 1 | * | * |
A05 | 2 | * | * |
A06 | 3 | * | * |
A07 | 4 | * | * |
A08 | 5 | * | * |
A09 | 6 | * | * |
A10 | 7 | * | * |
A11 | 16 | * | * |
A12 | 17 | * | * |
A13 | 18 | * | * |
A14 | 19 | ||
A15 | 25 | ||
B01 | 24 | ||
B02 | 23 | ||
B03 | 22 | * | * |
B04 | 21 | * | * |
B05 | 20 | * | * |
B06 | 15 | * | * |
B07 | 14 | * | * |
B08 | 13 | * | * |
B09 | 12 | * | * |
B10 | 11 | * | * |
B11 | 10 | * | * |
B12 | 9 | ||
B13 | 8 | ||
B14 | Ground | ||
B15 | VCC 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.
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.