Tuesday, December 14, 2010

Loop the loops

There are a few common loops that is used in C: while loop, do while loop and for loop.

while loop:

while (1)

{

};

The while loop above is an infinite loop.

for loop:

for (condition = 0; condition < set value; condition ++)

{

}

This loop is suppose to count up until it meet the condition meet the set value. To make a count down loop, set condition to a value, and as long as the condition > set value, condition -- .

Do while loop:

do

{

}while(condition != 0);

This loop will do at least once to check the condition is met or not. If the condition is not met, the program will exit. The while loop and for loop on the other hand, will check whether the condition is net before executing the program.

Tortoise SVN

Another great software for source code management for window users.

http://tortoisesvn.tigris.org/

Tortoise Hg

Tortoise Hg is one of the source code management software to manage all the changes and modification done on your codes without having fear that the code has been wrongly modified and unrecovered. With tortoise, you can trace back the modfications that has been done to the codes, if you commit to the repository when each changes has been done.



Steps to use tortoise:

1. Configure tortoise setting by: Global settings -> tortoise hg -> commit -> enter user name

2. Initiate repository, that is which files/folders/source codes that needs back up

3. Add files to the repository

4. Commit when changes is done.

5.Use the Hg Repository Explorer in the folder the the files is commited to view all the changes done to the file.

Tortoise Hg is open source:     http://tortoisehg.bitbucket.org/

Microchip is coming up with MPLAB X

MPLAB X is the nex generation of MPLAB, netbean based, which have the similar look of eclipse with features: CVS, Subversion and Mercurial for source code management. Other features include: easy function viewer, linking between modules as well as autocomplete keywords :)

Downside:

Those who have not used eclipse before, need to familiarize themselves with the new outlook of MPLAB X.

To get your MPLAB X Beta to try it out: http://ww1.microchip.com/downloads/mplab/X_Beta/index.html

Saturday, September 18, 2010

Docking windows in MPLAB

To dock the windows in MPLAB, left click at the corner of the seperate windows in MPLAB. Click on dockable or undockable to dock and undock the windows. The first photo shows the placement of the windows which are about to be docked.



Here, is the look of docked windows for Untitled workspace and output.

Tuesday, August 3, 2010

Generating Eagle PCB in 3D



POVRay 3D can be used in cooperate with Eagle PCB to generate a 3D view of the PCB that we have designed. This will give us a better look on the PCB and component layout before we finalized the PCB for fabrication.

To use POV-ray:

  1. Click Tools -> Edit master POVRAY.INI

  2. A notepad file should load up. At the very bottom of it, add this line:

  3. Library_Path="C:\Program Files\Eagle3D\povray" (depending on where you install the file)

  4. Press on Render button in POV-ray

  5. You should get the 3D view of your PCB. Cheers ~~

Digital Logics

Monday, July 5, 2010

Potyo v2



potyo2



External Triggering Using ICD 2



Based on some experiments from NIEDZIELSKI.COM, it is said that external triggering can be archived by simply sending a pulse to PGC and PGD simultaneously as shown in the diagram.

Here is the sample code provided:

/*******************************************************************************
PIC18F4550 infinite breakpoints C example.
Created:  Wednesday, October 3, 2007 [Stephen Niedzielski]
Modified: Wednesday, October 3, 2007 [Stephen Niedzielski]
*******************************************************************************/

/****************** Includes. ******************/
#include <p18f4550.h> /* PIC18F4550 symbolics. */

/****************** Configuration bits. ******************/
/* Watch dog timer disabled. */
#pragma config WDT    = OFF
/* PORTB 4:0 digital IO. */
#pragma config PBADEN = OFF

/****************** Macros. ******************/
/* Breakpoint. */
#define Break(); \
PORTBbits.RB0 = 1; \
PORTBbits.RB0 = 0; \
Nop(); \
Nop();

void main(void)
{
/****************** Watch dog timer setup. ******************/
/* Disable the watch dog timer. */
WDTCONbits.SWDTEN = 0;

/****************** Breakpoint setup. ******************/
/* Turn off RB0 and RB1. */
PORTBbits.RB0 = 0;
PORTBbits.RB1 = 0;
/* PORTB digital IO on all channels. */
ADCON1 = 0x0F;
/* RB0 to output, RB1 to input. */
TRISBbits.TRISB0 = 0;
TRISBbits.TRISB1 = 1;

/* Wait for input on RB1. */
while( !PORTBbits.RB1 )
{
}

Break();
Nop(); /* Pop out of breakpoint here. */
Nop();
Nop();

}

*try it at your own risk :)

Thursday, May 13, 2010

Pickit 2 Clone

   PICKIT 2 CLONE




   
Pickit 2 clone is a low cost homemade pickit 2 that has similar microcontroller support: baseline (PIC10F, PIC12F5xx, PIC16F5xx), midrange (PIC12F6xx, PIC16F), PIC18F, PIC24, dsPIC30, dsPIC33, and PIC32 families of 8-bit, 16-bit, and 32-bit microcontrollers, and many Microchip Serial EEPROM products. T