Skip to main content

A library for working with ARINC 429 data

Project description

PyArinc429

PyPI version Build Status License: MIT Python Versions Downloads

Note: The API is subject to change. Encoding is stable; decoding is available for BNR and BCD.

PRs accepted!

How to install

pip install arinc429

This lib has zero dependecies (and it will stay this way!)

How to use

Encoder

from arinc429 import Encoder 
a429 = Encoder()
det= {
        "label":0o205,
        "value":100,
        "ssm": 0x03,
        "sdi":0,
        "encoding":"BNR"
        }
a429.encode(**det)
word = a429.word # uint32_t word
bin_vals = a429.bword # binary word
# Multiple words
a429 = Encoder()
w1= {
        "label":0o205,
        "value":100,
        "ssm": 0x03,
        "sdi":0,
        "msb":29,
        "lsb":12
        "encoding":"BNR"
        }
w2= {
        "value":1, 
        "msb":11, # Bit position
        }
a429.encode(**det)
a429.add_dsc(**w2)
word = a429.word # uint32_t word

If you want to encode another label using the same encoder, you need to reset the encoder before.

from arinc429 import Encoder 
a429 = Encoder()
det= {
        "label":0o205,
        "value":100,
        "ssm": 0x03,
        "sdi":0,
        "encoding":"BNR"
        }
a429.encode(**det)
det2= {
        "label":0o206,
        "value":100,
        "ssm": 0x03,
        "sdi":0,
        "encoding":"BNR"
        }
a429.reset() # If you dont do this, it will raise an exception 
a429.encode(**det)

In case you wan to encode a DSC value into a BNR word, you can do it like this:

from arinc429 import Encoder 
a429 = Encoder()
det= {
        "label":0o205,
        "value":100,
        "ssm": 0x03,
        "sdi":0,
        "encoding":"BNR",
        "msb":28,
        }
a429.add_dsc(1,29) # Add a DSC value to the word

Same applies for BNU encoding with the add_bnu method and with BNR with the add_bnr method.

The encoder takes care so you dont shoot your foot while encoding and loosing information, it wont let you encode something into a value that is already being used.

If you were to try use a different msb in the add_dsc method, it would raise an exception as all the bits are already being used.

You can also acces the state of the word by slicing the objects:

a429[0].word # will return the words first value when the first value was encoded
a429[-1].word # will return the words last value when the last value was encoded

Container class

There is a container class that allows you to easily work with the Arinc429 words.

from arinc429 import Arinc429Word

word = Arinc429Word(
    byte1=0x00,
    byte2=0x20,
    byte3=0x00,
    byte4=0xe1
)

It accepts multiple input formats and some cool helper functions like the visualize() method that will output a string with a bit formatting of the word. Check src/common.py for more info.

Decoder

Decoder supports BNR and BCD.

from arinc429 import Decoder
a429 = Decoder()
word = a429.decode(
            b"\xa0\x01\xa4\x61",
            encoding="BNR",
            )
assert(word.label== 0o206)
assert(word.ssm== 0x01)
assert(word.sdi== 0)
assert(word.value == 105)

Roadmap

  • Encode BNR

  • Encode BCD

  • Encode DSC

  • Encode BNU

  • Raw encoding ( label + value)

  • Mixed encoding (DSC + BNR)

  • Mixed encoding (BNU+ BNR)

  • Mixed encoding (DSC + DSC)

  • Mixed encoding (DSC + BNU)

  • Mixed encoding (BNR+ BNR)

  • Encoding values with using the SDI/SSM as usable fields (Fun encodings)

  • Decode BNR

  • Decode BCD

  • Decode DSC

  • Implement in C

I dont really follow a specific roadmap; I just add features as I need them.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Docs

Docs are generated with Sphinx from docstrings and live in docs/.

Changelog

See CHANGELOG.md.

Technical Overview

This library provides comprehensive support for encoding and decoding ARINC 429 data words. ARINC 429 is a widely used avionics data bus specification that defines how avionics systems communicate in aircraft. If you want a high-level explainer, see https://www.jaimebw.com/2024-11-11-encoding-arinc429/.

Supported Encodings

The library currently supports or plans to support the following encoding formats:

  • Binary (BNR)
  • Binary Coded Decimal (BCD)
  • Discrete (DSC)
  • Binary Unsigned (BNU)
  • Hybrid formats (e.g., BNR + DSC combinations)
  • Raw encoding (custom label + value pairs)

Flexible Implementation

The library is designed to be flexible and extensible, allowing for:

  • Standard ARINC 429 word formats
  • Custom data encoding schemes
  • Direct manipulation of label and data fields
  • Support for various SSM (Sign/Status Matrix) configurations

For specific encoding requirements or custom implementations, please refer to the examples section above.

License

MIT License. See LICENSE.

"I steal fire not with torches, but with code. Not for men — but for the machines that do not dream yet."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arinc429-0.1.7.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arinc429-0.1.7-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file arinc429-0.1.7.tar.gz.

File metadata

  • Download URL: arinc429-0.1.7.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arinc429-0.1.7.tar.gz
Algorithm Hash digest
SHA256 7812cbc514425b92852d30bc7a72ca2ec060f4f5da3682527854d1a9a3a54c4e
MD5 117c1ff675c39bd2648e0aaaa05dd042
BLAKE2b-256 e24d7863e56419ac80448d66781c7d0bbdb4375fdacdd16675f4e6581ddc2c9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for arinc429-0.1.7.tar.gz:

Publisher: publish_to_pypi.yml on jaimebw/arinc429

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arinc429-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: arinc429-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arinc429-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3d84d5f56bccaaf36c5c14dfe3895db58dc1edb037e7cfa90d4f97b871e5d0bf
MD5 887b918b70889a07db976602a6b7e575
BLAKE2b-256 86e0128879b45b8e5ff9647f0261528abdfb0d9e7e4021c8f4300f1fe6126dfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for arinc429-0.1.7-py3-none-any.whl:

Publisher: publish_to_pypi.yml on jaimebw/arinc429

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page