kanber Posted July 10 Share Posted July 10 Hi, On com monitor screen when I put Output string "\x80\x01\x02\x00\x00\x29" and press to sent button it is working. on sequence am I need to write like that; device.AmlMasasiDevice.Write(chra({0x80,0x01,0x02,0x00,0x00,0x29})) second quetion is I need to sent the string when users press and hold a button continuously. how can I do that? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted July 10 Share Posted July 10 1st question: yes. But make sure it is an actual x. It might be the forum software, but it rendered 0x80 with a different character for the x. It should be the letter x. 2nd question: do you want it to repeatedly send that string? To do something that starts on mouse button down, and stops on mouse button up, use two Actions. The first, with "Mouse Down" checked, should start a sequence using beginseq(). The second, without Mouse Down checked, should stop the sequence. The sequence should have a loop and do whatever you want to do while the mouse it held down. Quote Link to comment Share on other sites More sharing options...
kanber Posted July 11 Author Share Posted July 11 1st question; I don't understand what did you say? it is hex 0x80. 2nd question; I did like you said. I ask if there is easiest way to do it. maybe you can add new future like "Onbuttonpressed" Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted July 11 Share Posted July 11 1st: sorry, if you look in the forum post, at least on my screen the x shows up a little higher than a normal x. I think it is just the forum software thinking it is a multiplication symbol, but I want to make sure you use an actual x, the letter, when you use it for hex. Considering my post also has the raised x, I think you are just fine. 2nd: you can't really do it differently in event driven environments like Windows (and thus DAQFactory). There is an event when the mouse button goes down, and another when it goes up. There is nothing in between, so you have to implement it, and it needs to run in the background. We could, I suppose, add a background thread, but that would just replicate something that you can already do easily in DAQFactory, with less flexibility. Quote Link to comment Share on other sites More sharing options...
kanber Posted July 12 Author Share Posted July 12 Hi, another issues is when I sent 6 byte on monitor TX showing 5 byte. you can see attached file. I need to sent data to device 6 byte with below format; Byte 0 ID Byte 1 command Byte 2 key state Byte 3 dummy Byte 4 dummy Byte 5 checksum and device will answer me below format; Byte 0: ID Byte 1: command Byte 2: option Byte 3: checksum ID is fixed x80. how can I catch anwser with check sum?( Xor data with 0xAA) checksum (byte 3) The checksum is formed by exclusively ordering all preceding bytes with the bit pattern 10101010 (0xAA): for(tb_Cnt = 0; tb_Cnt< (EMPFA_BUFF_LAENGE - 1); tb_Cnt++) { tb_CheckSumme ^= EmpfangsBuffer[tb_Cnt]; } Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted July 12 Share Posted July 12 Actually, the output string is 6 bytes. It is just that 0x38 is the ASCII code for the number 8. That is why it reads \x008 at the end. \x00 is the 5th byte, while 8 (ASCII) is the 6th byte. You should, in general, always have "Display all chars as ASCII codes" checked when working with binary protocols. Note also that 8 ASCII and 0x38 are the exact same thing and result in a single byte (0x38) being sent out the port. Quote Link to comment Share on other sites More sharing options...
kanber Posted August 2 Author Share Posted August 2 Hi, I have two quetions; 1- Is there any option to catch first character. we have ReadUntil command, But I need to catch if first character is like x80 then read 4 byte. 2- Can you help me calcuation checksum. there is 4 byte data. I need to calcute with first there byte with xor with xAA byte and check with 4.byte with is checksum from device. The checksum is formed by exclusively ordering all preceding bytes with the bit pattern 10101010 (0xAA):for(tb_Cnt = 0; tb_Cnt< (EMPFA_BUFF_LAENGE - 1); tb_Cnt++){ tb_CheckSumme ^= EmpfangsBuffer[tb_Cnt];} Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted August 2 Share Posted August 2 1) use read(1). Then after you can use readUntil() to read the rest, or you could read(1), then read(4). Read() will read the specified number of characters (within the timeout period) and remove them from the buffer. 2) the XOR operator in DAQFactory is #. There is no #=, so you would have to do: tb_CheckSumme = tb_CheckSumme # EmpfangsBuffer[tb_Cnt] Quote Link to comment Share on other sites More sharing options...
kanber Posted August 4 Author Share Posted August 4 Thank you for your support. I fixed two issue. But now I have problem with OnLButtonDown working on a page. But not working on popup. Quote Link to comment Share on other sites More sharing options...
kanber Posted August 11 Author Share Posted August 11 Hello, I need to with popup page. can you help me? I need a solution for that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.