コード例 #1
0
        private void Do_Interrupt_ADDR_PORT_B(uint val)
        {
            uint changes = (register[ADDR_PORT_B] ^ val) & 0xFF;
            uint enabled = register[ADDR_TRIS_B];

            // RB0/INT

            if (BinaryHelper.GetBit(changes, 0))
            {
                if (BinaryHelper.GetBit(register[ADDR_OPTION], OPTION_BIT_INTEDG) && BinaryHelper.GetBit(val, 0))                 // Rising Edge
                {
                    Interrupt.AddInterrupt(PICInterruptType.PIT_RB0INT);
                }
                else if (!BinaryHelper.GetBit(register[ADDR_OPTION], OPTION_BIT_INTEDG) && !BinaryHelper.GetBit(val, 0))                 // Falling Edge
                {
                    Interrupt.AddInterrupt(PICInterruptType.PIT_RB0INT);
                }
            }

            // PORT RB

            if ((BinaryHelper.GetBit(changes, 4) && BinaryHelper.GetBit(enabled, 4)) ||
                (BinaryHelper.GetBit(changes, 5) && BinaryHelper.GetBit(enabled, 5)) ||
                (BinaryHelper.GetBit(changes, 6) && BinaryHelper.GetBit(enabled, 6)) ||
                (BinaryHelper.GetBit(changes, 7) && BinaryHelper.GetBit(enabled, 7)))
            {
                Interrupt.AddInterrupt(PICInterruptType.PIT_PORTB);
            }
        }
コード例 #2
0
 public void DoInterrupt(PICInterruptType Type)
 {
     WakeUp();
     Interrupt.AddInterrupt(Type);
 }