Skip to main content

Library to control 24-Bit Analog Inputs DAQ Card

Project description

Welcome to SM24b8vin’s documentation!

Install

sudo pip install SM24b8vin

or

sudo pip3 install SM24b8vin

Update

sudo pip install SM24b8vin -U

or

sudo pip3 install SM24b8vin -U

Initiate class

$ python
Python 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import SM24b8vin
>>> sm24b = SM24b8vin.SM24b8vin()
>>> sm24b.get_u_in(1)
>>>

Documentation

__init__.py This module provides the SM24b8vin class which implements the functionality (for analog input, LED control, RTC, watchdog, and calibration) of the 24b8vin card.

class SM24b8vin.SM24b8vin(stack=0, i2c=1)

Bases: object

Python class to control the 24b8vin card (Eight 24-bit analog inputs).

This class provides methods to read the eight analog input channels, set/read the gain codes, control 8 LEDs, access the RTC, use the watchdog, and perform calibration operations.

  • Parameters:
    • stack (int) – The device stack index (added to SLAVE_OWN_ADDRESS_BASE).
    • i2c (int) – I2C bus number.

get_all_leds()

Get the status of all LEDs as a bitmask.

  • Returns: Bitmask of LED states.
  • Return type: int

get_gain(channel)

Get gain setting for an analog input channel.

  • Parameters: channel (int) – Channel number [1..{gain}].
  • Returns: Gain code.
  • Return type: int

get_led(led)

Get the state of a single LED.

  • Parameters: led (int) – LED number [1..{led}].
  • Returns: 1 (ON) or 0 (OFF).
  • Return type: int

get_rtc()

Get the real–time clock (RTC) time.

  • Returns: (year, month, day, hour, minute, second)
  • Return type: tuple

get_u_in(channel)

Get analog input voltage for a given channel (in volts).

  • Parameters: channel (int) – Channel number [1..{u_in}].
  • Returns: Voltage value in volts.
  • Return type: float

get_version()

Get the firmware version.

  • Returns: Version string in the form “major.minor”.
  • Return type: str

set_all_leds(bitmask)

Set all LEDs at once using a bitmask.

  • Parameters: bitmask (int) – Bitmask value (0 to 2^(LED_CH_NO)-1).

set_gain(channel, gain)

Set the gain for an analog input channel.

  • Parameters:
    • channel (int) – Channel number [1..{gain}].
    • gain (int) – Gain code (0–7).

set_led(led, state)

Set the state of a single LED.

  • Parameters:
    • led (int) – LED number [1..{led}].
    • state (int) – 0 (OFF) or 1 (ON).

set_rtc(year, month, day, hour, minute, second)

Set the RTC time.

  • Parameters:
    • year (int) – Full year (e.g. 2025)
    • month (int) – Date/time components.
    • day (int) – Date/time components.
    • hour (int) – Date/time components.
    • minute (int) – Date/time components.
    • second (int) – Date/time components.

wdt_clear_reset_count()

Clear the watchdog reset count.

wdt_get_init_period()

Get the initial watchdog period (in seconds).

wdt_get_off_period()

Get the watchdog power–off period (in seconds).

wdt_get_period()

Get the watchdog period (in seconds).

wdt_get_reset_count()

Get the watchdog reset count.

wdt_reload()

Reload (reset) the watchdog timer.

wdt_set_init_period(period)

Set the initial watchdog period.

  • Parameters: period (int) – Period in seconds.

wdt_set_off_period(period)

Set the watchdog power–off period.

  • Parameters: period (int) – Off period in seconds.

wdt_set_period(period)

Set the watchdog period.

  • Parameters: period (int) – Period in seconds.

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

sm24b8vin-1.0.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

sm24b8vin-1.0.1-py2.py3-none-any.whl (7.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sm24b8vin-1.0.1.tar.gz.

File metadata

  • Download URL: sm24b8vin-1.0.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.2

File hashes

Hashes for sm24b8vin-1.0.1.tar.gz
Algorithm Hash digest
SHA256 302afee3e8422c043d9c6c616969edc7fc785290022733842f02cea4c0ed2f5f
MD5 33cd407f5fce6e9beca79d7dde81a3fd
BLAKE2b-256 c0924b9b4c81713694c3c3512027ab03bcbfa9d7d239787004cd9f5d51d96e10

See more details on using hashes here.

File details

Details for the file sm24b8vin-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: sm24b8vin-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.2

File hashes

Hashes for sm24b8vin-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0d8201ad78595bd56ac49f4f1d0701c739f127734fb5adeabf8277d9564be844
MD5 9451ff507cb03237f812f989b2764ace
BLAKE2b-256 493d268b78eb7645cc6420b0c1d6a2b8e81dc8d3e8dc74dfd62ba077a56a62d1

See more details on using hashes here.

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