Tools->USBLab->Software->Microcontroller

There are two pieces of software insalled in the microcontroller of the USBLab can be organized in 4 big groups : the bootloading firmware that allows to re-program the USBLab when required from a PC connected to the USBLab through the USB port, and the user program that configurates the USBLab to perform the required tasks and that can be programmed using the template-projects and library functions provided for the USBLab. The relationships among these pieces of sofware andthe pieces of software in the PC are schematized in the following figure. The characteristics of each piece of sotware is shortly described next.

Software schema

Bootloading firmware

The bootloading firmware is the piece of software installed in the microcontroller to be able to download the user program from the PC through the USB port. Therefore, it facilitates the re-programming of the USBLab when required from any PC equipped with a USB port. However, this piece of software has to be installed using a special programmer developed by the user or by Microchip the first time the PIC18F4550 is programmed.

The bootloading firmware has been developed adapting the bootloading firmware provided by Microchip for its PICDEMBoard, taking into account the USBLab connections. Therefore, the bootloading firmware provided by Microchip can not be directly used in the USBLab.

Microcontroller user program

In order to speed up the development of user programs for the USBLab, we provide several types of template-projects where the user has to incorporate the functionality he/she requires for his/her particular application, and a libraty with multiple functions to connect/monitorize/control different types of commonly used peripherals, which can be incorporated in the template-project directly.

The way of procceeding is the following. To develop a new program, users only have to choose the better template-project for their applications and include some of the functios of the library. When required, the user also have to develop its own functionality and include it in the template-projects.

Template projects

The following template projects, which have been developed using different examples provided by Microchip, permit to configurate the USBLab to work as a monitorizer/controller under different connection modes. The user should select the best for its application, compile it and donwloaded using the bootloader installed in the PC. The existing projects are:

Stand-alone project: This template project is developed to let the USBLab work by itself, unplugged to the PC and only connected to those elements that are being monitorize/control by the USBLab.

USBLab project: This template project is developed to let the USBLab communicate with a Windows PC using the USB port to be able to respond to the PC monitorizing/controlling requests.

Radio server & client project: These two template projects are developed to let the USBLabs communicate with a Windows PC via radio, using a USBLab programmed with the server-project and connected to the PC via the USB port to exchange radio signals with one or several remote USBLabs programmed with client-projects. On one hand, The USBLab server is usually only in charge of sending/receiving the signals from/to the PC to/from the remote USBLab servers, and therefore, the server-template project does not usually has to include any extra functionality. On the other, the USBLab clients monitorize/control the remote systems using the functionality included by the user in the client projects. It is worth noting that the client-project functionality also permits the communication between several USBLab clients directly.

Serial & Bluetooth project: This template project is developed to let the USBLab communicate with a Windows PC using either the serial or bluetooth port to be able to respond to the PC monitorizing/controlling requests.

I2C project: This template project is developed to let the USBLab work as an I2C slave that responds to an I2C master monitorizing/controlling requests.

Library functions

In order to speed up the software development, we also provide several functions that implement the required functionality to monitorize/control the signals of commonly used systems. Grouping the functions according with the type of signals under monitorizing/control, we can distinguish:

Analog functions: These functions are used to read or generate analog signals using the analog A/D converters of the microncontroller and the D/A controller in the USBLab.

DC Motors: These functions are used to generate the PWM signals used to control a DC motor. We provide two groups of functions : the first to control a single DC motor using the PWM module of the PIC18F4550, and the second to control two DC motors, using PWM signals directly generated by the code in the functios.

Step Motors: These functions are used to generate the signals used to control a step motor.

Servo Motors: These functions are used to generate the signals used to control up to 4 servo motors motor.

I2C: These functions are used to communicate the USBLab, acting as an I2C master, with another dispositive, acting as a I2C slave.

SPI: These functions are used to communicate the USBLab, acting as an SPI master, with another dispositive, acting as a SPI slave.

UART: These functions are used to communicate the USBLab with other dispositive using the serial UART port.

Round buffer: These functions are used to implement in the microcontroller and control the access to a round buffer to store the required data for the application.

Soft timed tasks: These funcitons are used to implement the timing functionality required to make the USBLab microcontroller perform periodic tasks.