> For the complete documentation index, see [llms.txt](https://docs.microside.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.microside.com/practicas/mplab-x-ide/mpasm-compiler/pic18f4550-or-pic18f45k50/3-corrimiento-de-bits.md).

# 3 - Corrimiento de Bits

> **MPLAB X IDE - PIC Assembler**
>
> [**PIC18F4550 / PIC18F45K50**](https://docs.microside.com/practicas/mplab-x-ide/mpasm-compiler/pic18f4550-or-pic18f45k50)

<figure><img src="/files/dpJJBWIL7kXLfSGrbqLe" alt=""><figcaption></figcaption></figure>

## **Introducción**

En esta práctica se implementa un corrimiento de bits, el cual se despliega a través de LEDs.

## **Descripción**

En esta práctica se implementa un corrimiento de bits usando la tarjeta **X-TRAINER** con el **PIC18F4550/PIC18F45K50**. Para visualizar el resultado se conectan 8 LEDs al puerto B de la tarjeta **X-TRAINER.**

**Materiales:**

1 x Tarjeta **X-TRAINER**. [**Manuales**](https://docs.microside.com/tarjetas-de-desarrollo/x-trainer) | [**Comprar**](https://www.microside.com/shop/category/entrenadores-pic-1)

8 x Resistencias 220 ohms.

8 x LEDs.

1 x Protoboard de 830 puntos.

1 x Juego de cables Dupont.

1 x Cable micro USB.

**Software:**

Windows 8.1 o posterior.

MPLAB X IDE v5.35. [**Descarga**](https://www.microchip.com/en-us/tools-resources/archives/mplab-ecosystem)

X-TRAINER Suite v1.0 [**Descarga**](https://raw.githubusercontent.com/MICROSIDE-TECHNOLOGY/microside_download_archive/main/Tools/X-TRAINER%20Suite/X-TRAINER%20Suite%20Setup.zip)

{% hint style="warning" %}
**Nota**: Asegúrate de instalar la versión de **MPLAB X IDE** antes mencionada, de lo contrario es posible que surjan errores.
{% endhint %}

## **Procedimiento**

**1.** En el apartado de “[**Diagrama Esquemático**](#diagrama-esquematico)” selecciona el modelo de tu tarjeta, realiza las conexiones que se muestran en la imagen y conéctala a la computadora.

{% hint style="info" %}
Las conexiones mostradas en los diagramas esquemáticos son las mismas ya sea que la tarjeta **X-TRAINER** posea el **PIC18F4550** o el **PIC18F45K50**.
{% endhint %}

**2.** Ejecuta **MPLAB X IDE** y crea un nuevo proyecto con el código fuente que se encuentra en el apartado "[**Código**](#codigo)".

**3.** Compila el proyecto

{% hint style="success" %}
Para compilar el proyecto dirígete a la barra de herramientas superior y da clic en el icono señalado.
{% endhint %}

<figure><img src="/files/IQtyn5WSmgCY6PjrDRvd" alt=""><figcaption></figcaption></figure>

**4.** Abre el **Software X-TRAINER Suite v1.0** en el apartado **PIC18F4550/45K50**, selecciona el archivo .hex generado al compilar el proyecto y programa la tarjeta.

{% hint style="success" %}
Si tienes dudas de cómo realizar los pasos anteriores puedes encontrar un manual del **Software X-TRAINER Suite v1.0**. a través del siguiente[ **link**](https://docs.microside.com/tarjetas-de-desarrollo/software-x-trainer-suite).
{% endhint %}

**5.** Al terminar de programar, la tarjeta **X-TRAINER** se reiniciará automáticamente y se ejecutará el programa de esta práctica.

## **Diagrama esquemático**

Selecciona el modelo de tu tarjeta **X-TRAINER.**

{% tabs %}
{% tab title="LITE M R2" %}

<figure><img src="https://raw.githubusercontent.com/MICROSIDE-TECHNOLOGY/3-Bit-shift-MPASM-PIC18F4550-45K50/main/Diagrama%20de%20conexión/ENTRENADOR%20X-TRAINER%20LITE%20M%20PIC18F45K50%20PIC18F4550%20CORRIMIENTO%20DE%20BITS%20MICROSIDE.png" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="LITE M R3" %}

<figure><img src="/files/BY8gVQKpp3n2K6Op2EP1" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="LITE F" %}

<figure><img src="https://raw.githubusercontent.com/MICROSIDE-TECHNOLOGY/3-Bit-shift-MPASM-PIC18F4550-45K50/main/Diagrama%20de%20conexión/ENTRENADOR%20X-TRAINER%20LITE%20F%20PIC18F45K50%20PIC18F4550%20CORRIMIENTO%20DE%20BITS%20MICROSIDE.png" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="DIP" %}

<figure><img src="https://raw.githubusercontent.com/MICROSIDE-TECHNOLOGY/3-Bit-shift-MPASM-PIC18F4550-45K50/main/Diagrama%20de%20conexión/ENTRENADOR%20X-TRAINER%20DIP%20PIC18F45K50%20PIC18F4550%20CORRIMIENTO%20DE%20BITS%20MICROSIDE.png" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="DIP R3" %}

<figure><img src="/files/nyL59k05DC4wcE3nh7wM" alt=""><figcaption></figcaption></figure>

{% endtab %}

{% tab title="PRO R2" %}

<figure><img src="https://raw.githubusercontent.com/MICROSIDE-TECHNOLOGY/3-Bit-shift-MPASM-PIC18F4550-45K50/main/Diagrama%20de%20conexión/ENTRENADOR%20X-TRAINER%20PRO%20PIC18F45K50%20PIC18F4550%20CORRIMIENTO%20DE%20BITS%20MICROSIDE.png" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="PRO R3" %}

<figure><img src="/files/vU0pQWWcnQ6uzuBWxbr6" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="PRO  R4" %}

<figure><img src="/files/RPoi2s7NKReekyGeSon5" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## **Código**

{% tabs %}
{% tab title="PIC18F4550" %}
{% embed url="<https://gist.github.com/microside-mx/68613061a2c37611b235c63a43954f91>" %}
{% endtab %}

{% tab title="PIC18F45K50" %}
{% embed url="<https://gist.github.com/microside-mx/d55b01182166dcce48cd37303ae3dbef>" %}
{% endtab %}
{% endtabs %}

## **Descargas**

<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><mark style="color:green;"><strong>Software X-TRAINER Suite v1.0</strong></mark></td><td><a href="https://raw.githubusercontent.com/MICROSIDE-TECHNOLOGY/microside_download_archive/main/Tools/X-TRAINER%20Suite/X-TRAINER%20Suite%20Setup.zip">https://raw.githubusercontent.com/MICROSIDE-TECHNOLOGY/microside_download_archive/main/Tools/X-TRAINER%20Suite/X-TRAINER%20Suite%20Setup.zip</a></td></tr><tr><td align="center"><mark style="color:green;"><strong>Proyecto</strong></mark></td><td><a href="https://github.com/MICROSIDE-TECHNOLOGY/3-Bit-shift-MPASM-PIC18F4550-45K50/archive/refs/heads/main.zip">https://github.com/MICROSIDE-TECHNOLOGY/3-Bit-shift-MPASM-PIC18F4550-45K50/archive/refs/heads/main.zip</a></td></tr></tbody></table>
