# mikroC PRO for PIC

<figure><img src="/files/CdIg4q4dmk0e2fNp081H" alt="" width="157"><figcaption></figcaption></figure>

## Configuración de bootloader

{% hint style="warning" %}
Esta configuración solo es compatible para los **PIC18F4550** y **PIC18F45K50**.
{% endhint %}

Para utilizar un **PIC18F4550/45K50** precargado con **Bootloader Microside** es <mark style="background-color:red;">**indispensable**</mark> colocar la siguiente línea de código en el encabezado del programa:

{% code fullWidth="true" %}

```c

#pragma orgall 0x1FFF   // Espacio reservado para bootloader

```

{% endcode %}

Posteriormente colocar <mark style="background-color:orange;">**`org 0x2000`**</mark> después o en la misma línea que la función main, como a continuación:

{% code overflow="wrap" fullWidth="true" %}

```c
#pragma orgall 0x1FFF   // Espacio reservado para bootloader

void main()
org 0x2000  // Se especifica el segmento a partir de cual se almacenara el programa
{
    ...Código
}
```

{% endcode %}

{% code overflow="wrap" fullWidth="true" %}

```c
#pragma orgall 0x1FFF   // Espacio reservado para bootloader

void main() org 0x2000  // Se especifica el segmento a partir de cual se almacenara el programa
{
    ...Código
}
```

{% endcode %}

Después, dirígete al menú superior del compilador y da clic en ***Tools y Options**.*

<figure><img src="/files/vmZFil9X42pa4fManm0j" alt="" width="563"><figcaption></figcaption></figure>

Ve al apartado ***Output Settings***, marca la casilla ***"Long HEX format***" y da clic en ***Apply***.

<figure><img src="/files/S3SLn1ZXDPweOz6teuEs" alt="" width="563"><figcaption></figcaption></figure>

Por último, dirígete a ***Project*** > ***Edit Project*** y coloca ***48.000000*** en la casilla de ***"MCU Clock Frequency \[MHz]".***

<figure><img src="/files/5qsDEz4zoZtNO715E2pY" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/xp8G72V2DWp1uy3YbhTR" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
Realiza dicha configuración **antes** de intentar cargar el programa, de lo contrario el Software X-TRAINER Suite podría presentar errores.
{% endhint %}

{% hint style="success" %}
Todas nuestras prácticas para **PIC18F4550/45K50** en **mikroC PRO for PIC** ya están configuradas para su uso con **Bootloader Microside**.
{% endhint %}

### Ejemplo:

{% code overflow="wrap" lineNumbers="true" %}

```c
#pragma orgall 0x1FFF   // Espacio reservado para bootloader

#define LED LATA4_bit   

void main() org 0x2000  // Se especifica el segmento a partir de cual se almacenara el programa

{
   LATA4_bit = 0;       
   TRISA4_bit = 0;      

   while ( 1 ) {
      LED = 1;          
      Delay_ms( 1000 ); 
      LED = 0;          
      Delay_ms( 1000 ); 
   }
}
```

{% endcode %}


---

# Agent Instructions: 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:

```
GET https://docs.microside.com/tarjetas-de-desarrollo-pics/software-x-trainer-suite/configuracion-de-bootloader/mikroc-pro-for-pic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
