using System; using System.Text; using System.Linq; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; using Tango.PMR.Stubs; using Tango.Stubs; const byte YES = 0x01; const byte NO = 0x00; //-------------------------------------------------------------------------------------------------------------- // ------ Request Parameters ------ const byte CODE_STRING = 0x01;//BTSR ID const byte FUNCTION_STRING = 0x38; const byte DATA_STRING = 0x03;//57600 //const byte DATA_STRING = 0x04;//115200 const Int32 Auto_Calc_CheckSum = YES;//1 YES, 0 NO //if YES Don't send the checksum Bytes!!!! // ------ Response Parameters ------ const Int32 BytesToRead = 1;//Number of the expected Bytes to read (iclude CHECK_STRING if available) const Int32 Verify_Received_CheckSum = NO;//1 YES, 0 NO --- TBD NA --- //-------------------------------------------------------------------------------------------------------------- int BTSR_Write_and_Read() { StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); stubI2CWriteBytesRequest.I2CId = 0xFEED; // - Don't Change!! BTSR FEEDR (Script identification) stubI2CWriteBytesRequest.SlaveAddress = Auto_Calc_CheckSum; UInt32 uInt32 = new UInt32(); //-------------------------------------------------------------- stubI2CWriteBytesRequest.BytesTWrite.Add(CODE_STRING);//Byte 0 to write CODE_STRING stubI2CWriteBytesRequest.BytesTWrite.Add(FUNCTION_STRING);//Byte 1 to write FUNCTION_STRING stubI2CWriteBytesRequest.BytesTWrite.Add(DATA_STRING);//Byte 2 to write stubI2CWriteBytesRequest.BytesTWrite.Add(0x00);//SPARE var response = stubManager.Run(stubI2CWriteBytesRequest); return 1; } int BTSR_Get() { StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); stubI2CReadBytesRequest.I2CId = 0xFEED; // - Don't Change!! BTSR FEEDR (Script indentify) stubI2CReadBytesRequest.SlaveAddress = Verify_Received_CheckSum; stubI2CReadBytesRequest.NumberOfBytesToRead = BytesToRead; var response1 = stubManager.Run(stubI2CReadBytesRequest); uint temph=0; for(int i=0; i 10 milli. stubManager.WriteLine("\n --- BAUDRATE SET --- \n"); BTSR_Get(); }