USB-IO Interface Adapter GPIO-24. Programmers Reference Manual.


3.1.20. GPIO_SET_HPWM_CFG

Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7
GPIO_SET_ HPWM_ CFG (0x14) ECHO HPWM_ NUMBER ON TL TH T1L T1H
The GPIO_SET_HPWM_CFG command configures hardware pulse width modulation (PWM) settings for A.5 and B.5 pins.

PWM mode is configured specifying the high time (T1) and period (T) in µs. These values can vary from 1 µs to 340 µs.

Figure 3.5. PWM mode

PWM mode

Command is an 8-byte array of the following format:

Byte 0: GPIO_SET_HPWM_CFG (0x14)
This byte contains command identifier (command type). It should be set to 0x14.
Byte 1: ECHO
This byte can be used to associate a response received from GPIO-24 adapter with specific command. Response will contain exactly the same value in its echo byte.
Byte 2: HPWM_NUMBER
  • 0 – A.5;

  • 1 – B.5.

Byte 3: ON

  • 1 – enable HPWM on HPWM_NUMBER pin;

  • 0 – disable PWM on PWM_NUMBER pin.

Byte 4: TL

Least significant byte (low byte) of period in µs.

Byte 5: TH

Most significant byte (high byte) of period in µs.

Byte 6: T1L

Least significant byte (low byte) of high time in µs.

Byte 7: T1H

Most significant byte (high byte) of high time in µs.

For convenience GPIO_SET_HPWM_CFG structure is declared in reports.h file:
typedef struct _GPIO_SET_HPWM_CFG_CMD
{
   unsigned char id; //  = GPIO_SET_HPWM_CFG;
   unsigned char echo;
   unsigned char hpwm_number;
   unsigned char on;
   unsigned short t;
   unsigned short t1;
} __PACKED_ATTR GPIO_SET_HPWM_CFG_CMD, *PGPIO_SET_HPWM_CFG_CMD;

GPIO-24 adapter sends GPIO_SET_HPWM_CFG response after command execution.