/// <summary> /// 채널별 I/O 입력을 읽어온다. /// </summary> /// <param name="Ch"></param> /// <returns></returns> public byte inportbdata(short Ch) { #if PROGRAM_RUNNING ushort DIVal = 0; byte Data = 0x00; ushort wRetVal; //receive the digital single on the board you choose wRetVal = PIO821.PIO821_DigitalIn((byte)0, out DIVal); if (wRetVal > 0) { MessageBox.Show("*** PIO821_DigitalIn() error ! ***"); } else { if (Ch == 0) { Data = (byte)(DIVal & 0x00ff); } else { Data = (byte)((DIVal & 0xff00) >> 8); } } return(Data); #else return((byte)0x00); #endif }
/// <summary> /// 지정 포트가 동작 되었는지 읽어 온다. /// </summary> /// <param name="Pos"></param> /// <returns></returns> public bool inportb(short Pos) { __IOData__ Value = IOCheck(Pos); #if PROGRAM_RUNNING bool Data = false; ushort DIVal = 0; ushort wRetVal; //receive the digital single on the board you choose wRetVal = PIO821.PIO821_DigitalIn((byte)0, out DIVal); if (wRetVal > 0) { MessageBox.Show("*** PIO821_DigitalIn() error ! ***"); } else { Data = false; if (((byte)~DIVal & Value.Data) == Value.Data) { Data = true; } } return(Data); #else return(false); #endif }