Commande SETINT

Emile

Senior Member
Bonjour à tous,

Je suis en train de me prendre sévèrement la tete avec le principe de fonctionnement de la commande d'interruption SETINT

Je ne comprends pas l'explication du manuel :

More detailed SETINT explanation.
The SETINT must be followed by two numbers - a ‘compare with value’ (input)
and an ‘input mask’ (mask) in that order. It is normal to display these numbers in
binary format, as it makes it more clear which pins are ‘active’. In binary format
input7 is on the left and input0 is on the right.
The second number, the ‘input mask’, defines which pins are to be checked to see
if an interrupt is to be generated ...
- %00000001 will check input pin 0
- %00000010 will check input pin 1
- %01000000 will check input pin 6
- %10000000 will check input pin 7


01000000 en décimal correspond à 64 et non à 6, alors qu'ils disent " will check input pin 6 " , je devrais avoir 110 et non 01000000 ...?

Il y'a surement quelque chose que j'ai du louper.

Si quelqu'un peut m'expliquer ...

Merci !

Emile
 

Chavaquiah

Senior Member
%01000000 = 2^6 = 64

Bit no. = Pin no. = 76543210

De cette façon, on peut définir des interruptions pour plusieurs pins a la fois. Par example, pour pins 6 et 4: %01010000.

%01010000 = 80 = 2^6 + 2^4 = 64 + 16.
 

Emile

Senior Member
Une dernière question à propos de cela :

to interrupt on input0 high, input1 high and input 2 low
setint %00000011, %00000111

%00000111 2^0+2^1+2^2= 7 = 00000111 OK (input0/input1/input2 : 0 / 1 / 2

%00000011 2^1+2^1+2^0= 5 = 00000101 PROBLEM (high/high/low : 1 / 1 / 0)

Je ne comprends pas mon erreur !

Emile
 
Last edited:

Chavaquiah

Senior Member
Code:
Pin #: 7 6 5 4 3 2 1 0
       | | | | | | | |
       | | | | | | | +-- 2^0 = %00000001 =   1
       | | | | | | +---- 2^1 = %00000010 =   2
       | | | | | +------ 2^2 = %00000100 =   4
       | | | | +-------- 2^3 = %00001000 =   8
       | | | +---------- 2^4 = %00010000 =  16
       | | +------------ 2^5 = %00100000 =  32
       | +-------------- 2^6 = %01000000 =  64
       +---------------- 2^7 = %10000000 = 128

Mask = %00000111 => On va vérifier pins 2, 1 et 0

Input = %00000110 => Pins 2 et 1 doivent être "high" et pin 0 doit être "low"
 

Emile

Senior Member
Merci à toi !!

Je n'avais pas saisi que quand une entrée est à 0 c'est 0 et non 2^0


Emile.
 
Top