Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 23rd June 2009, 11:38 PM   #91
Default

Jason, you can control the startup.s file through a GUI, in case you haven't noticed.
millwood is offline  
Old 24th June 2009, 01:28 AM   #92
Default

yeah i noticed it... i disabled all PLL stuff and doing it in CODE. Simpler to me.
Code:
void init_PLL(void)
{
	PLLCFG = 0x00000024;	//Set Multiplier and Divider of PLL to give 60MHz
	PLLCON = 0x00000001;	//Enable the PLL

	PLLFEED = 0x000000AA;	//Update PLL registers with feed sequence
	PLLFEED = 0x00000055;	

	while(!(PLLSTAT & 0x00000400));		//Test Lock bit

	PLLCON = 0x00000003;	//Connect the PLL

	PLLFEED = 0x000000AA;	//Update PLL registers with feed sequence
	PLLFEED = 0x00000055;	

	VPBDIV = 0x00000002;	//Set the VLSI peripheral bus to 30MHz
}
AtomSoft is offline  
Old 24th June 2009, 01:53 AM   #93
Default

Small nice BLINK.C ... i made the delays they seem to work as supposed to but not 100% sure
Code:
#include <LPC210x.h>
#define LED 0

void SetPin(unsigned long tPin){
	IOPIN = IOPIN | (1<<tPin);
}
void ClrPin(unsigned long tPin){
	IOPIN = IOPIN & ~(1<<tPin);
}
void delayus(unsigned int time){
	unsigned int x, delay;

	for(x=0;x<time;x++){
		for(delay=0;delay<8;delay++){
			;
		}
	}
}
void delayms(unsigned int time){
	unsigned int x, delay;

	for(x=0;x<time;x++){
		for(delay=0;delay<7540;delay++){
			;
		}
	}
}
void init_PLL(void){
	PLLCFG = 0x00000024;	//Set Multiplier and Divider of PLL to give 60MHz
	PLLCON = 0x00000001;	//Enable the PLL

	PLLFEED = 0x000000AA;	//Update PLL registers with feed sequence
	PLLFEED = 0x00000055;	

	while(!(PLLSTAT & 0x00000400));		//Test Lock bit

	PLLCON = 0x00000003;	//Connect the PLL

	PLLFEED = 0x000000AA;	//Update PLL registers with feed sequence
	PLLFEED = 0x00000055;	

	VPBDIV = 0x00000002;	//Set the VLSI peripheral bus to 30MHz
}

int main(void){
	init_PLL();

	PINSEL0 = 0x00000000;
	IODIR = 0xFFFFFFFF;

	while(1){
		SetPin(LED);
		delayms(300);

		ClrPin(LED);
		delayms(300);
	}
}

Last edited by AtomSoft; 24th June 2009 at 02:22 PM.
AtomSoft is offline  
Reply

Tags
arm, cortex

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
ARM Cortex Microcontrollers? dknguyen Micro Controllers 0 10th February 2009 12:37 AM
ARM Cortex-M3 DSP dknguyen Micro Controllers 1 2nd February 2009 04:47 PM



All times are GMT. The time now is 01:53 PM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker