In pseudo-code you want something like this:
if( my_uid >= lower_bound ) && ( my_uid <= upper_bound ) && ( request_PDL == 12 )
{
send_DUB_response();
}
Skimming the Microchip C compiler docs it looks like a "long long unsigned int" is 64 bits, so you can let the compiler handle the multi-word math.
30 instruction cycles is fast. In a PIC18 running at 20 MHz (5 MIPs) that works out to 6 microseconds. You have to wait at least 176us to respond to an RDM Discovery Request, so that leave 170us available for the rest of the response processing, checksum verification, etc.
|