---
name: "hal_param_new"
section: "3hal"
platform: "linux"
package: "linuxcnc-uspace-dev"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/hal_param_new"
---

# hal\_param\_new(3hal)

creates a HAL parameter

## NAME

hal\_param\_new - creates a HAL parameter

## SYNTAX

 int hal\_param\_bit\_new(const char \**name*, hal\_param\_dir\_t *dir*, hal\_bit\_t \* *data\_addr*, int *comp\_id*)

 int hal\_param\_float\_new(const char \**name*, hal\_param\_dir\_t *dir*, hal\_float\_t \* *data\_addr*, int *comp\_id*)

 int hal\_param\_u32\_new(const char \**name*, hal\_param\_dir\_t *dir*, hal\_u32\_t \* *data\_addr*, int *comp\_id*)

 int hal\_param\_s32\_new(const char \**name*, hal\_param\_dir\_t *dir*, hal\_s32\_t \* *data\_addr*, int *comp\_id*)

 int hal\_param\_bit\_newf(hal\_param\_dir\_t *dir*, hal\_bit\_t \* *data\_addr*, int *comp\_id*, const char \**fmt*, *...*)

 int hal\_param\_float\_newf(hal\_param\_dir\_t *dir*, hal\_float\_t \* *data\_addr*, int *comp\_id*, const char \**fmt*, *...*)

 int hal\_param\_u32\_newf(hal\_param\_dir\_t *dir*, hal\_u32\_t \* *data\_addr*, int *comp\_id*, const char \**fmt*, *...*)

 int hal\_param\_s32\_newf(hal\_param\_dir\_t *dir*, hal\_s32\_t \* *data\_addr*, int *comp\_id*, const char \**fmt*, *...*)

 int hal\_param\_new(const char \**name*, hal\_type\_t *type*, hal\_param\_dir\_t *dir*, void \**data\_addr*, int *comp\_id*)

## ARGUMENTS

- *name*

  The name to give to the created parameter

- *dir*

  The direction of the parameter, from the viewpoint of the component.  It may be one of **HAL\_RO**, or **HAL\_RW** A component may assign a value to any parameter, but other programs (such as halcmd) may only assign a value to a parameter that is **HAL\_RW**.

- *data\_addr*

  The address of the data, which must lie within memory allocated by **hal\_malloc**.

- *comp\_id*

  A HAL component identifier returned by an earlier call to **hal\_init**.

- *fmt, ...*

  A printf-style format string and arguments

- *type*

  The type of the parameter, as specified in **[hal\_type\_t(3hal)](/hal_type_t/3hal.md)**.

## DESCRIPTION

The **hal\_param\_new** family of functions create a new *param* object.

There are functions for each of the data types that the HAL supports.  Pins may only be linked to signals of the same type.

## RETURN VALUE

Returns a HAL status code.

## SEE ALSO

**[hal\_type\_t(3hal)](/hal_type_t/3hal.md)**
