PS_Fgen_FW  4da88f4073c1cc65ea45c3a652a2751e495e50db
Firmware for an Power Supply and Function Generator build from an ATX power supply
Loading...
Searching...
No Matches
Configuration.h File Reference

Containing different defines for device configuration. More...

#include "version.h"

Go to the source code of this file.

Macros

#define DEVICE_TIMER_TICK_INTERVAL_MS   100
 Tick interval of the DeviceTimer in ms.
 
#define POWER_SUPPLY_REG_INTERVAL_MS   100
 Time period for power supply regulation.
 
#define KEY_POLLING_DELAY_MS   250
 Time period for key polling (keys and encoder button).
 
#define TOUCH_HANDLING_DELAY_MS   300
 Time period for touch screen polling.
 
#define SCREEN_REDRAW_DELAY_MS   500
 Time period for screen redraw.
 
#define SETTINGS_AUTOSAVE_DELAY_MS   60000
 Milliseconds between automatic saves of the device settings.
 
#define SPLASHSCREEN_DELAY_MS   2000
 Time that the splash screen is shown in milliseconds.
 
#define SERIAL_BAUDRATE   9600
 Serial baud rate used for the serial input (SCPI, debug output).
 
#define SCPI_ENABLED
 Comment this line out to disable the SCPI parser.
 
#define SCPI_INPUT_BUFFER_LENGTH   16
 Length of the SCPI input buffer.
 
#define SCPI_ERROR_QUEUE_SIZE   3
 Maximum number of errors in the error queue.
 
#define SCPI_IDN_MANUFACTURER   "Markus Scheich"
 Manufacturer info used in *IDN?
 
#define SCPI_IDN_MODEL   "PS_Fgen"
 Model info used in *IDN?
 
#define SCPI_IDN_SERIAL_NUMBER   "01"
 Serial number used in *IDN?
 
#define SCPI_IDN_SOFTWARE_REVISION   VERSION
 Software version used in *IDN?
 
#define SPLASHSCREEN_ENABLED
 Comment this line out to disable the Splashscreen.
 
#define COLOR_BACKGROUND   RGB565(0x00, 0x00, 0x00
 Background color for the screen UIElements.
 
#define COLOR_FOREGROUND   RGB565(0x00, 0xF7, 0x00
 Foreground color for the screen UIElements.
 
#define COLOR_FOREGROUND_HEADERS   RGB565(0xFF, 0xFF, 0xFF
 Foreground color for the screen headers.
 
#define COLOR_FOCUS_FRAME   RGB565(0xFF, 0xFF, 0xFF
 Color for the screen UIElement selection frame.
 
#define TOUCH_ENABLED
 Comment this line out to disable the touch functionality.
 
#define TOUCH_LONG_DELAY_MS   750
 Time period in ms that is interpreted as long touch.
 
#define USERINPUT_QUEUE_LENGTH   16
 Length of the queue used to buffer the user inputs (keys, encoder, Usart)
 
#define PS_SUBSYSTEM_ENABLED
 Comment this line out to disable the power supply subsystem.
 
#define DDS_SUBSYSTEM_ENABLED
 Comment this line out to disable the direct digital synthesis subsystem.
 
#define MEASURE_SUBSYSTEM_ENABLED
 Comment this line out to disable the measurement (ATX voltages and digital multimeters) subsystem.
 
#define DDS_TICK_FREQ   15625
 Frequency at which the phase accumulator is updated.
 
#define DDS_PHASE_ACCU_BITS   32
 Number of bits used by the phase accumulator of the direct digital synthesis.
 
#define DDS_QUANTIZER_BITS   8
 Number of bits that are used to index into the look up tables.
 
#define DDS_DAC_BITS   12
 Number of bits used by the DAC.
 
#define DDS_SAMPLE_MAX   ((1 << DDS_DAC_BITS) - 1)
 Maximum value that can be reached with the number of bits in DDS_DAC_BITS.
 
#define DDS_AMPLITUDE_MAX   20.0f
 Maximum supported amplitude at the DDS outputs.
 
#define NUM_PS_CHANNELS   1
 Number of power supply output channels if the PS subsystem is enabled.
 
#define NUM_DDS_CHANNELS   2
 Number of direct digital synthesis output channels if the DDS subsystem is enabled.
 
#define NUM_MEASURE_CHANNELS   2
 Number of digital multimeter output channels if the DDS subsystem is enabled.
 
#define NUM_CHANNELS   NUM_PS_CHANNELS + NUM_DDS_CHANNELS + NUM_MEASURE_CHANNELS
 Number of channels (this is the sum of NUM_PS_CHANNELS, NUM_DDS_CHANNELS and NUM_MEASURE_CHANNELS)
 
#define PS_INTERNAL_IMPEDANCE   5.7
 Internal impedance in Ohm of the PowerSupply output.
 
#define PS_MIN_VOLTAGE   0
 Minimum allowed power supply voltage setting.
 
#define PS_MAX_VOLTAGE   10
 Maximum allowed power supply voltage setting.
 
#define PS_MAX_CURRENT   2
 Maximum allowed power supply current setting.
 
#define PS_MIN_OVP_LEVEL_PERCENTAGE   50
 Minimum allowed power supply OVP level setting (in percent of the configured voltage)
 
#define PS_MAX_OVP_LEVEL_PERCENTAGE   200
 Maximum allowed power supply OVP level setting (in percent of the configured voltage)
 
#define PS_MIN_OVP_DELAY   (POWER_SUPPLY_REG_INTERVAL_MS / 1000.0f)
 Minimum allowed power supply OVP delay setting.
 
#define PS_MAX_OVP_DELAY   20
 Maximum allowed power supply OVP delay setting.
 
#define PS_MIN_OCP_LEVEL   0
 Minimum allowed power supply OCP level setting.
 
#define PS_MAX_OCP_LEVEL   3
 Maximum allowed power supply OCP level setting.
 
#define PS_MIN_OCP_DELAY   PS_MIN_OVP_DELAY
 Minimum allowed power supply OCP delay setting.
 
#define PS_MAX_OCP_DELAY   PS_MAX_OVP_DELAY
 Maximum allowed power supply OCP delay setting.
 
#define PS_MIN_OPP_LEVEL   0
 Minimum allowed power supply OCP level setting.
 
#define PS_MAX_OPP_LEVEL   (PS_MAX_VOLTAGE * PS_MAX_OCP_LEVEL)
 Maximum allowed power supply OCP level setting.
 
#define PS_MIN_OPP_DELAY   PS_MIN_OVP_DELAY
 Minimum allowed power supply OPP delay setting.
 
#define PS_MAX_OPP_DELAY   65
 Maximum allowed power supply OPP delay setting.
 
#define PS_VOLT_PID_P   0.2f
 Proportional part of the voltage PID regulator.
 
#define PS_VOLT_PID_I   3.0f
 Integral part of the voltage PID regulator.
 
#define PS_VOLT_PID_D   0
 Differential part of the voltage PID regulator.
 
#define DDS_MIN_FREQ   0.001f
 Minimum allowed DDS frequency setting.
 
#define DDS_MAX_FREQ   20000
 Maximum allowed DDS frequency setting.
 
#define DDS_MIN_AMPLITUDE   0
 Minimum allowed DDS amplitude setting.
 
#define DDS_MAX_AMPLITUDE   20
 Maximum allowed DDS amplitude setting.
 
#define DDS_MIN_OFFSET   -10
 Minimum allowed DDS offset setting.
 
#define DDS_MAX_OFFSET   10
 Maximum allowed DDS offset setting.
 

Detailed Description

Containing different defines for device configuration.

Date
17.12.2020 19:47:56
Author
Markus Scheich

Macro Definition Documentation

◆ DDS_TICK_FREQ

#define DDS_TICK_FREQ   15625

Frequency at which the phase accumulator is updated.

Choose a value here that delivers an integer value for the OCR2A register ( ((F_CPU / 1024) / DDS_TICK_FREQ) should be an integer value ) !!!

◆ DEVICE_TIMER_TICK_INTERVAL_MS

#define DEVICE_TIMER_TICK_INTERVAL_MS   100

Tick interval of the DeviceTimer in ms.

The DeviceTimer is used to e.g. periodically read the keys and the encoder.

◆ KEY_POLLING_DELAY_MS

#define KEY_POLLING_DELAY_MS   250

Time period for key polling (keys and encoder button).

This must be higher than the DeviceTimer tick interval because it's derived from this device timer.

◆ POWER_SUPPLY_REG_INTERVAL_MS

#define POWER_SUPPLY_REG_INTERVAL_MS   100

Time period for power supply regulation.

This must be higher than the DeviceTimer tick interval because it's derived from this device timer.

◆ SCPI_ERROR_QUEUE_SIZE

#define SCPI_ERROR_QUEUE_SIZE   3

Maximum number of errors in the error queue.

If this queue overflows, the last error message will be replaced by an overflow error message.

◆ SCPI_IDN_MANUFACTURER

#define SCPI_IDN_MANUFACTURER   "Markus Scheich"

Manufacturer info used in *IDN?

query

◆ SCPI_IDN_MODEL

#define SCPI_IDN_MODEL   "PS_Fgen"

Model info used in *IDN?

query

◆ SCPI_IDN_SERIAL_NUMBER

#define SCPI_IDN_SERIAL_NUMBER   "01"

Serial number used in *IDN?

query

◆ SCPI_IDN_SOFTWARE_REVISION

#define SCPI_IDN_SOFTWARE_REVISION   VERSION

Software version used in *IDN?

query

◆ SCPI_INPUT_BUFFER_LENGTH

#define SCPI_INPUT_BUFFER_LENGTH   16

Length of the SCPI input buffer.

If this buffer overflows, there will be an error message.

◆ SCREEN_REDRAW_DELAY_MS

#define SCREEN_REDRAW_DELAY_MS   500

Time period for screen redraw.

This must be higher than the DeviceTimer tick interval because it's derived from this device timer.

◆ SERIAL_BAUDRATE

#define SERIAL_BAUDRATE   9600

Serial baud rate used for the serial input (SCPI, debug output).

This could be e.g. one of the following values: 4800, 9600, 19200, 38400, 57600

◆ TOUCH_HANDLING_DELAY_MS

#define TOUCH_HANDLING_DELAY_MS   300

Time period for touch screen polling.

This must be higher than the DeviceTimer tick interval because it's derived from this device timer.