INT |
Description |
If an interrupt occurs for the specified buffer,
it will run a function. An interrupt will occur when a buffer’s style parameters allow activity within the buffer and the appropriate type of interrupt is set. Serial interfaces can trigger on a byte received, a byte transmitted and a semi-colon (command separator) received. I/O can trigger on input change. Use HIDE(Name); to disable an interrupt. Interrupts are available for counters and timers CNTMILLI...TIMER0. See relative section. |
Syntax/Parameters |
INT(Name,Buffer,Function,Priority); Name Of Interrupt Buffer to Interrupt on > RS2RXC = RS232 Receive Character > RS4RXC = RS485 Receive Character > AS1RXC = Async1 Receive Character > AS2RXC = Async2 Receive Character > SPIRXC = SPI Recieve Character > I2CRXC = I2C Receive Character > USBRXC = USB Recieve Character > DBGRXC = Debug Receive Character > TOUCHI = Touch Inactivity Timeout > ENC = Rotary Encoder 1 > ENC1 = Rotary Encoder 1 > ENC2 = Rotary Encoder 2 > K0 = IO Port K0 or K00 > .... > K30 = IO Port K30 > TIMER0 = Timer0 > .... > TIMER19 = Timer19 > CNTMILLI = CNTMILLI timer > CNTSECS = CNTSECS timer > CNTMINS = CNTMINS timer > CNTHOURS = CNTHOURS timer > CNTDAYS = CNTDAYS timer Function to call when Buffer read Priority - Optional |
Options |
Interrupts can be assigned a priority for faster processing by providing an optional parameter in the INT() command: INT(name,source,func,priority); * The default priority will be 0 which will run INT()'s as implemented until now (ie more like pending tasks). * A value greater than 0 will process the INT() as soon as the interrupt condition has occurred. Interrupts with larger values will have a higher priority and can interrupt those with a lower value. * The range of values are 0 to 15. * Only one interrupt is permitted per priority level. * As these interrupts are being processed as true interrupts some commands are not supported. The non-supported commands will return an error. These are: SHOW(page); // though ;; and SHOW(THIS_PAGE); are supported, see below. EXIT(); FPROG; FEND; * Page refreshing of the currently viewed page is allowed with ";;" or SHOW(THIS_PAGE); BUT changing to another page is not allowed from an INT() with priority greater than 0 as this could cause undesired effects. Care should be taken with refreshing a page from an INT() as this will lock out other interrupts during this time. * Interrupt routines should be kept as short as possible to avoid locking out other interrupts and the main processing. NOTE: The Buffer must be read to clear the interrupt otherwise the Function will keep getting called! HIDE/SHOW(INT) - v49.03 Pending interrupts are now processed when an interrupt entity is unhidden. Priority Interrupts - Modified Priority Scheme - v49.37 Modified functionality to always process higher priority interrupts pending rather than process multiple interrupts pending at current level. Losing Serial Interrupts with "proc" - v49.37 A new INT() processing scheme has been written which has abandoned a "counter" method and instead checks to see if there are any further "packets" waiting to be processed when the INT() command is run. The old scheme made use of a counter which was incremented in the "hardware" interrupt handler when a packet was received and then decremented when a LOAD(buf,port); was performed from the INT() function. It had been found that the counter can get out of sync with the packets being received and hence packets are left in the receive buffer when the counter has a value of zero. The new method, sets a task flag in the "hardware" interrupt handler to say a packet has been received. The INT() function then reads the packet when the LOAD(buf,port); command is used and then checks to see if there is another complete packet in the receive buffer. If there is, then the INT() function is called again, and so on, until there are no more complete packets and then the INT() is exited and normal processing resumes. Nesting of priority INT()s - v49.44 New functionality has been added to support nesting of priority INT()s, ie a priority interrupt can be interrupted by another priority interrupt with a higher priority (this is now the default behaviour). A system setup variable has been added to disable this functionality. SETUP(SYSTEM){ intNest = y | n; } // default = y; For 'y', priority INT()s can be interrupted by higher priority INT()s For 'n', priority INT()s run to completion, then the highest pending priority INT() is processed next. Real Time (Priority) Interrupts - v 49.44 This issue has been resolved. A problem was found with the operating systems' nested interrupt handler. New functionality has been implemented and tested. Nesting of priority INT()s has also been added - see TFT Improvement |
Example |
PAGE( PageName, PageStyle) { INT( SerRxInt, RS2RXC, SerRxEvent ); } FUNC( SerRxEvent ) { LOAD( Var, RS2 ); // Must read RS2 to clear interrupt LOAD( RS4, Var); //send out of RS485 interface. TEXT ( RecvTxt, Var);; //show received ASCII data on screen and Refresh } SHOW/HIDE(INT) Example INT( intRs2, RS2RXC, fncRs2Rx ); // Create RS2 receive interrupt HIDE( intRs2 ); // Hide the interrupt SHOW( intRs2 ); // Show (Enable) interrupt and process pending interrupts //If you don't want to process any pending interrupts when you show the interrupt then RESET the interrupt first INT( intTmr0, TIMER0, fncTmr0 ); // Create RS2 receive interrupt HIDE( intTmr0 ); // Hide the interrupt RESET( intTmr0 ); // Clear any pending interrupts SHOW( intTmr0 ); // Show (Enable) interrupt for future interrupts |