Archive for the ‘Code’ Category

Bluetooth Serial Port Controller and Wireless UART Cable Replacement Module

Saturday, June 21st, 2008

I have created a DIP module to connect wirelessly via Bluetooth devices using the serial port. It can be a PC to a Bluetooth cellular phone or a microcontroller to a remote robot. Aside from that it can also be used as a remote I/O controller that can be interfaced with a relay board or solid state relays to operate wirelessly. The module’s description, sample projects using it and specifications are found here.

Using Nokia 3310 LCD as Display for PIC Projects

Monday, February 25th, 2008

Parts for older Nokia phones are very cheap and readily available nowadays. I have been toying around Nokia 3310 LCD and used it for some of my projects as display. I have created C routines to use them easily and want to share it to everyone. The files are lcd3310.c and lcd3310.h. The LCD pinout, when looking at the back with the connectors on top starting from left to right, are VDD, CLK, DATA, D/C, CE, GND, VOUT and RESET.

Baby Steps in PHP

Tuesday, January 15th, 2008

Whew! Two articles in a today. This is the second one I wrote today. But I won’t feel bad. This is a new tutorial, Baby Steps in PHP. This is for beginners and newbies and want to learn how to program in PHP

Interrupt Driven Serial Routines with Circular FIFO for PIC Micro

Saturday, December 29th, 2007

This is another routine that I want to share. This is the Interrupt Driven Serial Routines with Circular FIFO for PIC Micro. This routine uses the PIC’s hardware USART. Since this is unbuffered, so I added a software FIFO. The FIFO management is quite lean and fast but required the size of the buffer to be power of 2 (2^x). This is because FIFO roll-over uses bit-wise AND of (buffer_size - 1). This reduces code size due to that no more conditionals to test pointers overflowing the buffer.

Noise Cancelling DSP Algorithm using SCILAB

Friday, December 28th, 2007

Noise Cancelling DSP Algorithm using SCILAB Output GraphMost engineers/geeks should already know about MATLAB. It used for numerical analysis and processing. Poor Cebuano geeks, like me, cannot afford for a legal license to use it. I am into DSP (Digital Signal Processing) and I need it to test my algorithms first before burning it into the actual hardware to shorten the debug-cycle time. So I have choosen SCILAB, a free open-source MATLAB alternative. There are other alternatives such as OCTAVE but only works in CYGWIN or LINUX. I settle for SCILAB because I like its editor and GUI viewer. I am already proficient in MATLAB so moving to SCILAB is a breeze. SCILAB has few quirks but a quick google solved these.

So, I have developed this Noise Cancelling DSP Algorithm using SCILAB. This algorithm was used on a DSP add-on to a CSR BC3 Multimedia Bluetooth Processor for handsfree car kit application. This uses spectral subtraction to cancel the noise.

The process starts by getting 256 samples of the input signal and overlapping every 64 samples at a time. This is about 31ms for 8000 kHz sampling. The samples are then passed through a Hanning Window to …

Read more…

GPS Car Speed and Position Logger / Monitor

Thursday, December 27th, 2007

Olimex LPC2148 Board with GPS receiverThe GPS Car Sped and Position Logger/Monitor is a full featured project that is based on NXP/Philips LPC-2148 ARM7 processor. I had to quickly make this for my land trip from Cebu to Bacolod and back last December of 2006.

I used a ready made hardware, the Olimex LPC2148 PCB, that was available at that moment. The board is then wired to a GPS receiver with the 3V supply and the GPS TX pin connected to one of the ARMs serial port.

The software is using a ported FreeRTOS for LPC2148 as its real-time operating system. And incorporates ChanFS file system for log data storage to a FAT16 formatted SD/MMC card.
It also includes code from LPCUSB and has a USB serial port emulation when plugged to the computer to monitor NMEA sentences on the PC. Aside from that, it can be booted up as a USB mass storage device to retrieve the logs without removing the SD/MMC card from the board’s slot.

The code can be compiled using WinArm GCC.

Tiny Threads - Tiny Multitasking Threads for Microcontrollers

Thursday, December 27th, 2007

For the efficiency and performance conscious C programmers, here is my tiny cooperative multitasking engine.

This was made for PIC16F micros that has a very small available flash for code and ram/memory. But this can be used also for other processors because I tried to make it ANSI compliant. For the PIC16F processor, this uses only 1 byte RAM needed per thread and compiles to a very small overhead context switching.

My PIC Microcontroller Code Snippets Page

Thursday, December 27th, 2007

These code snippets are for PIC Microcontroller (PIC16F Family) that I have posted in the PICLIST mailing list over many year. I have only compiled few of my posts. They are located/downloaded here. Please free to use them on your embedded projects.