Serial Port Interrupts and Io.intenabled
|Top Previous Next|
The serial port (ser.) object uses your device's interrupt lines in three cases:
•When operating in the Wiegand mode (ser.mode= 1- PL_SER_MODE_WIEGAND).
•When operating in the clock/data mode (ser.mode= 1- PL_SER_MODE_CLOCKDATA).
Depending on the platform, the use of interrupt lines by the ser. object and the use of interrupt lines by the io. object may be either independent or interdependent.
Platforms with independent handling of ser. and io. interrupts
On such platforms, you can enable and disable the interrupt lines (through io.intnum and io.intenabled) without disturbing the operation of the serial port. For example, if a serial port on the EM1000 is running in the Wiegand mode and uses the interrupt line 0 as a W0&1in line you can enable this interrupt line in the io. object, then disable it, and the operation of the serial port won't be disturbed.
At the same time, the use of an interrupt line by the serial port does not show in the value of the io.intenabled property.
Platforms with interdependent handling of ser. and io. interrupts
On such platforms (example: TPP2W-G2) the serial port object openly uses the I/O object's interrupts. The rules:
•Whenever a serial port is enabled and configured in a way that requires the use of an interrupt line (see above), the corresponding interrupt line of the io. object will show that it is enabled (io.intenabled= 1- ENABLED).
•Disabling the serial port or configuring in a way that does not require the use of an interrupt line will disable the corresponding interrupt line (io.intenabled to 0- DISABLED).
•Attempting to disable this interrupt line (setting io.intenabled= 0- DISABLED) while this line is in use by a serial port will not work and the line will remain enabled.
This test code will show the difference
Run the following test codes on a device with dependent interrupts (EM1000) and a device with interdependent interrupts (EM2000).
Here is the debug output for the EM1000:
And now for the EM2000: