Showing posts with label PIC16F887. Show all posts
Showing posts with label PIC16F887. Show all posts

Tuesday, August 4, 2009

Small LED dot matrix development board

I was very busy for the past two months so this blog just didn't move. As you may know, the LED dot matrix display is my favorite device. I have designed a small development board for testing my led dot matrix related programs.
The schematic is as the following:
LED dot matrix development board Schematic

The PCB is single sided so I can make it at home. Most of the components are SMD to keep small footprint of the board. The PCB size: 58.4mm x 46mm
LED dot matrix development board PCB

Acutally, I made a PCB and installed all components but the board didn't work :p. It was working when I tested the schematic on breadboard (with through hole version of PIC16F887). I think the SMD PIC16F887 may be broken or the PCB is bad but I just don't have time to figure out the problem. I will try new PCB and PIC16F887.

Saturday, October 18, 2008

ICSP: In-Circuit Serial Programming is great

At the beginning of my PIC journey, when I want to program *.hex file to my PIC microcontroller, I have to remove the PIC from the circuit board and place it on my PIC programmer to program the *.hex file to it and then I remove it from the programmer and put the PIC back to the circuit board. If I want to re-program the PIC, I have to repeat the process again. This process is very painful and it can cause PIC's pins broken.

Soon after I did a lot of that painful processes, I have discovered that my PIC programmer supports ICSP.

ICSP : In Circuit Serial Programming is very useful when I want to program *.hex file to PIC microcontroller while the PIC is on the circuit board. I just plug the ICSP plug to the ICSP jack on the circuit board. The ICSP jack for PIC microcontroller has a circuit like picture below. Now, I put ICSP jack to all of my PIC projects and I can easily upgade their firmware.
ICSP: In-Circuit Serial Prgramming

Wednesday, August 13, 2008

DS1307 : Setting Time

There is a question from charlie about how to set time in DS1307 . The code here shows how to write time to DS1307. My C compiler is MikroC 8.0.
void write_ds1307(unsigned short address,unsigned short w_data)
{
I2C_Start(); // issue I2C start signal
//address 0x68 followed by direction bit (0 for write, 1 for read) 0x68 followed by 0 --> 0xD0
I2C_Wr(0xD0); // send byte via I2C (device address + W)
I2C_Wr(address); // send byte (address of DS1307 location)
I2C_Wr(w_data); // send data (data to be written)
I2C_Stop(); // issue I2C stop signal
}

//Set Time
write_ds1307(0,0x80); //Reset second to 0 sec. and stop Oscillator
write_ds1307(1,0x27); //write min 27
write_ds1307(2,0x14); //write hour 14
write_ds1307(3,0x02); //write day of week 2:Monday
write_ds1307(4,0x17); // write date 17
write_ds1307(5,0x06); // write month 6 June
write_ds1307(6,0x08); // write year 8 --> 2008
write_ds1307(7,0x10); //SQWE output at 1 Hz
write_ds1307(0,0x00); //Reset second to 0 sec. and start Oscillator



It is your task to incorporate the code with buttons for setting time. I have written code for taking care of the buttons but there are some bugs so I cannot show it now.

Tuesday, July 29, 2008

Note for PIC16F887

From now on, my projects will be using PIC16F887 as the default microcontroller. As it is cheaper than the PIC16F877A and of course, it's newer.
Here, I'd like to document some configurations of the PIC16F887 for simple projects that don't relate to A/D conversion: (I'm no expert but the settings here are working for me)
- ANSEL = 0x00; // Make Digital I/O for PORTA (default is analog I/O), this is a must for input buttons, keys or whatever digital input/output
- ANSELH = 0x00; // Make Digital I/O for PORTB, this is a must otherwise the behavior of the ports will be unexpectable
- OSCCON = 0x75; // 8MHz Internal Oscillator , consumes more power
Or
- OSCCON = 0x65; // 4MHz Internal Oscillator , consumes less power

Timer1 Module Settings
- T1CON = 0x8F; // TMR1 Prescaler 1:1 external clock
- INTCON = 0xC0; // Set GIE, PEIE
- TMR1H = 0x80;
- TMR1L = 0x00;
- Delay_ms(10); // Delay for setting up TMR1
- PIE1.TMR1IE = 1; // enable interupt

Note: Microcontroller Devices are very sensitive to noise. Ground Plane and Noise Decoupling capacitor at power source may be needed.

Friday, June 27, 2008

PIC16F887 is cheaper than PIC16F877A

I just realized that PIC16F887 (80 THB) costs less than half of PIC16F877A (200 THB).
The PIC16F887 is also comming with internal oscillators (8MHz, 32KHz). It's very nice for watch projects as it doesn't need external components.
After some searches, I have found a good info about PIC16F887 & PIC16F877A issue: Hello PIC16F887 MCUs- goodbye PIC16F877A! CCS News

From now on, I will use PIC16F887.