Address priority pseudocode for hobbyist
I've decided not to implement dynamic addressing per SAE J1939 -81, I don't really need it and I own the network. So A Service Configurable Single Address it is.
MSB 1 8
Byte 8 0000 010 0 (no Group, no system, no arbitrary address).
Byte 7 0 0000000 Vehicle System
Byte 6 00000000 Function
Byte 5 111 00001 ECU, Function Instance
Byte 4 11111111 Manufacturer number (msb 8)
Byte 3 00000 000 Identity + Manu Number (Lsb)
Byte2 000000000 Identity number
Byte 1 00000001 Identity number
Power up and init network objects.
Naming will be highvalues for that address.
Add Address Claim message handler to can interrupt handler.
Send Address Claim for #247 (it's a preset (A decrement button will allow this to decrement)) to Address 255 Global
250K
Byte1
Wait about 1/4 sec + 1 ms
Start messages
On can interrupt
if addressing {
If collision or bus error resend claim
if contending address and is hobbyname and my hobbyname less than contending hobby project - Send cannot claim
beep, beep, beep, and display Address claim error
Will not try (address -1 downto 129)
reset wait}
On button interrupt (address = address -1) store in flash
wait 1/4 second + 1-10 ms
Unzinced ships sink at slips. yep