Learning Serial Communication

This morning I decided its about time I learnt how to use the UART hardware in most PIC microcontrollers. I started off with a USB-RS-232 converter that I got for US$3 from DealExtreme. There are a few reasons why I used a converter, firstly being because my main PC no longer has an RS-232 port since its old tech, but also because I thought it’d be alot neater for my projects to have a USB connection and it means I can interface with TTL signal levels (0-5v) instead of the RS-232 standards -12v – +12v which would have added complications, but we’ll get back to that just now…

DealExtreme USB-Serial connectors

The USB-Serial adapter from Dealextreme, the Bottom one has been modded to remove the DB9 connector and the MAX211 IC as well as adding connections to the TTL TX, RX and Gnd

(sorry about the pics again, using my phone, camera isn’t back yet ๐Ÿ˜› )

I Started by removing the MAX211 IC which takes the PL-2303 (the usb-serial IC) TTL level signals and converts them to -12v – 12v and vice versa. Since we will be interfacing with a TTL level part, the 16F88, this is no longer needed. I also removed the DB9 connector because it was getting in the way and I’m not going to use it anyway ๐Ÿ˜› Also added wires to the TXD, RXD and Gnd pads so I can connect it to my breadboard ๐Ÿ™‚

Next I connected TX and RX together for a loop-back test to make sure everything is still working:

USB-Serial in PC

Loopback test

Everything seems to be working well! So onto the microcontroller side of things..

I’m currently using MPLAB and the Hi-Tech C compiler after recently teaching myself C for microcontrollers (this is another complicated topic without many easy beginner tutorials, you just sorta have to jump and and google your way to success! perhaps one-day I’ll write a post about it… ๐Ÿ˜‰ ) and an ICD2 to program. Luckily in the Hi-Tech samples folder there is a USART example! this made life alot easier… here it is:

usart example

A nice simple sample program to echo the users keypress’s

I quickly burnt it onto the 16F88, connected the usb-serial dongle and fired up the Termite, pressed some keys and couldn’t believe my luck! ๐Ÿ˜€

USART test

Bi-directional serial communication with my PIC 16F88!!! I thought this would be really difficult but it turned out to be easier than expected ๐Ÿ™‚

What are the next steps? We’ll I recently completed a simple automated irrigation system for my vegitable patch, which I’ll document soon in another post, and I would like to have it communicating with a small C# app on my server PC that will have a web interface such that I can set watering times and dates ๐Ÿ™‚ I have some other project ideas I’d like to try out aswell like servo controlled blinds and an automated coffee machine ๐Ÿ˜€ ๐Ÿ˜›

Hope you enjoyed my ramblings! until next time ๐Ÿ˜‰

~Rob.


Posted

in

by

Tags:

Comments

5 responses to “Learning Serial Communication”

  1. notrequired Avatar
    notrequired

    good job thanks for sharing.

  2. Martin Avatar

    Hello. I’ve made the same hack like you year ago whit exactly the same DXtreme part and I was asking myself if I can cut the second part of the PCB. Don’t you wanna try it first? ๐Ÿ™‚

    1. RobThePyro Avatar

      Hi! I was thinking just that the other day! I’ll give it a try this weekend and see if it can be done! thanks for the comment ๐Ÿ˜‰

  3. […] It to a PC of course! since I recently learnt serial communication between a PC and a PIC I decided to create an nice monitoring system for the garden that sends data […]

  4. […] Serial Communication – [Link] Tags: Communication, Microcontroller, PIC, RS-232, Serial, TTL, UART, USB, USB-RS-232 Filed in […]

Leave a Reply to Electronics-Lab.com Blog » Blog Archive » Learning Serial Communication Cancel reply

Your email address will not be published. Required fields are marked *