How to configure "slot" and "chip_select" in pywpc's driver API - WPC-Systems-Ltd/WPC_Python_driver_release GitHub Wiki

In this article, we discuss about how to use slot and chip_select. Let's take STEM and AIO modules for examples.

AI_enableCS(slot, chip_select, timeout=timeout)

STEM

  • The following figure shows the STEM product, as you can see C1, C2, C3 and C4
  • C1 stands for slot=1
  • C2 stands for slot=2
  • C3 stands for slot=3
  • C4 stands for slot=4

24ch-AIO module

  • The following figure shows the AIO modules, as you can see T1, T2, T3 and T4
  • T1 stands for chip_select=0 (AI 0-7)
  • T2 stands for chip_select=1 (AI 8-15)
  • T3 stands for chip_select=2 (AI 16-23)
  • T4 (AO 0~7)

How to read AI data simultaneously by using AI (0-7) and AI (8-15) in slot1?

slot=1 
chip_select=[0, 2]
AI_enableCS(slot, chip_select, timeout=timeout)
AI_readOnDemand(slot, timeout=timeout)

AI_readOnDemand() will return in form of 1D list

data:
          [CH0, CH1, CH2, CH3, CH4, CH5, CH6, CH7, CH0, CH1, CH2, CH3, CH4, CH5, CH6, CH7]
          |                                       |                                      |
          |-------------->   CS0   <--------------|------------->   CS2   <------------- |
 

AI_readStreaming() will return in form of 2D list

data:
          [CH0, CH1, CH2, CH3, CH4, CH5, CH6, CH7, CH0, CH1, CH2, CH3, CH4, CH5, CH6, CH7]
          |                                       |                                      |
          |-------------->   CS0   <--------------|------------->   CS2   <------------- |
[sample0]
[sample1]
   .
   .
   .
[sampleN]