Results 1 to 3 of 3

Thread: CAN programming help

  1. #1
    Join Date
    Aug 2005

    CAN programming help

    This is probably a long shot but I thought I'd ask anyway.

    I've been playing around with the Multiplex Engineering T16-014 OBD interface. It supports all the major protocols, CAN included. I wrote a simple Perl script to talk through the device using the ISO 9141 protocol for the standard OBD parameters.

    Now I'd like to explore the CAN functions on the adapter. I've been googling around trying to learn about CAN. While I've come across some helpful resources I still have some pretty basic questions left unanswered, so I'll just start with the first:

    Anybody understand how CAN masks and filters work? I understand the network is of the broadcast type and I imagine setting the mask and filter for a node on the network determines what messages it pulls from the bus, but how exactly are they used. Are they somehow applied to the SID/EID addresses of each CAN message?

    BTW, all the stuff I'm doing is open source (Apache license), so any help I can get will I'm sure be appreciated by others as well.
    Bala Sambandam
    2004 G35 Coupe, 6MT, nav, aero

  2. #2
    phc is offline
    Variable Bitrate phc's Avatar
    Join Date
    Aug 2003
    You can set the filters to only allow certain messages to be received. Or you can let them all in.

    I've not done CAN for vehicles, but devloped my own network. CAN messages can have an 11 bit or 29 bit identifier. I've only done 11 bit.

    The filter hardware is such that you can have either
    2 x 32 bit filters
    4 x 16 bit filters
    8 x 8 bit filters

    I've done 8 x 8 filters. The 8 bit filters only look at the first 8 bits of the identifier.

    Each filter has 2 registers you have to program, a mask register (MR or CANIDMR) and an acceptance register (AR or CANIDAR).

    Mask Register = set bit to 1 if you don't care
    Acceptance Register = match to bit you

    So if you want to receive a message 10101010 (first 8 bits of ID)

    You can set the Mask = 00000000
    And the AR = 10101010

    If you want to receive a group of messages 1010XXXX (x = dont care)

    MR = 00001111
    AR = 10100000

  3. #3
    Join Date
    Aug 2005
    Awesome! Exactly what I needed. Thanks.
    Bala Sambandam
    2004 G35 Coupe, 6MT, nav, aero

Similar Threads

  1. Programmer needs recommendation on WHAT programming lang...
    By mmdb in forum Software & Software Development
    Replies: 22
    Last Post: 10-25-2005, 06:04 PM
  2. Wanting to learn some programming, help me pick a language!
    By RS3RS in forum Software & Software Development
    Replies: 32
    Last Post: 10-15-2004, 04:38 PM
  3. C++: GUI Programming with >NET Framework
    By [iG] in forum Software & Software Development
    Replies: 3
    Last Post: 05-24-2004, 06:57 PM
  4. batch file programming LCD's
    By mosh in forum LCD/Display
    Replies: 6
    Last Post: 05-19-2002, 12:55 AM
  5. Need to start somewhere with Hardware programming
    By 168db in forum Software & Software Development
    Replies: 7
    Last Post: 01-11-2002, 08:35 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts