'JP Duval le 04/10/2004 ' pour tous les exemples, j'utilise un Lcd aussi j'ai besoin de temps pour afficher 'c'est pourquoi j'utilise Wait et waitms si souvent. 'for all samples I write, I use a LCD so I need time to display and ' that why I use wait or waitms so often. ' 2° programme : interruption externe INT1 et INT0 sur le M8 ' 2° sample : interrups INT0 and INT1 on M8 ' Int0 = PortD.2 'Int1 = PortD.3 ' montage: 'test setting: 'VCC-------------^^^^^^^---------portd.2 ' 10k 'VCC-------------^^^^^^^---------portd.3 ' 10K ' si PortD.2 ou PortD.3 est à mis à O le compteur correspondant s'incremente ' if PortD.2 or PortD.3 is forced to 0 the corresponding counter grows up. '--------------------------------------------- Dim J As Word , K As Word ' -------[ config ]----------------------------------- ' les config doivent être écrites sans retour à la ligne. 'config must be writen on 1 lign Config Lcdmode = Port ' config 4 bit Config Lcdpin = Pin , Db4 = Portc.3 , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0 , E = Portc.4 , Rs = Portc.5 Config Lcd = 16 * 2 Config Int0 = Rising 'could be falling, rising or low level! Config Int1 = Rising ' ------------------------------------------------------ 'nous n'utilisons pas le NOSAVE bien que cela consomme plus de mémoire, la 'récupération des registres si elle est mal faite, peut provoquer des catastophes. 'we dont use NOSAVE to avoid bad recovery of register Enable Interrupts Enable Int0 Enable Int1 On Int0 Suiteint0 On Int1 Suiteint1 Wait 1 Cls Do Waitms 100 Loop End 'end program Suiteint0: J = J + 1 Locate 1 , 1 : Lcd "int0: " ; J 'nb of int Waitms 200 Return 'one Return and Return 'another one to return on an interrupts I'm not sure it is necessary ? Suiteint1: K = K + 1 Locate 2 , 1 : Lcd "int1: " ; K 'nb of int Waitms 200 Return 'one Return and Return 'another one to return on an interrupts