TML Interrupts – Related TML Instructions and Data |
Parameters INTTABLE Pointer to the start address of the interrupt table
Instructions EINT Globally enables the TML interrupts. Sets ICR.15 = 1 DINT Globally disables the TML interrupts. Sets ICR.15 = 0
RETI Return from a TML interrupt service routine Programming Example Set TML Int10 to generate a time interrupt at each 0.5s. In the ISR, switch the status of output #25/Ready to signal that the drive/motor is in standby. Leave the other TML interrupts with their default ISR. BEGIN; // TML program start INTTABLE = InterruptTable; // set start address for the new interrupt table
ENDINIT; // end of initialization ... int Ready_status; // Define integer variable Ready_status Ready_status = 0; // initialize Ready_status TMLINTPER = 500; //Set a time interrupt at every 0.5[s] SRB ICR, 0x8FFF, 0x0400; // Set ICR.10 to enable Int10 ... END; // end of the main section
InterruptTable: // start of the interrupt table @default_int0; @default_int1; @default_int2; @default_int3; @default_int4; @default_int5; @default_int6; @default_int7; @default_int8; @default_int9; @int10; @default_int11; int10: GOTO Turn_on, Ready_status, EQ; // Branch to Turn_on if Ready_status == 0 SOUT#25; //Set Low to I/O line #25 Ready_status = 0; // set Ready_status = 0 RETI; // return from interrupt Turn_on: //Define label Turn_on ROUT#25; //Set High to I/O line #25 Ready_status = 1; // set Ready_status = 1 RETI;
See also: |