|
OK, it looks like your setup is using binary data and a simple protocol with some checksum. I've done lots of those in the past. Most of the time, the problem is with the checksum. In order to help you, I need as much information as possible, such as:
1. what is the function of your peripheral? what kind of device is it? does it have its own user interface? any display? any LEDs?
2. what is the status of your peripheral? is it an existing commercial product? who is manufacturing it? what would be its ordering code? does it show on any website? or is it (a prototype of) your own development? or someone else's ongoing development?
3. is the programming or communication with it documented? is such document publicly available? can you provide a link to it? if not, can you copy:
- the list of supported commands;
- several published examples of commands/responses;
- detailed explanation on the checksum.
4. are you capable of sending it some command that actually causes something to happen at the peripheral side? e.g. power down? beep? blink a LED? ...
5. are you capable of sending it some command that actually results in something being sent back to your PC? if so, please provide several examples of what you send and what you receive (in all hex please).
6. in your original post you mentioned the command 0x25 0x52 0x02 0x01 0xDE
if 0xDE is to be the LRC, I can't imagina what checksum algorithm is being used (sum or XOR would yield very different values)
7. In your latest message here you mentioned
Request „Read" : « %R NUM CMD LRC »
Request „Write": « %W NUM CMD Data LRC »
It is not clear:
- whether CMD is always one byte, or could be many bytes.
- whether NUM should or should not include LRC
- how exactly LRC should be calculated
8. You wrote
rtxtDataArea.Text = "250CUHD-4K02.10.09C22";
Where did that string come from? did you actually receive that? or was it in some document? or what?
it does not easily fit the pattern « %R NUM CMD DATA LRC »
yes 0x25 is %
and 0x0C (12.) would be NUM, the length
but CMD seems missing
and to match length 12. the data probably was: U H D - 4 K 0x02 . 0x10 . 0x09 C
and finally LRC = 0x22
or do you see another way of matching this up to the pattern?
9. in one of your posts you mentioned
Read = 0x90 & Read = 0x9F
which is a complete mystery to me
Please provide ample, accurate, reliable answers as much as you can to each of my numbered paragraphs if you want this solved any time soon...
Luc Pattyn [My Articles]
The Windows 11 "taskbar" is disgusting. It should be at the left of the screen, with real icons, with text, progress, etc. They downgraded my developer PC to a bloody iPhone.
|
|
|
|
|
Hello Luc Pattyn,
First of all, thank you very much for your attention on this topic.
Iwill try to give you information as much as I can which is following:-
1. This is not publicaly available anywhere as i found and researched about it. I am working on a project as my thesis topic.
In this one, I have a manufactured system which is having 6 keys on main keypad which is controllable by some other 4 keys. Now I need to get control of 6 keys through serial interface PC. To get this, i need to communicate the system to PC. The company gave me protocol and in this protocol mentioned that I need to connect the system and PC through serial communication and every key has command which I need to send these commands to the system which includes microcontroller LPC2132.
I mention 1 example here which is mentioned in protocol and need to follow the procedure:-
1.
Write "Key – KEY_WB" request
« %W 0x03 0x02 0xF3 LRC »
____________________________________________
Write "Key – KEY_WB" response
%W 0x02 ACK LRC
Remaining keys command I need to prepare on my own according to this.
% = Start of message
R/W = Read/Write
CMD = Command
NUM = length of message (all bytes excluding „% R/W NUM")
DATA = real data
LRC = XOR complete message
STAT = ACK (0x06) = OK
NAK (0x15) = not OK
BUSY (0x07) = in process
In case of negative answer (NACK) the request must be repeated until a positive answer
(ACK) has been received. The delay time for a new request has a minimum of 100ms.
In case of answer (BUSY) the sender has to wait until the answer (ACK) has been
received.
In every case; each request must be answered with an response. The host has to wait on
an response.
Yes, I have commands for LED as well but first I want to write the commands for above key then I think remaining work can be done.
As per protocol, I have connected both system and serial interface PC through DB9- RJ45 cable which also prepared by manufacturer of system. After this, I have uploaded firmware version through Flashmagic software tool. Now I created GUI for implementing these commands but is not working as I expect becuase of some lacking in knowledge about these specific ack response commands. Now I would like to know about the command in which I can get response with ack byte from microcontroller side.
I think I tried to give you enough information to understand the project. If still need, I can give more information. Please advise me on this for further progress.
Thanks & regards,
|
|
|
|
|
You are repeating yourself rather than providing the information I asked for; yousimply ignoredmost of my questions. I will not repeat them.
Please go back to my previous message and try to answer points 4, 5 and 6 to begin with.
Luc Pattyn [My Articles]
The Windows 11 "taskbar" is disgusting. It should be at the left of the screen, with real icons, with text, progress, etc. They downgraded my developer PC to a bloody iPhone.
|
|
|
|
|
Hello Luc pattyn,
I apologize for this mistake. The system is not opened and can not see if any LED is blinking.
Ans 5 when I send commands , I get exactly same command in receiving terminal.
Ans 6 For LRC, 0xDE is given in the protocol.
Regards,
Sanjay
|
|
|
|
|
I assume "LRC" is some kind of checksum. A checksum is meant to protect devices against damaged commands, so what they do is calculate the correct checksum, compare with the received checksum. If identical, execute command; if different, ignore command (and maybe send something indicating that). So as long as your checksums are not correct, nothing much is going to work.
Sanjay Siwach wrote: 0xDE is given in the protocol.
Huh? Can you point to or show the document that describes "the protocol".
I can only hope it is more detailed and more accurate than what you have provided so far.
Luc Pattyn [My Articles]
The Windows 11 "taskbar" is disgusting. It should be at the left of the screen, with real icons, with text, progress, etc. They downgraded my developer PC to a bloody iPhone.
|
|
|
|
|
Here is command in the protocol:-
|
|
|
|
|
Sending soon --
|
|
|
|
|
Hello,
As required, please find the following:-
5. Example
firmware “728-0030__UHD-4K 02.10.09”
0x01 = Version of FPC Firmware
Read of “VERSION” request
« % R 0x02 VERSION LRC »
0x25 0x52 0x02 0x01 0xDE
LRC = 0x25 ^ 0x52 ^0x02 ^0x01 ^ 0xAA = 0xDE
__________________________________________
Read of “VERSION” response
« %R 0x0C 0x01 UHD-4K 02.10.09 0xC2»
___________________________________________
KEY_WB 0xF3
Write “Key – KEY_WB” request
« %W 0x03 0x02 0xF3 LRC »
____________________________________________
Write “Key – KEY_WB” response
« % W 0x02 ACK LRC »
Physical requirements
Asynchronous serial interface 115200 / 8 / N /1
|
|
|
|
|
Hi,
there is one positive aspect on your last message: it tells us how the LRC is calculated, as an EXOR, biased by 0xAA. That seems reasonable. This info being copy-pasted keeps me suspicious though. I'd rather see a real document, or see a single command (ANY command) getting accepted...
there are many negative aspects: it is not really a specification, there hardly is any text; it is just two examples, the second even incomplete (no LRC value).
And then there is a major problem (which I already mentioned earlier): the version example cannot possibly be correct, I can't explain its length (NUM field) AND now its checksum also seems incorrect.
I wrote a program that takes such a string, converts it to all bytes, then checks length and checksum. I tried with the string given in the example, and with a number of variations thereof (amending the response trying to get a matching length and a matching LRC), and nothing matches. Here is what I obtained:
versionResponse (from example)
input = %R 0x0C 0x01 UHD-4K 02.10.09 0xC2
bytes = 25 52 0C 01 55 48 44 2D 34 4B 30 32 2E 31 30 2E 30 39 C2
Found error(s):
Bad NUM; got 12 while expecting 16
Bad LRC; got C2 while expecting D1
--------------------------------------------------------------------------------
versionResponse, length fixed
input = %R 0x10 0x01 UHD-4K 02.10.09 0xC2
bytes = 25 52 10 01 55 48 44 2D 34 4B 30 32 2E 31 30 2E 30 39 C2
Found error(s):
Bad LRC; got C2 while expecting CD
--------------------------------------------------------------------------------
versionResponse, length fixed+space added
input = %R 0x11 0x01 UHD-4K # 02.10.09 0xC2
bytes = 25 52 11 01 55 48 44 2D 34 4B 20 30 32 2E 31 30 2E 30 39 C2
Found error(s):
Bad LRC; got C2 while expecting EC
--------------------------------------------------------------------------------
versionResponse, hex in version numbers
input = %R 0x0C 0x01 UHD-4K 0x02.0x10.0x09 0xC2
bytes = 25 52 0C 01 55 48 44 2D 34 4B 02 2E 10 2E 09 C2
Found error(s):
Bad NUM; got 12 while expecting 13
Bad LRC; got C2 while expecting C0
--------------------------------------------------------------------------------
versionResponse, hex in version numbers, space added
input = %R 0x0C 0x01 UHD-4K # 0x02.0x10.0x09 0xC2
bytes = 25 52 0C 01 55 48 44 2D 34 4B 20 02 2E 10 2E 09 C2
Found error(s):
Bad NUM; got 12 while expecting 14
Bad LRC; got C2 while expecting E0
--------------------------------------------------------------------------------
versionResponse, hex in version numbers, periods removed
input = %R 0x0C 0x01 UHD-4K # 0x02 0x10 0x09 0xC2
bytes = 25 52 0C 01 55 48 44 2D 34 4B 20 02 10 09 C2
Found error(s):
Bad LRC; got C2 while expecting E0
NB: I am ignoring all spaces in the input string as they were present around hex bytes; however I defined the # sign to represent an actual space, so I was able to force one in the version string, but that did not help.
It is up to you now, the limited information you provided is inconsistent; there is nothing more I can do.
PS: about your statement "I receive what I transmit" (if I understood you correctly). Maybe the device echoes all commands it refuses because they are invalid, e.g. because the checksum still is not what you think it should be. There is a way to make sure: create a program that sends a command with checksum value X=0, wait 1 second, read the result; increment X and repeat until you don't get an echo. If and when that happens, you might have the correct checksum (maybe it is as simple as bias isn't 0xAA but some other constant).
Luc Pattyn [My Articles]
The Windows 11 "taskbar" is disgusting. It should be at the left of the screen, with real icons, with text, progress, etc. They downgraded my developer PC to a bloody iPhone.
|
|
|
|
|
Dear Sir,
I highly appreciate the work you did for me.
I am not expert as you are but I would like to put some point with you may agree or not.
1. There should not be any suspicion of this document as I put same material as mention in document.
2. You are talking about specification and no text, so, I think command all says that Read version request(send command- 25 52 02 01 DE) - this command we need to send and response command from microcontroller(25 52 0C 01 UHD-4k.02.10.09 C2).
This command just only to see version in the system.
3. I mentioned before that there is 6 keys on the keypad. Key_WB is one of the key. There is command given for the this key:-
Send command to microcontroller- %W 0x03 0x02 0xF3 LRC
Response command from microntroller to PC - % W 0x02 ACK LRC (this command should with ACK byte)
For LRC, LRC value is calculated only for this command , for other keys, I think I have to calculate to put in command.
I did not get the point that you are calculating the response command(%R 0x0C 0x01 UHD-4K 02.10.09 0xC2) instead of input command(0x25 0x52 0x02 0x01 0xDE). The microcontroller is predefined with these commands and when we will send these commands to microcontroller, so, microcontroller should respond as protocol.
Now my question here is that, We need response from microcontroller with ACK byte and for this purpose, how we can write programm in visual studio with c# to send command with GUI and get reposne from microcontroller.
I am sharing again important information to check.
Protocol:-
Request „Read“ :
« %R NUM CMD LRC »
Ex- 0x25 0x52 0x02 0x01 0xDE
Response „Read“:
« %R NUM CMD DATA LRC »
Ex- %R 0x0C 0x01 UHD-4K 02.10.09 0xC2
__________________________________________________________________________
Request „Write“ (Send Command to microcontroller)
« %W NUM CMD Data LRC »
Ex- %W 0x03 0x02 0xF3 LRC (Send Command to microcontroller)
Response „Write“:
« %W NUM STAT LRC »
Ex- % W 0x02 ACK LRC (Response command from microcontroller)
% = Start of message
R/W = Read/Write
CMD = Command
NUM = length of message (all bytes excluding „% R/W NUM“)
DATA = real data
LRC = XOR complete message
STAT = ACK (0x06) = OK
NAK (0x15) = not OK
BUSY (0x07) = in process
In case of negative answer (NACK) the request must be repeated until a positive answer
(ACK) has been received. The delay time for a new request has a minimum of 100ms.
In case of answer (BUSY) the sender has to wait until the answer (ACK) has been
received.
In every case; each request must be answered with an response. The host has to wait on
an response.
I think I have given enough information to understand the logic. I just need advise to write a program for serial communication with c# and get response from microcontroller with ACK byte.
Regards
|
|
|
|
|
You constructed a system with many components (computer, peripheral, cable, software) and that system fails to provide the response you expect. So something is wrong, or even: several things could be wrong.
When debugging a system, there is only one correct attitude: everything is suspect.
The right approach is: start from the facts, not opinions, impressions, gut feelings. And you did not provide many facts, the most important ones are (if I understood you correctly):
- your code receives a command instead of a response (like an echo);
- downloading the firmware was successful;
- the "documentation" is inconsistent.
You care most about one specific command. I don't, I care first about successful communications, I want to see a successful command-response sequence, no matter which command it is. Once you get a reasonable response, you have a new fact, telling you how the NUM, DATA, LRC fields really must be used; the importance of this is stressed by the inconsistency in the "documentation". The simpler the command is, the more likely it is to be accepted; and then you can study the response, as I did for the example version string which does not follow the rules of the "documentation".
I wish you good luck, and hope you will let us know how you made real progress if and when that happens.
Luc Pattyn [My Articles]
The Windows 11 "taskbar" is disgusting. It should be at the left of the screen, with real icons, with text, progress, etc. They downgraded my developer PC to a bloody iPhone.
|
|
|
|
|
I am search for easy way programmatically select step by step button. Because i am devoliping software for disabled people with ALS. And i am beginer in .NET and i need solve this problem.
Hi i am using this function for button select step by step:
<pre lang="C#">
Update_cursor_positions++;
Cursor.Position = new Point((x - 10) + 100 * Update_cursor_positions, (y + 90) + Lines_cursor_positions);
if (Update_cursor_positions >= 10)
{
Update_cursor_positions = 0;
Lines_cursor_positions += 100;
Stop_cursor_move++;
}
if (Stop_cursor_move >= 4)
{
Update_cursor_positions = 0;
Lines_cursor_positions = 0;
Stop_cursor_move = 0;
}
Is posible select button step by step like this ?
for (int i = 0; i < 5; i++)
{
Cursor.Position = PointToScreen(button[i].Location);
} Google and experience
|
|
|
|
|
Quote: Is posible select button step by step like this ?
No. The position as shown would always be the same: the last button in the collection.
I'm not at all sure what exactly you are trying to do, you need to explain in much better detail in order for us to help you.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
When the program starts.
Move the mouse cursor to the first button.
Then another button and when it ends on the last button.
Will start again.
Move the cursor every second.
|
|
|
|
|
So set up a Timer with an Interval of 1000 and handle the Tick event.
Each Tick, move the cursor.
What's the problem?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I think the closest thing you can do is using the tabstop property, and setting the desired tab order.
If you're doing a WinForms app, these are properties in the control designer. If you're doing a WPF app, the tab order is set according to the top-down appearance in the xaml.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I'm guessing that you want to create a "wizard".
Simple Wizard for WinForms
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
No, it's for ALS / MDN patients (think about how Stephen Hawking selected words / phrases on his computer with only the one "button" he could press).
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
If it was that serious, I would look into gaze tracking / interactions. And I think it depends on the subject.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
I suspect it's a school project rather than a serious application: his skill level looks to be pretty low ATM.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: MDN patients
I didn't realise users of the Mozilla Developer Network[^] were classed as "patients".
(I suspect you meant "MND", or "get me another coffee".)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
It's the last one ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Message Removed
modified 6-Jan-22 3:14am.
|
|
|
|
|
Hello,
I have a simple question I think, but do not seem to find an answer easily
I have a lisbox and a gridview. Both are connected to a database through the design editor.
visualisation works, but now I want to show only the items in the gridview which are connected to a chosen item in the listbox.
I already set the listbox to visualize a name and the value member to have the "primary key".
Now I want to show only the items in the gridview who are connected to this primary key.
Inside the design editor I can add a query like this :
SELECT pkID, ProductieVolgorde, Stuknr, Rolnr, AantalMeters, DatumTijd, Status, fkPO
FROM dbo.tblDoek1
WHERE fkPO = @What do I place here?
how do I link the chosen value member of the listbox to this fkPO in the query?
Is there somewhere a simple tutorial on how to link a database fully inside the Design editor?
thanks in advance
|
|
|
|
|
You use the SelectedIndexChanged event of the ListBox, in conjunction with the SelectedItem (as "Type") property, to sync the ListBox with the GridView (filter).
ListBox.SelectedIndexChanged Event (System.Windows.Forms) | Microsoft Docs
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|