You are on page 1of 17

--------------'------------------------1.draw what ever circuit in orcad capture and save it (.

MNL file) in
appropriate place
N.B if u can assign appropriate foot prints to each and every component then
making thing will be bit easy
2.open orcad layout

3. make a new file file-->new

4. then choose appropriate .tech file (in orcad/layout/data)


for through hole components design choose JUMP6035.TCH ,JUMP5535.TCH or
JUMP6238.TCH
for smd design 2BET_SMT.TCH (sear for others for more detail)
for thro/smd design 1BET_ANY.TCH ,2BET_THR.TCH or 3BET_ANY.TCH
5. then open your .mnl fie
6. then select top layer
7. using obstacle tool draw a boundary of your pcb as required
8.then drag the component inside to the obstacle u draw (boundary) and
place properly
9. goto tool --> layers---->select from spread sheet----->select top layer and
set it as jumper layer ( R-click -->properties--> jumper layer radio button)
bottom layer to be routing layer
for all other layers ---> unused routing
10. switch off "online drc"
11. file menu auto-->autoroute--->board ,thous route the board automatically
and use jumpers when ever required according to .tech file u choose

12. if u have some unrouted nets then do manual routing by pressing shove
track mode, edit segment mode, add/edit route mode buttons (each have
specific functions )

13. if u want to use jumper goto tool-->jumper --->new


in there select appropriate foot print ( choose jumper library and there are
many jumpers in different widths )
place jumper where u want place and make connection to the jumper with
"connection tool " and delete the unnecessary nets (select "connection tool"
and L.click on the net where u want to delete and it will ask for confirmation
to delete)
and proceed with your manual routing
------------------------You are running the CPU at 48MHz according to you config words NOT 20MHz
even though this is the speed of the crystal.

The top two lines of your config word settings setup

USBDIV: 20MHz / 5 = 4MHz input to the PLL which then generates 96MHz

CPUDIV 96MHz / 2 = 48MHz

9600 baud @ 48MHz with BRGH and BRG16 = 0 means the SPBRG should be
77 and not 31.

48MHz / (64*9600) - 1 = 77.125


----------Mod-09 Lec-25 DC-DC converter controller.mp4

-----------------------VB coding
http://www.activexperts.com/serial-port-component/howto/vb/

============================================

////////////////////////////////////////////////////////////////////////////
///////
///////

///////
State Machine Concept

///////

///////
///////

////////////////////////////////////////////////////////////////////////////
///////

///////

/////// State Machine Name = STM

///////

/////// State Machine States = STMST1, STMST2, ...STMST10

///////

/////// State Machine Events = STMEV1, STMEV2,....STMEV10

///////

////////////////////////////////////////////////////////////////////////////
///////

Transitions

///////

////////////////////////////////////////////////////////////////////////////
/////// STMST1==>STMST5 for STMEV1

///////

/////// STMST1==>STMST3 for STMEV4

///////

///////--------------------------------------------------------------///////
/////// STMST2==>STMST1 for STMEV3
/////// STMST2==>STMST10 for STMEV7
///////--------------------------------------------------------------///////

///////
///////

/////// STMST3==>STMST4 for STMEV8

///////

/////// STMST3==>STMST7 for STMEV2

///////

///////--------------------------------------------------------------///////
/////// etc........................

///////

/////// etc........................

///////

////////////////////////////////////////////////////////////////////////////
/////// When some extern event happens, one should call

///////

/////// STMHandler (some event from defined set of events).

///////

/////// Will State machine change or not current state

///////

/////// depends whether transition is defined or not for current ///////


/////// state and event passed as parameter to STMHandler().

///////

////////////////////////////////////////////////////////////////////////////

//--------------------- Define states on State Machine STM -----------------

enum
state{STMST1,STMST2,STMST3,STMST4,STMST5,STMST6,STMST7,STMST8,ST
MST9,STMST10}currentState;

//--------------------- Define events on State Machine STM -----------------

enum
event{STMEV1,STMEV2,STMEV3,STMEV4,STMEV5,STMEV6,STMEV7,STMEV8,S
TMEV9,STMEV10}currentEvent;

//--------------------------- Define states handler ------------------------

void STMST1Handler(event eventHappened)


{
switch(eventHappened)
{
case STMEV1: //Do some action
currentState=STMST5;
break;
case STMEV4: //Do some action
currentState=STMST3;
break;
// Other cases

default:

break;

}
}

void STMST2Handler(event eventHappened)


{
switch(eventHappened)
{
case STMEV3: //Do some action
currentState=STMST1;
break;
case STMEV7: //Do some action
currentState=STMST10;
break;

// Other cases

default:

break;

}
}

void STMST3Handler(event eventHappened)


{
switch(eventHappened)
{
case STMEV8: //Do some action
currentState=STMST4;
break;
case STMEV2: //Do some action
currentState=STMST7;
break;
// Other cases

default:

break;

}
}

void STMST4Handler(event eventHappened)


{
; //Same as for other states transitions
}

void STMST5Handler(event eventHappened)


{
; //Same as for other states transitions
}

void STMST6Handler(event eventHappened)


{
; //Same as for other states transitions
}

void STMST7Handler(event eventHappened)


{
; //Same as for other states transitions
}

void STMST8Handler(event eventHappened)


{
; //Same as for other states transitions
}

void STMST9Handler(event eventHappened)


{
; //Same as for other states transitions
}

void STMST10Handler(event eventHappened)


{
; //Same as for other states transitions
}

//------------------------ Define state machine handler ---------------------

void STMHandler (event eventHappened)


{
switch(currentState)
{
case STMST1: STMST1Handler(eventHappened);
break;
case STMST2: STMST2Handler(eventHappened);
break;
case STMST3: STMST3Handler(eventHappened);
break;
case STMST4: STMST4Handler(eventHappened);
break;
case STMST5: STMST5Handler(eventHappened);
break;
case STMST6: STMST6Handler(eventHappened);
break;
case STMST7: STMST7Handler(eventHappened);
break;
case STMST8: STMST8Handler(eventHappened);

break;
case STMST9: STMST9Handler(eventHappened);
break;
case STMST10: STMST10Handler(eventHappened);
break;
default:
break;
}
}

----------------------http://tiktakx.wordpress.com/2010/11/21/serial-port-interfacing-with-vb-net2010/
-----------===== 30f4013 projects====
http://electronics-base.com/eSite/index.php/projects/complete-projects/195microchip-microcontroller-dspic30f4013-blink-led-example-using-timercomplete-project
----------------dsPIC30F3014 and dsPIC30F4013
----------AN899 bldc
--------http://www.eetindia.co.in/ART_8800522138_1800001_NT_f462ff45.HTM
----------------------------------Bit Torrent Sync a P2P syncing solution
--------------------------------

http://my.safaribooksonline.com/book/electrical-engineering/semiconductortechnology/9780750689601/pic16-c-sequencecontrol/ifelse_and_switchcase#X2ludGVybmFsX0J2ZGVwRmxhc2hSZWFkZXI/
eG1saWQ9OTc4MDc1MDY4OTYwMS80Mg==
--------------------------------------------STATIC VARIABLES
Uninitialized static variables are allocated a permanent fixed memory
location. Static variables are local in scope to the function in which they are
declared, but may be accessed by other functions "via pointers" since they
have permanent duration.
Variables which are static are guaranteed to retain their value between calls
to a function, unless explicitly modified via a pointer.
------------------------------------------\\\\\\state machine
http://www.gedan.net/2008/09/08/finite-state-machine-matrix-style-cimplementation/
-http://tactilicio.us/2008/02/12/some-code-snippets-for-a-simple-c-statemachine/
--------------------********foo.h*********
/* declaration of myarray */
extern char myarray[50];

********foo.c**********
/* If include the declaration the compiler will tell you if it doesn't match the
definition */
#include "foo.h"
/* definition of myarray */
char myarray[50];

********bar.c**********
/* Include foo.h and myarray[ ] will be visible */#include "foo.h"
void myfunc( void )
{ myarray[5] = 0x55;}
--------------------------Variable declared in hi tech.
If you intend for the variables to be used by only one function, but want them
to "exist" when the function is not active, then you declare them static within
the function.
If you want them to be shared by multiple functions, then you declare them
outside any of the functions.
If you put them at the front of a .c file, then they will be available to all
functions within that .c file.
If you want them accessible to functions within another .c file, then you
declare them exactly the same in that .c file, but with the extern keyword.
Many linkers (I forget whether PICC's is one of them) will complain unless the
variables are declared without the extern keyword in exactly one .c file.
---------------------www.jhdlcd.com.cn
LCD JHD539
controller SPLC780D
--------------------------------------dsPIC30F3012(8Kword,18pin)
dsPIC30F3014(8Kword,30gpio,40pin,4timer)
dsPIC30F4013(16Kword,30gpio,40pin,7timer)
PIC18F4553(16Kword,35gpio,40pin,4timer)
PIC18F4523
-----------------------------------------

\\\\\\\Pic 16f877 uart and rs232 tutorials


http://www.winpicprog.co.uk/pic_tutorial7.htm
http://www.edaboard.com/thread200311.html
-------------------------------- pic 877 rs232
http://techref.massmind.org/techref/microchip/16F877/rs232-cr.htm
------------------------------////uart pic 877
http://saeedsolutions.blogspot.in/2012/11/pic16f877-uart-code-proteussimulation.html
---------------------------------------------------http://spyebook.org/download/d-m-mitchell-dc-dc-switching-regulatoranalysis.html
------------------------PI & PID control
http://www.ecircuitcenter.com/Circuits/op_pid/op_pid.htm
---------------------------------------I'm reading two registers from microcontroller. One have 4-bit MSB (First 4bits has some other things) and another 8-bit LSB. I want to convert it into
one 12-bit uint (16 bit to be precise). So far I made it like that:

UINT16 x;
UINT8 RegValue = 0;
UINT8 RegValue1 = 0;

ReadRegister(Register01, &RegValue1);
ReadRegister(Register02, &RegValue2);

x = RegValue1 & 0x000F;


x = x << 8;
x = x | RegValue2 & 0x00FF
// if reg1 is 0x03, reg2 0xFF, x will be 0x03FF//
------------------Pic spi examples.
http://www.microchip.com/forums/m729449.aspx
-----------------------------SPI Initialization with respect to Master (Pic 18F8722)
void InitSPI_Master(void)
{
TRISDbits.TRISD6 = 0; // Define clock pin as output
TRISDbits.TRISD5 = 1; // Define SDI as Input
TRISDbits.TRISD4 = 0; // Define SDO as Output
TRISDbits.TRISD7 = 0; // Define chip select as output

SSP2STATbits.SMP = 0; // Sampled at the Middle


SSP2STATbits.CKE = 1; // Data Transmitted on Falling Edge

SSP2CON1 = 0x22; /* Configures SDo, SDI,SCK and SS pins as serial port pins.
Clock idle state Low and FOSC/64 */

INTCONbits.INT0IE = 0;

// INT0 External Interrupt Disable bit

INTCONbits.INT0IF = 0;

INTCON2bits.RBPU =1 ; // Disable Pullups


INTCON2bits.INTEDG0 =1; // Interrupt on Rising Edge

SPI Initialization with respect to Slave (Pic 18F2525)

void InitSPI_S(void)
{
TRISCbits.TRISC5 = 0; // Define SDO pin as output
TRISCbits.TRISC4 = 1; // Define SDI as Input
TRISCbits.TRISC3 = 1; // Define SCK as Input
TRISAbits.TRISA5 = 1; // Define chip select as Input

SSPSTATbits.SMP = 0; // Cleared in Slave Mode


SSPSTATbits.CKE = 1; // Data Transmitted on Falling Edge

SSPCON1 = 0x24; /* Configures SDo, SDI,SCK and SS pins as serial port


pins. Slave mode and SS controlled */

INTCONbits.INT0IE = 0;

// INT0 External Interrupt Disable bit

INTCONbits.INT0IF = 0;

INTCON2bits.RBPU =1 ; // Disable Pullups


INTCON2bits.INTEDG0 =1; // Interrupt on Rising Edge
}
----------------------------

////pic877 PWM
////https://dl.dropbox.com/u/22020714/PIC16F877%20PWM%20Code.rar
http://saeedsolutions.blogspot.fr/2012/11/pic16f877-pwm-code-proteussimulation.html
--------------Pic877 lcd interfacing
http://www.edaboard.com/thread52184.html
----------------Wilmshurst, Tim (2010). Designing Embedded Systems with PIC
Microcontrollers: Principles and Applications. Elsevier.
------------------------------//// lcd interfacing
http://www.ekenrooi.net/lcd/lcd.shtml
-------------------------------------http://www.mwftr.com/book.html
-------------------------------------------------------------jhd12864e LCD
-----------------------------------------(20MHz crystal with two 30pF ceramic capacitor),
1MHZ-4MHZ 15pf
------------------------------------http://saeedsolutions.blogspot.fr/2012/11/pic16f877-led-blinking-codeproteus.html
----------------------------------------http://stackoverflow.com/questions/7277926/bitwise-operator-to-get-bytefrom-32-bits?rq=1
---------------------------------

My simplified pickit2 clone


http://simon.derr.free.fr/site/spip/spip.php?article11
---------------------------PIC programmer
http://www.semis.demon.co.uk/uJDM/uJDMmain.htm
-----------------------------------/*******************
* User's source file
*******************
// Access registers without a bit field definition (.all, .bit not used)
SciaRegs.SCIHBAUD = 0;
SciaRegs.SCILBAUD = 1;
// Write to bit fields in SCI-A SCICTL1
SciaRegs.SCICTL1.bit.SWRESET = 0;
SciaRegs.SCICTL1.bit.SWRESET = 1;
SciaRegs.SCIFFCT.bit.ABDCLR = 1;
SciaRegs.SCIFFCT.bit.CDC = 1;
// Poll (i.e., read) a bit
while(SciaRegs.SCIFFCT.bit.CDC == 1) { }
// Write to the whole SCI-B SCICTL1/2 registers (use .all)
ScibRegs.SCICTL1.all = 0x0003;
ScibRegs.SCICTL2.all = 0x0000;
----------------------------http://rapidshare.com/files/43362188/C_Sinewave.rar
--------------------------http://rapidshare.com/files/34936881...r_with_PFC.pdf

http://rapidshare.com/files/34936883...ter_Design.pdf
http://rapidshare.com/files/34936882...c-inverter.pdf

You might also like