TOP Contributors

  1. MIKROE (2751 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139050 times)
  2. FAT32 Library (71588 times)
  3. Network Ethernet Library (56988 times)
  4. USB Device Library (47326 times)
  5. Network WiFi Library (43005 times)
  6. FT800 Library (42295 times)
  7. GSM click (29754 times)
  8. mikroSDK (27873 times)
  9. PID Library (26858 times)
  10. microSD click (26129 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

PAC1954 click

Rating:

5

Author: MIKROE

Last Updated: 2021-06-04

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Measurements

Downloaded: 1554 times

Not followed.

License: MIT license  

PAC1954 Click is a compact add-on board that contains an energy monitoring solution. This board features the PAC1954, a four-channel DC power/energy monitor from Microchip Technology.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "PAC1954 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "PAC1954 click" changes.

Do you want to report abuse regarding "PAC1954 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

PAC1954 click

PAC1954 click

Native view of the PAC1954 click board.

View full image
PAC1954 click

PAC1954 click

Front and back view of the PAC1954 click board.

View full image

Library Description

The library covers all the necessary functions to control the PAC1954 click board.

Key functions:

  • void pac1954_single_write( uint8_t reg_addr, uint8_t data_in ) - This function writes a single data byte to the selected register.
  • void pac1954_refresh_cmd( void ) -
    The readable registers for the VBUS, VSENSE, Power, accumulator outputs and accumulator count are updated by the 
    REFRESH command and the values will be static until the next REFRESH command
    .
  • float pac1954_get_calc_measurement( uint8_t meas_sel, uint8_t ch_sel, uint8_t avg_sel, uint8_t meas_mode ) -
    This function will call function for getting the selected measurement data and will perform all necessary calculations to get measurement value in a standard unit.

Examples description

The application is composed of three sections :

  • System Initialization - Performs the configuration for all necessary pins and
      peripherals.
  • Application Initialization - Performs the driver initialization and executes
      a default configuration of the PAC1954 click board.
  • Application Task - (code snippet) First calls a REFRESH command to allow all measurement and config registers to be updated. After that reads the calculated
      measurement results of channel 1 and sends the results to the usb uart port
      every 1 second.
void application_task ( )
{
    pac1954_refresh_cmd( );

    vsource = pac1954_get_calc_measurement( PAC1954_MEAS_SEL_V_SOURCE, 
                                            PAC1954_CH_SEL_CH_1, 
                                            PAC1954_AVG_SEL_ENABLE, 
                                            PAC1954_MEAS_MODE_BIPOLAR_FSR );
    isense = pac1954_get_calc_measurement( PAC1954_MEAS_SEL_I_SENSE, 
                                           PAC1954_CH_SEL_CH_1, 
                                           PAC1954_AVG_SEL_ENABLE, 
                                           PAC1954_MEAS_MODE_BIPOLAR_FSR );
    power = pac1954_get_calc_measurement( PAC1954_MEAS_SEL_P_SENSE, 
                                          PAC1954_CH_SEL_CH_1, 
                                          PAC1954_NULL, 
                                          PAC1954_MEAS_MODE_BIPOLAR_FSR );
    
    FloatToStr( vsource, log_txt );
    Ltrim( log_txt );
    float_cut( );
    mikrobus_logWrite( "V(source) is ", _LOG_TEXT );
    mikrobus_logWrite( log_txt, _LOG_TEXT );
    mikrobus_logWrite( " V", _LOG_LINE );

    FloatToStr( isense, log_txt );
    Ltrim( log_txt );
    float_cut( );
    mikrobus_logWrite( "I(sense) is ", _LOG_TEXT );
    mikrobus_logWrite( log_txt, _LOG_TEXT );
    mikrobus_logWrite( " A", _LOG_LINE );

    FloatToStr( power, log_txt );
    Ltrim( log_txt );
    float_cut( );
    mikrobus_logWrite( "P(sense) is ", _LOG_TEXT );
    mikrobus_logWrite( log_txt, _LOG_TEXT );
    mikrobus_logWrite( " W", _LOG_LINE );
    mikrobus_logWrite( "", _LOG_LINE );

    Delay_ms( 1000 );
}

Other mikroE Libraries used in the example:

  • I2C
  • UART

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.

ALSO FROM THIS AUTHOR

EEPROM 7 Click

0

EEPROM 7 Click is a compact add-on board that contains the highest-density memory solution. This board feature the 25CSM04, a 4-Mbit SPI Serial EEPROM with a 128-bit serial number and enhanced write protection mode from Microchip. Internally organized as 2,048 pages of 256 bytes each, the 25CSM04 comes up with the compatible SPI serial interface.

[Learn More]

LTE Cat.1 6 Click

0

LTE Cat.1 6 Click is a compact add-on board with global coverage for wireless communication over LTE, UMTS, and GSM networks. This board features the SIM7600SA, a LTE Cat 1 module from SIMCom, supporting LTE-TDD/LTE-FDD/HSPA+/GSM/GPRS/EDGE communication modes. Key features include multi-band LTE support, auxiliary diversity, and optional multi-constellation GNSS. It also integrates USB Type C for power and data transfer, a micro SIM card holder, three LED indicators for network status, power, custom notifications, AT command communication, and firmware upgrades.

[Learn More]

4-20mA T 2 Click

0

4-20mA T 2 Click is a compact add-on board for transmitting an analog output current over an industry-standard 4-20mA current loop. This board features DAC161S997, a low-power 16-bit ΣΔ digital-to-analog converter (DAC) from Texas Instruments. It has a programmable Power-Up condition and loop-error detection/reporting accessible via simple 4-wire SPI for data transfer and configuration of the DAC functions. In addition, it is characterized by low power consumption and the possibility of simple Highway Addressable Remote Transducer (HART) modulator interfacing, allowing the injection of FSK-modulated digital data into the 4-20mA current loop.

[Learn More]