PICmicro & dsPIC >> Source Share for PICmicro & dsPIC

Neil_K

***

Reged: Mar 09 2005
Posts: 961
Loc: NY,USA
Re: J1939 Microchip C Library Bugs
      Wed Aug 29 2007 04:27 PM

Update:
Item #3 of my original post I am wrong it is correct.

There is a Bug in J1939_AddressClaimHandling(). Only if you Have 3 or more fixed addresses. The code as written will only arbitrate 1 one time. Not as many as it needs to to go through the full address list. The other Address Arbitration modes work. Note this affect the original C18 Code too.
here is my fix, but I did not test it with the other modes. So do not add it unless you need it, or test it well
Code:

SendAddressClaim:
// Send Address Claim message for CommandedAddress
CopyName();
OneMessage.Msg.SourceAddress = CommandedAddress;
SET_NETWORK_WINDOW_BITS;

SendOneMessage( (J1939_MESSAGE *) &OneMessage );

if (((CommandedAddress & 0x80) == 0) || // Addresses 0-127
((CommandedAddress & 0xF8) == 0xF8)) // Addresses 248-253 (254,255 illegal)
{
J1939_Flags.Flags.CannotClaimAddress = 0;
J1939_Address = CommandedAddress;

// Set up filter to receive messages sent to this address
SetAddressFilter( J1939_Address );
}
else
{
// We don't have a proprietary address, so we need to wait.
J1939_Address = CommandedAddress; // ADDED NSK, need this here so we know the last failed address
// if we do several address claims to find an address
J1939_Flags.Flags.WaitingForAddressClaimContention = 1;
ContentionWaitTime = 0;
}
}



Post Extras Print Post   Remind Me!     Notify Moderator


Entire topic
Subject Posted by Posted on
* J1939 Microchip C Library (modified) spikeymikey Fri Jan 06 2006 12:54 PM
. * * Re: J1939 Microchip C Library Bugs Neil_K   Thu Oct 12 2006 06:53 PM
. * * Re: J1939 Microchip C Library Bugs Neil_K   Wed Aug 29 2007 04:27 PM
. * * Re: J1939 Microchip C Library (modified) luckyAdministrator   Fri Jan 06 2006 07:47 PM
. * * Re: J1939 Microchip C Library (modified) spikeymikey   Sat Jan 14 2006 04:06 AM

Extra information
0 registered and 22 anonymous users are browsing this forum.

Moderator:  jtemples, Dan Henry, Andrew L, mikerj 



Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Thread views: 13410

Rate this thread

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5