Showing posts with label PIC-18f25k20. Show all posts
Showing posts with label PIC-18f25k20. Show all posts

Wednesday, May 25, 2011

Custom Interface Design

For the last three months I have been designing a custom interface for the auditory lab at Carnegie Mellon University. I built an array of infrared sensors and interfaced them to MATLAB using PIC18f25k20 and other proprietary hardware. The chassis was put together by Guilliaume Lemaitre and Nicolas Zuniga from the auditory lab. The goal of this project is to measure motor response time to auditory stimulation. 

Below are photos of the setup and circuits. The sensor unit shown below is a part of this circuit. The infrared LED driver portion can be seen on the cpu board. They were separated to minimize sensor size. The cpu board accepts up to 4 sensors: one IR long distance (5cm) sensor and three IR (1cm) sensors. The 5cm sensor is used to detect vertical movement and the 1cm units detect if and object is above it. The IR sensors used to be contact switches, but they had to be replaced because it contaminated the auditory stimuli.




Wednesday, April 6, 2011

LCD bug fixed

I have finally fixed the accuracy of my LCD code. Previously, my code contained many bugs, which essentially made the LCD unreliable. In fact, it was reliably dropping characters and ignoring commands. From the beginning, I had made sure that that I obeyed the timing diagram. However, I had completely forgotten to refer to the execution times listed by the instruction summary in the LCD driver datasheet. This means that I was sending instructions before the previous one completed.

I have finally implemented the proper delays allowing the commands to complete. Later, I use the busy flag or interrupt based display queue instead. 

Saturday, May 29, 2010

Making the LCD setup permanent

I soldered everthing from the previous post.
The pickit 2 plugs into the 5 pin header and my UART cable plugs into the 4 pin header. The blue terminal block is for 5V and ground.

Monday, September 28, 2009

Infrared improved


This time I improved my infrared project to read the full infrared signal. All of the programming has been done using microchip's C18 compiler.

My new method of approach, as compared to my previous one, is to measure the duration of the pulses being recieved by the sensor instead of sampling at specific times.

In addition, this setup sends the data it received accross UART to the computer.

Here are the program files: main.c myLCD.c my LCD.h









Thursday, August 6, 2009

Using a character lcd

With weeks of debugging and help from my friend I finally got my Character LCD to work. Below is a video of a simple counter.



Here is the code in C18 : lcd_counter.c

RA1: Read/Write
RA2: Enable
RA7: Register Select
RB0~7 was hooked up to DB0~7

Looking back at how much work I actually did, making the LCD work wasn't too bad. Most of the bugs that I ran into were really silly (like pins burning out).

I will put up a tutorial on my website on how to set the LCD up. Here is the link: LCD.

Monday, July 6, 2009

PIC UART on 18f25k20

Due to my current job taking up all my time, I've had no time to work on my personal projects lately. However, I made use of my first 3-day Independence day weekend and figured out how to get serial UART working!

The truth is I couldn't figure out how to work the RS232 to USB stuff. So, I decided to take it slowly and try to figure out how to do UART first!

Here is the code: uart_practise.c

Although this was compiled using the C18 compiler, it can easily be modified to fit HI-TECH's PICC.

You will need some sort of terminal program to see the UART output. Also, if you don't have a serial port on your computer (as most people don't) you need a USB-Serial cable. Once you have everything hardware set up you need to set up the serial port as follows.
  • Baud rate: 9600 bits/s
  • Data bits: 8
  • Parity: None
  • Stop bits: 1
  • Flow Control: None
For more detailed directions and a circuit diagram visit: www.renomania.org/projects/uart.html