P1AM API Reference

Function:

uint8_t P1.init();

Purpose:
Initializes the P1AM communications to the P1 modules. This function should be called before any other P1 module access functions are called.

Parameters:
None.

Return values:
0 - 15 - Number of P1 modules found connected to P1AM.

Function:

uint32_t P1.readDiscrete(uint8_t slot, uint8_t channel = 0);

Purpose:
Reads back the value(s) for a Discrete Input module. To read back the value for a specific Discrete Input, specify the channel number in the “channel” variable. To read back the integer value for all Discrete Inputs on that module, specify a value of 0 in the “channel” variable.

Parameters:

  • uint8_t slot - The slot number between 1 and 15 of the discrete input module that you want to read.
  • uint8_t channel - The specific point of the discrete input module that you want to read. Specify a value of 0 to read back all the discrete input points in integer format.

Return values:
A 32-bit value indicating either a 1 or 0 for the specific point requested or the integer value of all points of the module (when “channel” = 0).

Function:

void P1.writeDiscrete(uint32_t data, uint8_t slot, uint8_t channel = 0);

Purpose:
Writes the value(s) to the Discrete Output modules. To write to a specific point, set the “data” variable to a 0 or 1 and specify a discrete output point value in the “channel” variable. To write to all discrete output points at the same time, specify an integer value in the “data” variable and set the “channel” variable to 0.

Parameters:

  • uint32_t data - The value to write to the discrete output point (0 or 1) or entire module (integer value).
  • uint8_t slot - The slot number of the Discrete Output Module that you want to write to.
  • uint8_t channel - The specific point of the discrete output module that you want to write to. Specify a value of 0 to write to all the discrete output points in integer format.

Return values:
None.

Function:

int P1.readAnalog(uint8_t slot, uint8_t channel);

Purpose:
Reads back the raw, un-scaled, integer value from an Analog Input Module.

Parameters:

  • uint8_t slot - The slot number of the Analog Input Module that you want to read. Valid range is 1 - 15.
  • uint8_t channel - The specific channel of the Analog Input module that you want to read. Channels start at 1.

Return values:
A 32-bit value for the specified channel. For 12-bit analog modules, this will be a value between 0 - 4095. For 16-bit analog modules, this will be a value between 0 and 65535 or -32768 and 32767.

Function:

float P1.readTemperature(uint8_t slot, uint8_t channel);

Purpose:
Reads back the raw, un-scaled, floating point value from a Temperature Input Module.

Parameters:

  • uint8_t slot - The slot number of the Temperature Input Module that you want to read. Valid range is 1 - 15.
  • uint8_t channel - The specific channel of the Temperature Input module that you want to read. Channels start at 1.

Return values:
A 32-bit floating point value for the specified channel. The value will be in degrees for temperature configurations and volts for voltage configurations.

Function:

void P1.writeAnalog(uint32_t data, uint8_t slot, uint8_t channel);

Purpose:
Writes to a single Analog Output channel.

Parameters:

  • uint32_t data - The 32-bit value to be written to the Analog Output module specified. If the module is a 12-bit module, the range written should be 0 - 4095. If the module is a 16-bit module, the range written should be 0 - 65535.
  • uint8_t slot - The slot number of the Analog Output Module that you want to write to. Valid range is 1 - 15.
  • uint8_t channel - The specific channel of the Analog Output module that you want to write to. Channels start at 1.

Return values:
None.

Function:

void P1.readBlockData(char *buf, uint16_t len, uint16_t offset, uint8_t type);

Purpose:
This function gives the ability to read from many modules at one time. This is an advanced function that requires calculations of the module data sizes to specify offsets and lengths into the data image of the base controller. This function does not return the values requested but, instead, places them into the “buf” array. The maximum amount of data that can be requested in one read is 1200 bytes. If there is more than 1200 bytes of data in the Base Controller, you will have to offset in to the next block of data in the Base Controller.

Parameters:

  • char *buf - A data array that contains the values requested from the Base controller data buffer.
  • uint16_t len - This parameter specifies the length of data to retrieve.
  • uint16_t offset - This specifies the starting byte in the Base Controller buffer data to start reading.
  • uint8_t type - The data in the Base Controller is separated into different blocks for the different data types. You must specify which data type to read from: DISCRETE_IN_BLOCK, ANALOG_IN_BLOCK, DISCRETE_OUT_BLOCK, ANALOG_OUT_BLOCK, STATUS_IN_BLOCK.

Return values:
None.

Function:

void P1.writeBlockData(char *buf, uint16_t len, uint16_t offset, uint8_t type);

Purpose:
This function gives the ability to write to many modules at one time. This is an advanced function that requires calculations of the module data sizes to specify offsets and lengths into the data image of the base controller. The maximum amount of data that can be requested in one write is 1200 bytes. If there is more than 1200 bytes of data in the Base Controller, you will have to offset in to the next block of data in the Base Controller.

Parameters:

  • char *buf - A data array that contains the values being written to the Base controller data buffer.
  • uint16_t len - This parameter specifies the length of data to write.
  • uint16_t offset - This specifies the starting byte in the Base Controller buffer data to start writing to.
  • uint8_t type - The data in the Base Controller is separated into different blocks for the different data types. You must specify which data type to write to: DISCRETE_IN_BLOCK, ANALOG_IN_BLOCK, DISCRETE_OUT_BLOCK, ANALOG_OUT_BLOCK, STATUS_IN_BLOCK.

Return values:
None.

Function:

void P1.writePWM(float duty, uint32_t freq, uint8_t slot, uint8_t channel);

Purpose:
This function controls the P1-04PWM Pulse Width Modulation module. The duty and frequency can be set for each channel.

Parameters:

  • float duty - A floating point value between 0.00 - 100.00 can be sent to each channel for the duty cycle.
  • uint32_t freq - This parameter specifies the frequency from 0 - 20,000 for each channel.
  • uint8_t slot - This specifies the slot number of the P1-04PWM you want to write to. Valid range is 1 - 15.
  • uint8_t channel - The specifies the channel of the P1-04PWM you want to write to. Channels start at 1.

Return values:
None.

Function:

void P1.writePWMDuty(float duty, uint8_t slot, uint8_t channel);

Purpose:
This function allows the duty cycle to be changed on the P1-04PWM module while running at the current frequency. To change both the duty and the frequency, use the P1.writePWM function instead.

Parameters:

  • float duty - A floating point value between 0.00 - 100.00 can be sent to each channel for the duty cycle.
  • uint8_t slot - This specifies the slot number of the P1-04PWM you want to write to. Valid range is 1 - 15.
  • uint8_t channel - The specifies the channel of the P1-04PWM you want to write to. Channels start at 1.

Return values:
None.

Function:

void P1.writePWMFreq(uint32_t freq, uint8_t slot, uint8_t channel);

Purpose:
This function allows the frequency to be changed on the P1-04PWM module while running with the current duty cycle. To change both the duty and the frequency, use the P1.writePWM function instead.

Parameters:

  • uint32_t freq - This parameter specifies the frequency from 0 - 20,000 for each channel.
  • uint8_t slot - This specifies the slot number of the P1-04PWM you want to write to. Valid range is 1 - 15.
  • uint8_t channel - The specifies the channel of the P1-04PWM you want to write to. Channels start at 1.

Return values:
None.

Function:

void P1.writePWMDir(bool data, uint8_t slot, uint8_t channel);

Purpose:
This function sets a channel configured on a P1-04PWM for DIR to be enabled high or low. This is typically used in conjunction with another channel set for PWM wired to a Stepper Motor controller for direction change.

Parameters:

  • bool data - This value sets the channel configured as DIR as low (0) or high (1).
  • uint8_t slot - This specifies the slot number of the P1-04PWM you want to write to. Valid range is 1 - 15.
  • uint8_t channel - The specifies the channel of the P1-04PWM you want to write to. Channels start at 1.

Return values:
None.

Function:

uint8_t P1.printModules();

Purpose:
This function prints out in the serial monitor, the P1 modules discovered by the P1AM.

Parameters:
None.

Return values:
An integer value displaying the number of modules found is returned by the function.

Function:

uint8_t P1.checkUnderRange(uint8_t slot, uint8_t channel = 0);

Purpose:
This function returns the Under-Range status from an Analog Input module. The status for a specific channel can be request or the status byte for the entire module can be requested (channel = 0). Consult the individual module documentation to see if it supports this status item.

Parameters:

  • uint8_t slot - The slot number of the Analog Input Module that you want to read. Valid range is 1 - 15.
  • uint8_t channel - The specific channel of the Analog Input module that you want to read. Set this parameter to 0 to read the status for all channels. Valid range is 0 - 4.

Return values:
An 8-bit integer value is returned. The value will be 0 or 1 for specific channel requests. If the entire module status is requested (channel = 0), each bit of the byte will correspond to the under-range status for that channel (LSB - Channel 1).

Function:

uint8_t P1.checkOverRange(uint8_t slot, uint8_t channel = 0);

Purpose:
This function returns the Over-Range status from an Analog Input module. The status for a specific channel can be request or the status byte for the entire module can be requested (channel = 0). Consult the individual module documentation to see if it supports this status item.

Parameters:

  • uint8_t slot - The slot number of the Analog Input Module that you want to read. Valid range is 1 - 15.
  • uint8_t channel - The specific channel of the Analog Input module that you want to read. Set this parameter to 0 to read the status for all channels. Valid range is 0 - 4.

Return values:
An 8-bit integer value is returned. The value will be 0 or 1 for specific channel requests. If the entire module status is requested (channel = 0), each bit of the byte will correspond to the over-range status for that channel (LSB - Channel 1).

Function:

uint8_t P1.checkBurnout(uint8_t slot, uint8_t channel = 0);

Purpose:
This function returns the Burnout status from an Analog Input module. The status for a specific channel can be request or the status byte for the entire module can be requested (channel = 0). Consult the individual module documentation to see if it supports this status item.

Parameters:

  • uint8_t slot - The slot number of the Analog Input Module that you want to read. Valid range is 1 - 15.
  • uint8_t channel - The specific channel of the Analog Input module that you want to read. Set this parameter to 0 to read the status for all channels. Valid range is 0 - 4.

Return values:
An 8-bit integer value is returned. The value will be 0 or 1 for specific channel requests. If the entire module status is requested (channel = 0), each bit of the byte will correspond to the Burnout status for that channel (LSB - Channel 1).

Function:

uint8_t P1.check24V(uint8_t slot);

Purpose:
This function returns the 24 VDC status from a module. Consult the individual module documentation to see if it supports this status item.

Parameters:

  • uint8_t slot - The slot number of the Module that you want to read. Valid range is 1 - 15.

Return values:
An 8-bit integer value is returned. The value will be 0 if 24 VDC is present or 1 if 24 VDC is missing.

Function:

char P1.readStatus(int byteNum, int slot);

Purpose:
This function returns a single status byte from a specific module.

Parameters:

  • int byteNum - The starting byte offset (offset starts at 0) of the status byte you want to read. Consult the module documentation for details on the status bytes.
  • int slot - The slot number of the Module that you want to read. Valid range is 1 - 15.

Return values:
The status byte value is returned as a char.

Function:

void P1.readStatus(char buf[], uint8_t slot);

Purpose:
This function returns all status byte values from a specific module. The data is not returned from the function but stored in the “buf” array.

Parameters:

  • char buf[ ] - This array is where the status byte values read from a module are stored.
  • uint8_t slot - The slot number of the Module that you want to read. Valid range is 1 - 15.

Return values:
None.

Function:

bool P1.configureModule(char cfgData[], uint8_t slot);

Purpose:
This function allows you to configure the settings of the P1 modules. Each module may have a different configuration so consult the individual module documentation for detailed breakdown of this data. This function would be more typically used for applications that have dynamic configuration data. For more static configuration setups, use the next function (overload function) that has a constant char array defined.

Parameters:

  • char cfgData[ ] - This byte array is where the configuration data is stored that is being sent to the module.
  • uint8_t slot - The slot number of the Module that you want to configure. Valid range is 1 - 15.

Return values:
A Boolean value of 1 is returned for a successful configuration change.

Function:

bool P1.configureModule(const char cfgData[], uint8_t slot);

Purpose:
This function allows you to configure the settings of the P1 modules. Each module may have a different configuration so consult the individual module documentation for detailed breakdown of this data. 

Parameters:

  • const char cfgData[ ] - This constant byte array is where the configuration data is stored that is being sent to the module.
  • uint8_t slot - The slot number of the Module that you want to configure. Valid range is 1 - 15.

Return values:
A Boolean value of 1 is returned for a successful configuration change.

Function:

void P1.readModuleConfig(char cfgData[], uint8_t slot);

Purpose:
This function allows you to read the current configuration of the specified module. Each module may have a different configuration so consult the individual module documentation for detailed breakdown of this data. 

Parameters:

  • char cfgData[ ] - This byte array is where the current configuration data of the specified module will be stored.
  • uint8_t slot - The slot number of the Module that you want to read the configuration from. Valid range is 1 - 15.

Return values:
None.

Function:

void P1.configWD(uint16_t milliseconds, uint8_t toggle);

Purpose:
This function configures the watchdog timer value in milliseconds and watchdog behavior option, defined by the “toggle” parameter. A value of 1 in the “toggle” parameter will reset the CPU after 5000 milliseconds have passed. A value of 0 will stop the CPU until a power cycle occurs. To use the watchdog, it must be configured first by the “P1.configWD()” function. To start the watchdog, the “P1.startWD()” must be called. If the “P1.petWD()” or a Base Controller function is not called at a faster rate than the time frame specified in the “P1.configWD()” function, the watchdog will occur. To stop the watchdog timer, use the “P1.stopWD()” function.

Parameters:

  • uint16_t milliseconds - This is the watchdog timer value in milliseconds.
  • uint8_t toggle - This value determines the behavior of the CPU when a watchdog occurs. See the purpose section above for details.

Return values:
None.

Function:

void P1.startWD();

Purpose:
This function starts the watchdog timer. See the purpose of the “P1.configWD()” function for more details on using the watchdog feature.

Parameters:
None.

Return values:
None.

Function:

void P1.stopWD();

Purpose:
This function stops the watchdog timer. See the purpose of the “P1.configWD()” function for more details on using the watchdog feature.

Parameters:
None.

Return values:
None.

Function:

void P1.petWD();

Purpose:
This function is used to keep the watchdog timer from timing out if P1 I/O functions are not being called often enough. See the purpose of the “P1.configWD()” function for more details on using the watchdog feature.

Parameters:
None.

Return values:
None.

Function:

uint32_t P1.getFwVersion();

Purpose:
This function is used to retrieve the firmware version of the P1 Base Controller. The format of the value returned (in bytes) is X.Y.ZZ.

Parameters:
None.

Return values:
A 32-bit integer is returned for the firmware version.

Function:

bool P1.isBaseActive();

Purpose:
This function checks to see if the P1 Base controller is active. To activate the P1 Base Controller, call the “P1.init()” function.

Parameters:
None.

Return values:
A Boolean value of 1 is returned if the P1 Base controller is active.

Function:

uint8_t P1.checkConnection(uint8_t numberOfModules = 0);

Purpose:
This function checks to see if any of the P1 modules have gone missing. If the “numberOfModules” variable contains a slot value, the function will return either a 0 (if everything is Ok or the value of the first slot number, from the left, that presented a problem. For example: if there are only 3 modules and a value of 4 was placed into the “numberOfModules” variable, the result would be “4”. The same would occur is a value of 5 was placed into the “numberOfModules” variable since slot 3 is the last good slot. If a value of 0 is passed into the “numberOfModules” variable, the function will return the number of modules found in the last init() function. In the example above, the results would be 1, 2, 3, 0 if sending a value of 0 in the “numberOfModules” variable when there are 3 modules.

Parameters:

  • uint8_t numberOfModules - Passes in the slot number of the module to check. Sending a value of 0 returns the number of modules found the last time the init() function ran.

Return values:
A 8-bit value is returned that either indicates a 0 if the slot number passed to the function is good, the slot number where the problem is found if there is a problem or the number of modules found with the last init() function if a value of 0 is passed into the function. See the Purpose explanation above.

Function:

uint16_t P1.rollCall(const char* moduleNames[], uint8_t numberOfModules);

Purpose:
Send an array of expected P1 module names to verify connected P1 modules. Module names should be added to the moduleNames array in the same order as the modules (left to right).

Parameters:

  • const char* moduleNames[ ] - An array of P1 module names. Example: {“P1-08SIM”, “P1-08TRS”}
  • uint8_t numberOfModules - The number of expected modules.

Return values:
A 16-bit value that is binary encoded with each bit from LSB to MSB indicating an error (1) or non-error state (0) for the corresponding slot number. A value of 0 indicates no errors.

Function:

void P1.enableBaseController(bool state);

Purpose:
Disables the Base Controller during normal operation and turns off modules. NOTE: To re-enable the Base Controller, call the P1.init() function. Calling P1.enableBaseController(true) will NOT re-init the Base Controller.

Parameters:

  • bool state - A value of false disables the Base Controller.

Return values:
None.

Channel Labels

The functions below behave the same as the ones described above, but allow for a more descriptive label instead of the “slot” and “channel” values by utilizing the channelLabel structure. This allows you to move your IO devices around and only require a change in one place instead of multiple.

Example:

Instead of performing a P1.readDiscrete(1, 2); you could do the same function as P1.readDiscrete(highLevelSensor_1); with the following code:

channelLabel highLevelSensor_1 = {1,2}; //Create Label for sensor at slot 1 channel 2 bool sensorState = P1.readDiscrete(highLevelSensor_1); //read the sensor

The functions that support this structure are:

					
uint32_t P1.readDiscrete(channelLabel label); void P1.writeDiscrete(uint32_t data, channelLabel label); void P1.writeDiscrete(uint32_t data, channelLabel label); int P1.readAnalog(channelLabel label); float P1.readTemperature(channelLabel label); void P1.writeAnalog(uint32_t data, channelLabel label); void P1.writePWM(float duty, uint32_t freq, channelLabel label); void P1.writePWMDuty(float duty, channelLabel label); void P1.writePWMFreq(uint32_t freq, channelLabel label); void P1.writePWMDir(bool data, channelLabel label); uint8_t P1.checkUnderRange(channelLabel label); uint8_t P1.checkOverRange(channelLabel label); uint8_t P1.checkBurnout(channelLabel label);

P1AM.Base

Class for the P1000 Base. This class contains all methods and objects needed to interface with the P1000 IO modules.

Accessing a Base object by index, e.g. base[2], returns the IO_Module of the slot of that index.

import P1AM base = P1AM.Base() slot_2 = base[2]

Constructor:

class P1AM.Base(zero_indexing=False)

Purpose:
Initializes the P1AM communications to the P1 modules. This function should be called before any other P1 module access functions are called.

Parameters:

  • bool zero_indexing - Begin the Module and Channel numbering at 0. When enabled, slot 0 is closest to the CPU, and channel 0 is the first channel.
  • Return:
    The P1AM Base object.

    Property:

    Base.get_active

    Return:
    A Boolean True is returned if the P1 Base Controller has been initialized and is active.

    Method:

    Base.init()

    Purpose:
    Manually re-initalize the Base Controller for scenarios where 24V power was lost or it was manually de-initalized.

    Return:
    None.

    Method:

    Base.deinit()

    Purpose:
    De-initalize the Base Controller and turn off all outputs.

    Return:
    None.

    Method:

    Base.print_modules()

    Purpose:
    Prints the slot number and module name of each module in the base. Slot number is relevant to current indexing scheme.

    Return:
    None.

    Method:

    Base.config_watchdog(milliseconds, mode="TOGGLE")

    Purpose:
    Configures watchdog timeout for Base Controller.

    Parameters:

  • milliseconds - The timeout period for the watchdog to trigger. Any IO access will automatically reset the timer.
  • mode - The behavior of the watchdog when it triggers. Valid options are "TOGGLE" and "HOLD". "TOGGLE" will quickly reset the CPU while "HOLD" will keep the system in reset unitl 24V power has been cycled.
  • Return:
    None.

    Method:

    Base.pet_watchdog()

    Purpose:
    Manually reset watchdog timer. Any function that reads or writes to the Base Controller will do this automatically, so this provides a manual way of doing so.

    Return:
    None.

    Method:

    Base.start_watchdog()

    Purpose:
    Start the watchdog timer.

    Return:
    None.

    Method:

    Base.stop_watchdog()

    Purpose:
    Stop the watchdog timer.

    Return:
    None.

    Method:

    Base.writeDiscrete(data, slot, channel=None)

    Purpose:
    C-Style API for controlling discrete output modules.

    Parameters:

  • data - The value to write to the discrete output point (0 or 1) or entire module (integer value).
  • slot - The slot number of the discrete output module that you want to write to.
  • channel - The specific point of the discrete output module that you want to write to. Specify a value of 0 or omit the argument to write to all the discrete output points in integer format.
  • Return:
    None.

    Method:

    Base.readDiscrete(slot, channel=None)

    Purpose:
    C-Style API for controlling discrete input modules.

    Parameters:

  • slot - The slot number of the discrete input module that you want to read from.
  • channel - The specific point of the discrete input module that you want to read from. Specify a value of 0 or omit the argument to read to all the discrete input points in integer format.
  • Return:
    An integer repesenting the reading of the individual channel or a bitmapped representation of all channels.

    Method:

    Base.writeAnalog(data, slot, channel=None)

    Purpose:
    C-Style API for controlling discrete output modules.

    Parameters:

  • data - The integer value to write to the analog output channel.
  • slot - The slot number of the analog output module that you want to write to.
  • channel -The specific channel of the analog output module that you want to write to.
  • Return:
    None.

    Method:

    Base.readAnalog(slot, channel)

    Purpose:
    C-Style API for controlling analog input modules.

    Parameters:

  • slot - The slot number of the analog input module that you want to read from.
  • channel - The specific point of the analog input module that you want to read from.
  • Return:
    An integer repesenting the reading of the individual channel.

    Method:

    Base.readTemperature(slot, channel)

    Purpose:
    C-Style API for controlling temperature input modules.

    Parameters:

  • slot - The slot number of the temperature input module that you want to read from.
  • channel - The specific point of the temperature input module that you want to read from.
  • Return:
    An floating point value representing the reading of the individual channel.

    Method:

    Base.readStatus(slot)

    Purpose:
    C-Style API for reading status values from a modules.

    Parameters:

  • slot - The slot number of the module that you want to read the status bytes from.
  • Return:
    An integer repesenting the status bytes of the module.


    Method:

    Base.rollCall(module_names)

    Purpose:
    Compares a list of module names with the ones that have signed on. Raises an error if there is a mismatch.

    Parameters:

  • module_names - A list of P1000 module names that are expected to be present in the base.
  • Return:
    An integer repesenting the status bytes of the module.


    P1AM.IO_Module

    Class for P1000 modules. IO_Module objects are generated by the P1AM.Base class constructor.

    Method:

    IO_Module.print_state()

    Purpose:
    This will print the value of every channel in the module.

    Return:
    None.

    Method:

    IO_Module.do_bitmapped(states)

    Parameters:

  • states - An integer representing the bitmapped state of the discrete output channels of the module.
  • Return:
    None.

    Method:

    IO_Module.di_bitmapped()

    Return:
    An integer representing a bitmapped state of the discrete input channels of the module.

    Method:

    IO_Module.status_bitmapped()

    Return:
    All status bytes of a module.

    Method:

    IO_Module.configure_module(config_data)

    Purpose:
    Used to configure compatible modules. A tool to generate configuration bytes for modules can be found here

    Parameters:

  • config_data - A list or tuple of configuration bytes to pass to the module.
  • Return:
    None.

    Property:

    IO_Module.missing24

    Return:
    A Boolean True is returned if the module is missing 24V.

    Property:

    IO_Module.not_ready

    Return:
    A Boolean True is returned if the module is not ready to be read.

    Property:

    IO_Module.over_range

    Return:
    A list of Boolean values representing each IO_Channel's over range status.

    Property:

    IO_Module.under_range

    Return:
    A list of Boolean values representing each IO_Channel's under range status.

    Property:

    IO_Module.burnout

    Return:
    A list of Boolean values representing each IO_Channel's burnout status.

    Property:

    IO_Module.values

    Return:
    A list of values from each IO_Channel.

    Property:

    IO_Module.values = states

    Parameters:

  • states - A list or tuple of values to set each IO_Channel to.

  • Property:

    IO_Module.output_values

    Purpose:
    To interact with output values on combo modules.

    Return:
    A list of values from each output IO_Channel.

    Property:

    IO_Module.output_values = states

    Parameters:

  • states - A list or tuple of values to set each output IO_Channel to.

  • Property:

    IO_Module.input_values

    Purpose:
    To interact with input values on combo modules.

    Return:
    A list of values from each input IO_Channel.

    Property:

    IO_Module.reals

    Return:
    A list of reals from each IO_Channel.

    Property:

    IO_Module.reals = states

    Parameters:

  • states - A list or tuple of reals to set each IO_Channel to.

  • Property:

    IO_Module.output_reals

    Purpose:
    To interact with output reals on combo modules.

    Return:
    A list of reals from each output IO_Channel.

    Property:

    IO_Module.output_reals = states

    Purpose:
    To interact with output reals on combo modules.

    Parameters:

  • states - A list or tuple of reals to set each output IO_Channel to.

  • Property:

    IO_Module.input_reals

    Purpose:
    To interact with input reals on combo modules.

    Return:
    A list of reals from each input IO_Channel.



    P1AM.IO_Channel

    Class for non-specialty channels of a P1000 module. IO_Module channel objects are generated by the P1AM.Base class constructor.

    Property:

    IO_Channel.over_range

    Return:
    A Boolean True is returned if the IO_Channel is over range.

    Property:

    IO_Channel.under_range

    Return:
    A Boolean True is returned if the IO_Channel is under range.

    Property:

    IO_Channel.burnout

    Return:
    A Boolean True is returned if the IO_Channel is burned out.

    Property:

    IO_Channel.value

    Return:
    The value of the IO_Channel.

    Property:

    IO_Channel.value = state

    Parameters:

  • state - The value to set the IO_Channel to.

  • Property:

    IO_Channel.real

    Return:
    The real of the IO_Channel.

  • Discrete Channels - True or False
  • Analog Channels - Decimal number (V or mA)
  • Property:

    IO_Channel.real = state

    Parameters:

  • state - The real to set the IO_Channel to.

  • P1AM.PWM_Channel

    Class for a PWM channel for a P1-04PWM related io_module class. PWM_Channel objects are generated automatically by the Base constructor.

    Duty cycle is a percentage represented as a float between 0 and 100.0.
    Frequency is in Hz and is an integer between 0 and 20kHz.

    Property:

    PWM_Channel.value

    Read/Write:
    A list object in the format [duty_cycle, frequency].

    Property:

    PWM_Channel.frequency

    Read/Write:
    Output frequency of this channel as an integer between 0 and 20kHz.

    Property:

    PWM_Channel.duty_cycle

    Read/Write:
    Output duty cycle of this channel as a percentage represented as a float between 0 and 100.0.


    P1AM.HSC_Channel

    Class for an HSC channel for a P1-02HSC related io_module class. HSC_Channel objects are generated automatically by the Base constructor.

    Changes to settings are automatically written to the P1-02HSC module.

    Property:

    HSC_Channel.position

    Read/Write:
    The current position as a 32-bit signed value.

    Property:

    HSC_Channel.enable_z_reset

    Read/Write:
    When True the Z input on the channel will reset the position to the z_reset_position value.

    Property:

    HSC_Channel.z_reset_position

    Read/Write:
    The value to reset the channel position to when enable_z_reset is True and the Z input is active.

    Property:

    HSC_Channel.is_rotary

    Read/Write:
    When True the channel is set as a rotary encoder and the position will rollover to 0 at the specified rollover value.

    Property:

    HSC_Channel.rollover_position

    Read/Write:
    The rollover position to be used when is_rotary is True.

    Property:

    HSC_Channel.inhibit_on_input

    Read/Write:
    Inihibits counting on this channel when the configured signal is active. Supported options are: (None, "1z", "3in", "2z", "4in")

    Property:

    HSC_Channel.input_inhibit_active

    Read-only:
    True when the channel is actively being inhibited.

    Property:

    HSC_Channel.alert_new_position

    Read-only:
    Returns True if a new rollover position is set.

    Property:

    HSC_Channel.counting_mode

    Read/Write:
    The current counting mode of this channel. Supported options are: ("step_direction", "quadrature_4x", "quadrature_1x")

    Property:

    HSC_Channel.positive_polarity

    Read/Write:
    True when the channel is counting using positive signal polarty. Set to False to invert polarity.