Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Olimex LPC2148 + Crossworks + Wiggler

Status
Not open for further replies.
it looks slightly brighter on IE. But nothing a normal person would notice or complain about.

I am going to have to find a ribbon cable lol. Even tho i dont need it, its a good idea i have one lol

um.... i was thinking about making a nice little device. I might as well say what it is because i might not be able to make it anytime soon.

Since a SD card is SPI and you can have more than one on the same lines just using separate CS line i was thinking about making a SD Card Cloner or at least a Backuper lol like.

Ill have a 4GB SD Card as the backup drive. And use any other SD 32MB to 4GB as the source. And implement that FATFS or similar library to copy all files from the source to the backup.

Then if wanted copy from backup to another source.

I dont know why anyone would want something like this but i like the IDEA of it :D
I like having the option to create a backup of files without a PC.

Then i was thinking about a hard drive cloner. But instead of copying files you would have to have 2 identical hard drives and it would clone the entire thing from boot to end.
 
is it possible to make a huge mistake and not be able to program the LPC2148 again?

Im trying some interrupt code and for some reason i cant debug or program anymore and both my leds are on. How can i force it to erase the entire IC?

Is this fixable?
 
Last edited:
heh got it working thanks to the fella in the LPC2000 yahoo group. What i had to do was Connect my serial cable for ISP bootloader mode and then erase complete chip with a util like FlashMagic and now im back up!
 
Ok i finally got a button interrupt good!!
Code:
#include <LPC214x.h>
#include <ctl_api.h>

#define LED1  10    //My LED 1 is on P0.10
#define LED2  11    //My LED 1 is on P0.11
#define Btn1  15    //My Button 1 is on P0.15

#define GETBIT(var,bit) (((var)>>(bit))&1)      //Get the BIT from the VAR 
#define SETBIT(var,bit) ((var)|=(1<<(bit)))     //SET a bit HIGH
#define CLRBIT(var,bit) ((var)&=(~(1<<(bit))))	//CLR a bit to LOW

void IRQ_Routine (void);
void init_isr(void);

void Initialize(void);
void DelayUs(int us);
void DelayMs(int ms);
void DelayS(int se);
int main(void);
int en;
char MyDat;

int main(void){
    
    int loop1;                                  //LED Blink Loop Var.

    Initialize();                               //Initialize the Clock and PLL
    init_isr();                                 //Initialize the ISR (IRQ)
    
    IODIR0=0xFFFFFFFF;                          //All Output
    PINSEL0 = 0x80000000;                       //All pins GPIO except P0.15 aka BTN1 would be EINT2

    CLRBIT(IODIR0,Btn1);                        //Make Btn1 a INPUT 

    while(1){    
        for(loop1=0;loop1<20;loop1++){

            SETBIT(IOPIN0,LED1);                //Turn off LED1
            SETBIT(IOPIN0,LED2);                //Turn off LED2
            DelayMs(100);                       //Delay 100mS
            
            if(MyDat) CLRBIT(IOPIN0,LED1);      //Turn on LED1 if MyDat >= 1
            if(!MyDat) CLRBIT(IOPIN0,LED2);     //Turn on LED2 if MyDat = 0
            DelayMs(100);                       //Delay 100mS
	}
    }
}

void init_isr(void)
{
    VICIntSelect &= ~(1 << 16);             //Make EINT2 a IRQ interrupt
    VICIntEnable |= 1<<16;                  //enable EINT2 interrupt
    VICVectCntl0 = (1 << 5) | 16;           //use it for EINT2
    VICVectAddr0 = (unsigned)IRQ_Routine;   //set interrupt vector in 0

    EXTINT = 4;                             //Clear interrupt Flag EINT2
    EXTMODE = 4;                            //EINT2 is edge sensitive.
    EXTPOLAR = 0;                           //GPIO port 0 is accessed via VPB addresses in a fashion 
    SCS = 0;                                //Compatible with previous LCP2000 devices.
    
    en = libarm_set_irq(1);                 //Enable Global IRQ interrupts
}

void IRQ_Routine (void) {
      if(MyDat)                       //If MyDat >= 1 then 
        MyDat = 0 ;                   //set it to a 0
      else                            //if not
        MyDat = 1;                    //set it to a 1

      DelayMs(10);                    //10 millisecond delay
      EXTINT = 4;                     //clear interrupt flag
      libarm_set_irq(en);             //re-enable interrupts
}

void DelayUs(int us) {
  int tmp;
	for (; us>0; us--);
          for(tmp=0;tmp<1000;tmp++);
}

void DelayMs(int ms) {
	for (; ms>0; ms--)
		DelayUs(1000);
}
void DelayS(int se) {
	for (; se>0; se--)
		DelayMs(1000);
}
unsigned char GetPin(unsigned long tPin){
	unsigned long tmp;
	DelayMs(10);
	tmp = IOPIN0 & (1<<tPin);
	if(tmp == 0)
		return 0;
	else
		return 1;
}
#define PLOCK 0x400

void Initialize(void)  {

    PLL0CFG=0x23;
    PLL0FEED=0xAA;
    PLL0FEED=0x55;

    PLL0CON=0x1;
    PLL0FEED=0xAA;
    PLL0FEED=0x55;

    while(!(PLL0STAT & PLOCK)) ;
  
    PLL0CON=0x3;
    PLL0FEED=0xAA;
    PLL0FEED=0x55;

    MAMCR=0x2;
    MAMTIM=0x4;
  
    VPBDIV=0x01;
}

EDIT: I cleaned up the code and added a bunch of comments for all. Also I need more to comment but am tired lol so enjoy this for now


I am going to see if i can setup my own forum so i can keep track of my LPC stuff. I will of course support this forum and be here all the time.

**broken link removed**

Changed the ISR to :

Code:
void IRQ_Routine (void) {
      if(MyDat)                       //If MyDat >= 1 then 
        MyDat = 0 ;                   //set it to a 0
      else                            //if not
        MyDat = 1;                    //set it to a 1

      while(!GETBIT(IOPIN0,Btn1));    
      DelayMs(5);                     //5 millisecond delay
      EXTINT = 4;                     //clear interrupt flag
      libarm_set_irq(en);             //re-enable interrupts
}
 
Last edited:
heh i got a deal from a guy who owned the hosting before me. I bought his and then redid it all and then bought a domain. And re registered it in my name :D smart right lol

Heh i finally changed that top logo :D
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top