Introduction

Back | Up | Next

Communication using the USB to TTL cable is very simple, In this tutorial we are going to create and embedded system that converts all text to upper case.  All characters that are sent to the microcontroller are sent back to the PC.  If the character is in the range 'a'  to 'z' then these are sent back as 'A' to 'Z'.

The entire program written in 'C' using the CCS compiler is shown below...
 
#include "16F627A.h"

#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B2,rcv=PIN_B1,bits=8, stream=PC)

void main(void){
    while(1)
    {
        //get next char, convert to upper case and send back
        putc(toupper(getc())); 
    }
}

The CCS compiler contains functions to setup and configure the PIC's USART (Universal Synchronous-Asynchronous Receiver/Transmitter), It also has built in functions to receive, transmit and even change character cases.  We will look at each of these steps in turn without using built in functions so that we get an understanding of what is going on.

Microchip supply an Integrated Development Environment (IDE) for the PIC microcontroller absolutely free (MPLAB).  This also includes an Assembler. 

The software examples are coded in C in this tutorial, and although C Compilers for the PIC are generally very expensive the HI-TECH compiler is completely free for some of the popular PIC types.  Most C compilers integrate into the Microchip IDE.

The Example code is provided for this tutorial requires MPLAB and the HI-TECH compiler.  It is outside the scope of this tutorial to step through the installation of this software. 

 

Send mail to webmaster@avitresearch.co.uk with questions or comments about this web site.
Copyright © 2007 AVIT Research Ltd
Last modified: 10/02/07