> For the complete documentation index, see [llms.txt](https://sdk.twelite.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sdk.twelite.info/en/twelite-net-api-ref/twelite-net-guan-shu/toconet_u16rccalib.md).

# ToCoNet\_u16RcCalib()

## Explanation <a href="#jie" id="jie"></a>

Calibrate the RC timer.

* Performing a calibration
* Getting calibration values
* Setting the calibration values

{% hint style="info" %}
You can also use `ToCoNet_u16GetRcCalib()` to get the calibration values.
{% endhint %}

### Use of external oscillator at 32768Hz

No calibration is required and a fixed value of 9766 (32000/32768) counts is specified. Use [`cbAppColdStart()`](/en/twelite-net-api-ref/krubakku/cbappcoldstart.md) as shown in the following example.

```c
// Only valid for TWENET library 1.2.0 and later
void cbAppColdStart(bool_t bAfterAhiInit)
{
	if (!bAfterAhiInit) {
		ToCoNet_REG_MOD_ALL();
	} else {
		ToCoNet_Event_Register_State_Machine(vProcessEvCore);
		...
		// Omit calibration at system start-up
		sToCoNet_AppContext.bSkipBootCalib = TRUE;
		// Setting fixed values (v1.2 and later)
		ToCoNet_u16RcCalib(9766);
	}
}

void vProcessEvCore(
        tsEvent *pEv,
        teEvent eEvent,
        uint32 u32evarg) {
        
     if (eEvent == E_EVENT_START_UP) { //At system start-up
     	// Setting of fixed values
 	ToCoNet_u16RcCalib(9766);
     }
 }

```

## Argument <a href="#yin-shu" id="yin-shu"></a>

| Type      | Name      | Value        | Remark                                                                                   |
| --------- | --------- | ------------ | ---------------------------------------------------------------------------------------- |
| ​`uint16` | `​u16val` | `0`          | Calibration is carried out. Calibration takes less than 1 ms, but some time is required. |
|           |           | `5000-15000` | Sets the calibration value.                                                              |
|           |           | `0xFFFF`     | Retrieves the set value.                                                                 |

## Returns <a href="#ri" id="ri"></a>

| Type      | Remark                                                                                           |
| --------- | ------------------------------------------------------------------------------------------------ |
| `​uint16` | If the argument `u16val == 0xFFFF`, the current setting value is returned. Otherwise undefined.​ |

## Sample Code

```c
vfPrintf(&sSerStream, "RC Calib = %d"LB,  ToCoNet_u16GetRcCalib());
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sdk.twelite.info/en/twelite-net-api-ref/twelite-net-guan-shu/toconet_u16rccalib.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
