i want logical reason why positive response is +40 and negative response is 7F in UDS i tried some diagnostic services but getting always +40 and 7F but not getting why always it is increment by +40
In UDS the first byte of a positive response is always SID + 40 hex (SID = Service Identifier, the first byte of the request) and the first byte of a negative response is always 7F hex: simply because it is defined like this in the international standards ISO14229-1 (former ISO 15765-3). There is no further logical reason - theoretically other proprietary diagnostic protocols could use different offset values to indicate positive/negative responses: It's an arbitrary choice when designing a diagnostic protocol.
But historically using 40 hex as offset for positive responses has a long tradition in diagnostics; used i.e. in KWP2000 (ISO 14230) and OBD (SAE J1979 / ISO 15031) protocols respectively.
Using a single bit (Bit 6) to differentiate between requests and responses has certain advantages; it is trivial to distinguish between them for any application which needs to interpret the data; If Bit 6 is set the byte needs to be checked only against the constant value 7F hex to know if the response is positive or negative.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With