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.

AtomSoft

Well-Known Member
Hey guys i ran into my first issue.... its a crazy one for me.

I have the Olimex LPC2148 board and Crossworks + Wiggler JTAG. I have it setup correctly i assume because i can debug the board and run a program off my PC while connect to Wiggler(JTAG). but i have no clue why it wont program correctly. Maybe im doing something wrong.

I tried clicking on the wiggler icon and sending a HEX to the board it completes without errors and verifies ok but when i remove all the jtag and power then reput the power nothing works lol

So basically its working in debug mode only.
 
Answered this on the other forum, but:

This got me as well, when I first started. To add to Leon, you have to add a definition in order to compile your code to run from a hardware reset.

**broken link removed**
 
Ya, it's so sweet when you get that first thing working. Then comes the real work trying to figure out the more advanced peripherals and trying to make something useful.

I got my Cortex-M3 board working and have done a few play things with it, but I just have too many uC's going right now.

I don't know about the LPC, but I use the GNU header files for SAM7 development rather than the Crossworks included header files. Since a lot of sample code is out there for GNU, it's easier to use other peoples code, or for others to use your code.
 
heh the only header i have is from KEIL website:

NXP (founded by Philips) LPC2148

Im not sure i will need anything else but that to create anything i need. If anything ill make custom stuff anyway :D

heh but i got another issue now lol it seems to be running too fast lol I have it setup for 60Mhz just like some sample code i have seen. Also in there code they delay 500msec by doing a for loop of 500,000

So that means a 1 ms would be 1000, and a 1 us would be 1. I tried it below but it blinks to fast to be a 1 second delay. Any thoughts on this?

Code:
#include <LPC214x.h>

#define LED1  10
#define LED2  11
#define Btn1  15

#define GETBIT(var,bit) (((var)>>(bit))&1) 		
#define SETBIT(var,bit) ((var)|=(1<<(bit)))		
#define CLRBIT(var,bit) ((var)&=(~(1<<(bit))))		

void Initialize(void);
void feed(void);
void DelayUs(int us);
void DelayMs(int ms);
void DelayS(int se);
int main(void);

int main(void){
	char MyDat;
        int i,j;

        Initialize();

	PINSEL0=0x00000000;
	IODIR0=0xFFFFFFFF;
        CLRBIT(IODIR0,Btn1);

	while(1){
                CLRBIT(IOPIN0,LED2);
		SETBIT(IOPIN0,LED1);
                DelayS(1);
                SETBIT(IOPIN0,LED2);
                CLRBIT(IOPIN0,LED1);
                DelayS(1);
	}

}


void DelayUs(int us) {
	for (; us>0; us--);
}

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)  {

   
	// Setting Multiplier and Divider values
  	PLL0CFG=0x23;
  	feed();
  
	// Enabling the PLL */	
	PLL0CON=0x1;
	feed();
  
	// Wait for the PLL to lock to set frequency
	while(!(PLL0STAT & PLOCK)) ;
  
	// Connect the PLL as the clock source
	PLL0CON=0x3;
	feed();
  
	// Enabling MAM and setting number of clocks used for Flash memory fetch (4 cclks in this case)
	MAMCR=0x2;
	MAMTIM=0x4;
  
	// Setting peripheral Clock (pclk) to System Clock (cclk)
	VPBDIV=0x1;

}


void feed(void)
{
  PLL0FEED=0xAA;
  PLL0FEED=0x55;
}
 
Last edited:
heh the only header i have is from KEIL website:

NXP (founded by Philips) LPC2148

Im not sure i will need anything else but that to create anything i need. If anything ill make custom stuff anyway :D


The SAM7 headers are 3000 lines long and have every peripheral register and register variable defined. I'd hate to have to make that on my own.

If you haven't already, join the LPC2000 yahoo mailing groups list.
**broken link removed**

There's a lot of stuff if you search the archives, and there's a bunch of stuff in the files section.
 
Yeah i joined :D I got the wiggler schematic from there lol

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

void DelayMs(int ms) {
	for (; ms>0; ms--)
		DelayUs(1000);
}
void DelayS(int se) {
	for (; se>0; se--)
		DelayMs(1000);
}

These seem to work better. I had to add 1000 to uSec delays just to make it work. I tested using 2 second delays since its easier to count and it works well.
 
Last edited:
I'm thinking it's just a SAM7 thing. The header that is. I looked at the header you are using there, and all of the registers have been defined. The only thing the SAM7 GNU header adds is all of the variables within the registers, for example:

Code:
// *****************************************************************************
//              SOFTWARE API DEFINITION  FOR Two-wire Interface
// *****************************************************************************
typedef struct _AT91S_TWI {
	AT91_REG	 TWI_CR; 	// Control Register
	AT91_REG	 TWI_MMR; 	// Master Mode Register
	AT91_REG	 Reserved0[1]; 	// 
	AT91_REG	 TWI_IADR; 	// Internal Address Register
	AT91_REG	 TWI_CWGR; 	// Clock Waveform Generator Register
	AT91_REG	 Reserved1[3]; 	// 
	AT91_REG	 TWI_SR; 	// Status Register
	AT91_REG	 TWI_IER; 	// Interrupt Enable Register
	AT91_REG	 TWI_IDR; 	// Interrupt Disable Register
	AT91_REG	 TWI_IMR; 	// Interrupt Mask Register
	AT91_REG	 TWI_RHR; 	// Receive Holding Register
	AT91_REG	 TWI_THR; 	// Transmit Holding Register
} AT91S_TWI, *AT91PS_TWI;

// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- 
#define AT91C_TWI_START       ((unsigned int) 0x1 <<  0) // (TWI) Send a START Condition
#define AT91C_TWI_STOP        ((unsigned int) 0x1 <<  1) // (TWI) Send a STOP Condition
#define AT91C_TWI_MSEN        ((unsigned int) 0x1 <<  2) // (TWI) TWI Master Transfer Enabled
#define AT91C_TWI_MSDIS       ((unsigned int) 0x1 <<  3) // (TWI) TWI Master Transfer Disabled
#define AT91C_TWI_SWRST       ((unsigned int) 0x1 <<  7) // (TWI) Software Reset
// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- 
#define AT91C_TWI_IADRSZ      ((unsigned int) 0x3 <<  8) // (TWI) Internal Device Address Size
#define 	AT91C_TWI_IADRSZ_NO                   ((unsigned int) 0x0 <<  8) // (TWI) No internal device address
#define 	AT91C_TWI_IADRSZ_1_BYTE               ((unsigned int) 0x1 <<  8) // (TWI) One-byte internal device address
#define 	AT91C_TWI_IADRSZ_2_BYTE               ((unsigned int) 0x2 <<  8) // (TWI) Two-byte internal device address
#define 	AT91C_TWI_IADRSZ_3_BYTE               ((unsigned int) 0x3 <<  8) // (TWI) Three-byte internal device address
#define AT91C_TWI_MREAD       ((unsigned int) 0x1 << 12) // (TWI) Master Read Direction
#define AT91C_TWI_DADR        ((unsigned int) 0x7F << 16) // (TWI) Device Address
// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- 
#define AT91C_TWI_CLDIV       ((unsigned int) 0xFF <<  0) // (TWI) Clock Low Divider
#define AT91C_TWI_CHDIV       ((unsigned int) 0xFF <<  8) // (TWI) Clock High Divider
#define AT91C_TWI_CKDIV       ((unsigned int) 0x7 << 16) // (TWI) Clock Divider
// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- 
#define AT91C_TWI_TXCOMP      ((unsigned int) 0x1 <<  0) // (TWI) Transmission Completed
#define AT91C_TWI_RXRDY       ((unsigned int) 0x1 <<  1) // (TWI) Receive holding register ReaDY
#define AT91C_TWI_TXRDY       ((unsigned int) 0x1 <<  2) // (TWI) Transmit holding register ReaDY
#define AT91C_TWI_OVRE        ((unsigned int) 0x1 <<  6) // (TWI) Overrun Error
#define AT91C_TWI_UNRE        ((unsigned int) 0x1 <<  7) // (TWI) Underrun Error
#define AT91C_TWI_NACK        ((unsigned int) 0x1 <<  8) // (TWI) Not Acknowledged
// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- 
// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- 
// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register --------

All of the registers are defined for the I2C peripheral, but also all of the settings within those registers are defined. So to send a start condition you can use TWI_MMR |= AT91C_TWI_START.

I thought there might be something similar in the GNU world for LPC's.
 
Here are some pics of my ugly but working like a champ! jtag wiggler clone lol

The first image shows how i cut the PCB to enable me to get to the debug jumper.

The other 2 are the top/bottom of the jtag. I added a led to verify it plugged in correctly and ground and vcc are ok from target.

I didnt have a IDC Female connector of 20PIN and no hard drive cables since i use SATA :(
 

Attachments

  • debug.jpg
    debug.jpg
    88 KB · Views: 411
  • jtag01.jpg
    jtag01.jpg
    63.6 KB · Views: 768
  • jtag02.jpg
    jtag02.jpg
    52.2 KB · Views: 845
Last edited:
Very cool. I made up a wiggler a long time ago and never ended up using it. I pulled it out a couple months ago, but I think I got the wiring wrong on the JTAG connector.

I'm going to try out an 8pin JTAG connector on my future boards and see how that works out. These 20pin connectors are massive. Even 8pin is gigantic and inconvenient compared to my old 3pin program/debug header.
 
heh im since i know what to wire i can probably make it into a 2x5 header with no issue. Those would be a lot simpler and cleaner to use :D

A 3 pin omg i think that would be so nice to have. I would make so many different adapters like use a stereo headset jack or tel jack, use cable ect... would be cool!
 
just converted some LCD code for LPC2148 and NOKIA 7110 lcd:
Code:
#include <LPC214x.h>

#define GETBIT(var,bit) (((var)>>(bit))&1) 		
#define SETBIT(var,bit) ((var)|=(1<<(bit)))		
#define CLRBIT(var,bit) ((var)&=(~(1<<(bit))))		

    #define LCDP IOPIN1
    #define CS	 21
    #define DC   22
    #define SCL	 23
    #define SDO	 24
    #define RST	 25

    #define LED1 10
    #define BTN  15
/*
LCD   |   DESC    |   PIN-COLOR WIRE
--------------------------------------------

--------------------------------------------
2     |   CS      |   1.LIGHT BLUE
--------------------------------------------
4     |   D/C     |   2.ORANGE
--------------------------------------------
5     |   SCL     |   5.BLUE
--------------------------------------------
13    |   DATA    |   6.WHITE - BLACK
--------------------------------------------
14    |   RESET   |   7.WHITE - LIGHT BLUE
--------------------------------------------
*/
int main(void);
void Initialize(void);
void feed(void);
void DelayUs(int us);
void DelayMs(int ms);
void DelayS(int se);
void CLS(void);
void LCD_Init(void);
void LCD_Reset(void);
void SendByte(unsigned char data);
void LCD_Send(unsigned char cmd, unsigned char type);
void LCDChar(unsigned char letter,unsigned char font,unsigned char style,unsigned char top, unsigned char left);
void LCDString(const char *str,unsigned char font,unsigned char style,unsigned char top, unsigned char left);

const char Font5x7 [] = {
                  0x00,0x00,0x00,0x00,0x00,  // 20 space
                  0x00,0x00,0x5f,0x00,0x00,  // 21 !
                  0x00,0x07,0x00,0x07,0x00,  // 22 "
                  0x14,0x7f,0x14,0x7f,0x14,  // 23 #
                  0x24,0x2a,0x7f,0x2a,0x12,  // 24 $
                  0x23,0x13,0x08,0x64,0x62,  // 25 %
                  0x36,0x49,0x55,0x22,0x50,  // 26 &
                  0x00,0x05,0x03,0x00,0x00,  // 27 '
                  0x00,0x1c,0x22,0x41,0x00,  // 28 (
                  0x00,0x41,0x22,0x1c,0x00,  // 29 )
                  0x14,0x08,0x3e,0x08,0x14,  // 2a *
                  0x08,0x08,0x3e,0x08,0x08,  // 2b +
                  0x00,0x50,0x30,0x00,0x00,  // 2c ,
                  0x08,0x08,0x08,0x08,0x08,  // 2d -
                  0x00,0x60,0x60,0x00,0x00,  // 2e .
                  0x20,0x10,0x08,0x04,0x02,  // 2f /
                  0x3e,0x51,0x49,0x45,0x3e,  // 30 0
                  0x00,0x42,0x7f,0x40,0x00,  // 31 1
                  0x42,0x61,0x51,0x49,0x46,  // 32 2
                  0x21,0x41,0x45,0x4b,0x31,  // 33 3
                  0x18,0x14,0x12,0x7f,0x10,  // 34 4
                  0x27,0x45,0x45,0x45,0x39,  // 35 5
                  0x3c,0x4a,0x49,0x49,0x30,  // 36 6
                  0x01,0x71,0x09,0x05,0x03,  // 37 7
                  0x36,0x49,0x49,0x49,0x36,  // 38 8
                  0x06,0x49,0x49,0x29,0x1e,  // 39 9
                  0x00,0x36,0x36,0x00,0x00,  // 3a :
                  0x00,0x56,0x36,0x00,0x00,  // 3b ;
                  0x08,0x14,0x22,0x41,0x00,  // 3c <
                  0x14,0x14,0x14,0x14,0x14,  // 3d =
                  0x00,0x41,0x22,0x14,0x08,  // 3e >
                  0x02,0x01,0x51,0x09,0x06,  // 3f ?
                  0x32,0x49,0x79,0x41,0x3e,  // 40 @
                  0x7e,0x11,0x11,0x11,0x7e,  // 41 A
                  0x7f,0x49,0x49,0x49,0x36,  // 42 B
                  0x3e,0x41,0x41,0x41,0x22,  // 43 C
                  0x7f,0x41,0x41,0x22,0x1c,  // 44 D
                  0x7f,0x49,0x49,0x49,0x41,  // 45 E
                  0x7f,0x09,0x09,0x09,0x01,  // 46 F
                  0x3e,0x41,0x49,0x49,0x7a,  // 47 G
                  0x7f,0x08,0x08,0x08,0x7f,  // 48 H
                  0x00,0x41,0x7f,0x41,0x00,  // 49 I
                  0x20,0x40,0x41,0x3f,0x01,  // 4a J
                  0x7f,0x08,0x14,0x22,0x41,  // 4b K
                  0x7f,0x40,0x40,0x40,0x40,  // 4c L
                  0x7f,0x02,0x0c,0x02,0x7f,  // 4d M
                  0x7f,0x04,0x08,0x10,0x7f,  // 4e N
                  0x3e,0x41,0x41,0x41,0x3e,  // 4f O
                  0x7f,0x09,0x09,0x09,0x06,  // 50 P
                  0x3e,0x41,0x51,0x21,0x5e,  // 51 Q
                  0x7f,0x09,0x19,0x29,0x46,  // 52 R
                  0x46,0x49,0x49,0x49,0x31,  // 53 S
                  0x01,0x01,0x7f,0x01,0x01,  // 54 T
                  0x3f,0x40,0x40,0x40,0x3f,  // 55 U
                  0x1f,0x20,0x40,0x20,0x1f,  // 56 V
                  0x3f,0x40,0x38,0x40,0x3f,  // 57 W
                  0x63,0x14,0x08,0x14,0x63,  // 58 X
                  0x07,0x08,0x70,0x08,0x07,  // 59 Y
                  0x61,0x51,0x49,0x45,0x43,  // 5a Z
                  0x00,0x7f,0x41,0x41,0x00,  // 5b [
                  0x02,0x04,0x08,0x10,0x20,  // 5c 55
                  0x00,0x41,0x41,0x7f,0x00,  // 5d ]
                  0x04,0x02,0x01,0x02,0x04,  // 5e ^
                  0x40,0x40,0x40,0x40,0x40,  // 5f _
                  0x00,0x01,0x02,0x04,0x00,  // 60 `
                  0x20,0x54,0x54,0x54,0x78,  // 61 a
                  0x7f,0x48,0x44,0x44,0x38,  // 62 b
                  0x38,0x44,0x44,0x44,0x20,  // 63 c
                  0x38,0x44,0x44,0x48,0x7f,  // 64 d
                  0x38,0x54,0x54,0x54,0x18,  // 65 e
                  0x08,0x7e,0x09,0x01,0x02,  // 66 f
                  0x0c,0x52,0x52,0x52,0x3e,  // 67 g
                  0x7f,0x08,0x04,0x04,0x78,  // 68 h
                  0x00,0x44,0x7d,0x40,0x00,  // 69 i
                  0x20,0x40,0x44,0x3d,0x00,  // 6a j
                  0x7f,0x10,0x28,0x44,0x00,  // 6b k
                  0x00,0x41,0x7f,0x40,0x00,  // 6c l
                  0x7c,0x04,0x18,0x04,0x78,  // 6d m
                  0x7c,0x08,0x04,0x04,0x78,  // 6e n
                  0x38,0x44,0x44,0x44,0x38,  // 6f o
                  0x7c,0x14,0x14,0x14,0x08,  // 70 p
                  0x08,0x14,0x14,0x18,0x7c,  // 71 q
                  0x7c,0x08,0x04,0x04,0x08,  // 72 r
                  0x48,0x54,0x54,0x54,0x20,  // 73 s
                  0x04,0x3f,0x44,0x40,0x20,  // 74 t
                  0x3c,0x40,0x40,0x20,0x7c,  // 75 u
                  0x1c,0x20,0x40,0x20,0x1c,  // 76 v
                  0x3c,0x40,0x30,0x40,0x3c,  // 77 w
                  0x44,0x28,0x10,0x28,0x44,  // 78 x
                  0x0c,0x50,0x50,0x50,0x3c,  // 79 y
                  0x44,0x64,0x54,0x4c,0x44,  // 7a z
                  0x00,0x08,0x36,0x41,0x00,  // 7b {
                  0x00,0x00,0x7f,0x00,0x00,  // 7c |
                  0x00,0x41,0x36,0x08,0x00,  // 7d }
                  0x10,0x08,0x08,0x10,0x08,  // 7e ~
                  0x78,0x46,0x41,0x46,0x78}; // 7f &brvbar;

const char Font8x8[] =
{
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,       // ASCII -  32
    0x00,0x00,0x00,0x5F,0x5F,0x00,0x00,0x00 ,       // ASCII -  33
    0x00,0x00,0x03,0x07,0x00,0x07,0x03,0x00 ,       // ASCII -  34
    0x00,0x10,0x74,0x1C,0x77,0x1C,0x17,0x04 ,       // ASCII -  35
    0x00,0x24,0x2E,0x2A,0x7F,0x2A,0x3A,0x10 ,       // ASCII -  36
    0x00,0x4C,0x6A,0x76,0x1A,0x6A,0x56,0x33 ,       // ASCII -  37
    0x00,0x30,0x7A,0x4F,0x5D,0x37,0x7A,0x48 ,       // ASCII -  38
    0x00,0x00,0x04,0x07,0x03,0x00,0x00,0x00 ,       // ASCII -  39
    0x00,0x00,0x00,0x1C,0x3E,0x63,0x41,0x00 ,       // ASCII -  40
    0x00,0x00,0x41,0x63,0x3E,0x1C,0x00,0x00 ,       // ASCII -  41
    0x00,0x08,0x2A,0x3E,0x1C,0x3E,0x2A,0x08 ,       // ASCII -  42
    0x00,0x08,0x08,0x3E,0x3E,0x08,0x08,0x00 ,       // ASCII -  43
    0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00 ,       // ASCII -  44
    0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x00 ,       // ASCII -  45
    0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00 ,       // ASCII -  46
    0x00,0x60,0x30,0x18,0x0C,0x06,0x03,0x01 ,       // ASCII -  47
    0x00,0x1C,0x3E,0x61,0x43,0x3E,0x1C,0x00 ,       // ASCII -  48
    0x00,0x00,0x44,0x7F,0x7F,0x40,0x00,0x00 ,       // ASCII -  49
    0x00,0x46,0x67,0x71,0x59,0x4F,0x66,0x00 ,       // ASCII -  50
    0x00,0x22,0x63,0x49,0x4D,0x7F,0x32,0x00 ,       // ASCII -  51
    0x00,0x18,0x1C,0x52,0x7F,0x7F,0x50,0x00 ,       // ASCII -  52
    0x00,0x2F,0x6F,0x45,0x45,0x7D,0x39,0x00 ,       // ASCII -  53
    0x00,0x3C,0x7E,0x4B,0x49,0x79,0x30,0x00 ,       // ASCII -  54
    0x00,0x07,0x43,0x71,0x7D,0x0F,0x03,0x00 ,       // ASCII -  55
    0x00,0x36,0x7F,0x4D,0x59,0x7F,0x36,0x00 ,       // ASCII -  56
    0x00,0x06,0x4F,0x49,0x69,0x3F,0x1E,0x00 ,       // ASCII -  57
    0x00,0x00,0x00,0x66,0x66,0x00,0x00,0x00 ,       // ASCII -  58
    0x00,0x00,0x00,0x66,0x66,0x00,0x00,0x00 ,       // ASCII -  59
    0x00,0x00,0x08,0x1C,0x36,0x63,0x41,0x00 ,       // ASCII -  60
    0x00,0x14,0x14,0x14,0x14,0x14,0x14,0x00 ,       // ASCII -  61
    0x00,0x00,0x41,0x63,0x36,0x1C,0x08,0x00 ,       // ASCII -  62
    0x00,0x02,0x07,0x51,0x59,0x0F,0x06,0x00 ,       // ASCII -  63
    0x00,0x3E,0x41,0x5D,0x55,0x5D,0x51,0x1E ,       // ASCII -  64
    0x00,0x40,0x70,0x1D,0x17,0x1F,0x78,0x60 ,       // ASCII -  65
    0x00,0x41,0x7F,0x7F,0x49,0x4F,0x7E,0x30 ,       // ASCII -  66
    0x00,0x1C,0x3E,0x63,0x41,0x41,0x42,0x27 ,       // ASCII -  67
    0x00,0x41,0x7F,0x7F,0x41,0x63,0x3E,0x1C ,       // ASCII -  68
    0x00,0x41,0x7F,0x7F,0x49,0x5D,0x41,0x63 ,       // ASCII -  69
    0x00,0x41,0x7F,0x7F,0x49,0x1D,0x01,0x03 ,       // ASCII -  70
    0x00,0x1C,0x3E,0x63,0x41,0x51,0x72,0x77 ,       // ASCII -  71
    0x00,0x7F,0x7F,0x08,0x08,0x7F,0x7F,0x00 ,       // ASCII -  72
    0x00,0x00,0x41,0x7F,0x7F,0x41,0x00,0x00 ,       // ASCII -  73
    0x00,0x30,0x70,0x41,0x41,0x7F,0x3F,0x01 ,       // ASCII -  74
    0x00,0x7F,0x7F,0x08,0x1C,0x77,0x63,0x41 ,       // ASCII -  75
    0x00,0x41,0x7F,0x7F,0x41,0x40,0x60,0x70 ,       // ASCII -  76
    0x00,0x7F,0x7E,0x0C,0x18,0x0C,0x7E,0x7F ,       // ASCII -  77
    0x00,0x7F,0x7E,0x0C,0x18,0x30,0x7F,0x7F ,       // ASCII -  78
    0x00,0x1C,0x3E,0x63,0x41,0x63,0x3E,0x1C ,       // ASCII -  79
    0x00,0x41,0x7F,0x7F,0x49,0x09,0x0F,0x06 ,       // ASCII -  80
    0x00,0x1C,0x3E,0x63,0x51,0x63,0x3E,0x1C ,       // ASCII -  81
    0x00,0x7F,0x7F,0x09,0x19,0x7F,0x66,0x40 ,       // ASCII -  82
    0x00,0x66,0x6F,0x4D,0x59,0x7B,0x33,0x00 ,       // ASCII -  83
    0x00,0x03,0x41,0x7F,0x7F,0x41,0x03,0x00 ,       // ASCII -  84
    0x00,0x3F,0x7F,0x40,0x40,0x40,0x7F,0x3F ,       // ASCII -  85
    0x00,0x03,0x0F,0x3D,0x70,0x1D,0x07,0x01 ,       // ASCII -  86
    0x00,0x0F,0x7F,0x30,0x1C,0x30,0x7F,0x0F ,       // ASCII -  87
    0x00,0x63,0x77,0x1C,0x1C,0x77,0x63,0x00 ,       // ASCII -  88
    0x01,0x03,0x47,0x7C,0x78,0x47,0x03,0x01 ,       // ASCII -  89
    0x00,0x67,0x73,0x59,0x4D,0x67,0x73,0x00 ,       // ASCII -  90
    0x00,0x00,0x00,0x7F,0x7F,0x41,0x41,0x00 ,       // ASCII -  91
    0x00,0x01,0x03,0x06,0x0C,0x18,0x30,0x60 ,       // ASCII -  92
    0x00,0x00,0x41,0x41,0x7F,0x7F,0x00,0x00 ,       // ASCII -  93
    0x00,0x00,0x04,0x06,0x03,0x06,0x04,0x00 ,       // ASCII -  94
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,       // ASCII -  95
    0x00,0x00,0x01,0x03,0x06,0x04,0x00,0x00 ,       // ASCII -  96
    0x00,0x68,0x6C,0x54,0x54,0x3C,0x78,0x40 ,       // ASCII -  97
    0x00,0x41,0x7F,0x3F,0x6C,0x44,0x7C,0x38 ,       // ASCII -  98
    0x00,0x38,0x7C,0x44,0x44,0x6C,0x2C,0x00 ,       // ASCII -  99
    0x00,0x38,0x7C,0x44,0x49,0x3F,0x7F,0x40 ,       // ASCII - 100
    0x00,0x38,0x7C,0x54,0x54,0x5C,0x58,0x00 ,       // ASCII - 101
    0x00,0x00,0x48,0x7E,0x7F,0x49,0x0B,0x02 ,       // ASCII - 102
    0x00,0x48,0x7C,0x34,0x34,0x2C,0x68,0x44 ,       // ASCII - 103
    0x00,0x41,0x7F,0x7F,0x08,0x04,0x7C,0x78 ,       // ASCII - 104
    0x00,0x00,0x44,0x7D,0x7D,0x40,0x00,0x00 ,       // ASCII - 105
    0x00,0x60,0x60,0x04,0x7D,0x7D,0x00,0x00 ,       // ASCII - 106
    0x00,0x41,0x7F,0x7F,0x10,0x78,0x6C,0x44 ,       // ASCII - 107
    0x00,0x00,0x41,0x7F,0x7F,0x40,0x00,0x00 ,       // ASCII - 108
    0x00,0x7C,0x7C,0x0C,0x78,0x0C,0x7C,0x78 ,       // ASCII - 109
    0x00,0x44,0x7C,0x7C,0x08,0x04,0x7C,0x78 ,       // ASCII - 110
    0x00,0x38,0x7C,0x44,0x44,0x7C,0x38,0x00 ,       // ASCII - 111
    0x00,0x04,0x7C,0x78,0x24,0x24,0x3C,0x18 ,       // ASCII - 112
    0x00,0x18,0x3C,0x24,0x24,0x78,0x7C,0x00 ,       // ASCII - 113
    0x00,0x44,0x7C,0x78,0x4C,0x04,0x1C,0x18 ,       // ASCII - 114
    0x00,0x48,0x5C,0x5C,0x74,0x74,0x24,0x00 ,       // ASCII - 115
    0x00,0x00,0x04,0x3E,0x7F,0x44,0x24,0x00 ,       // ASCII - 116
    0x00,0x3C,0x7C,0x40,0x40,0x3C,0x7C,0x40 ,       // ASCII - 117
    0x00,0x04,0x1C,0x3C,0x60,0x30,0x1C,0x04 ,       // ASCII - 118
    0x00,0x1C,0x7C,0x30,0x1C,0x30,0x7C,0x1C ,       // ASCII - 119
    0x00,0x44,0x6C,0x3C,0x10,0x78,0x6C,0x44 ,       // ASCII - 120
    0x00,0x44,0x4C,0x1C,0x70,0x64,0x1C,0x0C ,       // ASCII - 121
    0x00,0x4C,0x64,0x74,0x5C,0x4C,0x64,0x00 ,       // ASCII - 122
    0x00,0x08,0x08,0x3E,0x77,0x41,0x41,0x00 ,       // ASCII - 123
    0x00,0x00,0x00,0x7F,0x7F,0x00,0x00,0x00 ,       // ASCII - 124
    0x00,0x41,0x41,0x77,0x3E,0x08,0x08,0x00 ,       // ASCII - 125
    0x00,0x02,0x01,0x01,0x03,0x02,0x02,0x01 ,       // ASCII - 126
    0x00,0x60,0x78,0x4E,0x47,0x5E,0x78,0x60};         // ASCII - 127

    #define None        0x00
    #define Strike      0x10
    #define DblStrike   0x24
    #define Underline   0x80
    #define Overline    0x01

int main(void){
	char MyDat;
        int i,j;

        Initialize();

        PINSEL0=0x00000000;
	IODIR0=0xFFFFFFFF;

        PINSEL1=0x00000000;
	IODIR1=0xFFFFFFFF;

        CLRBIT(IODIR0,BTN);

        LCD_Init();
        SETBIT(IOPIN0,LED1);

        CLS();
        LCDString("AtomSoftTech    ",0,None,0,0);
        LCDString("   .info        ",0,None,1,0);
        LCDString(" Nokia 7110 LCD ",0,None,3,0);
        LCDString("Author:",1,Underline,5,0);
        LCDString("Jason Lopez     ",0,None,7,0);
        while(GETBIT(IOPIN0,BTN));
        DelayMs(10);

        CLS();
        LCDString("Page 2          ",0,None,0,0);
        while(GETBIT(IOPIN0,BTN));
        DelayMs(10);
	while(1){

	}

}


void DelayUs(int us) {
  int tmp;
	for (; us>0; us--);
          for(tmp=0;tmp<1000;tmp++); // or for(tmp=1000;tmp>0;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)  {

   
	// Setting Multiplier and Divider values
  	PLL0CFG=0x23;
  	feed();
  
	// Enabling the PLL */	
	PLL0CON=0x1;
	feed();
  
	// Wait for the PLL to lock to set frequency
	while(!(PLL0STAT & PLOCK)) ;
  
	// Connect the PLL as the clock source
	PLL0CON=0x3;
	feed();
  
	// Enabling MAM and setting number of clocks used for Flash memory fetch (4 cclks in this case)
	MAMCR=0x2;
	MAMTIM=0x4;
  
	// Setting peripheral Clock (pclk) to System Clock (cclk)
	VPBDIV=0x01;

}


void feed(void)
{
  PLL0FEED=0xAA;
  PLL0FEED=0x55;
}

void LCD_Init(void){

    SETBIT(IOPIN0,BTN);
    SETBIT(LCDP,DC);

    DelayMs(8);
	LCD_Reset();        
	LCD_Send(0xA6,0);	//Display: Normal
	LCD_Send(0xA3,0);	//LCD Bias Settings: 1/7
	LCD_Send(0xA1,0);	//ADC Selection: Reverse
	LCD_Send(0xC0,0);	//Common Output: Normal Direction
	//LCD_Send(0xC8,0);	//Common Output: Upside Down
	LCD_Send(0x22,0);	//Set the V5 output Voltage
	LCD_Send(0x81,0);	//Set Electronic Volume Register
	LCD_Send(0x2E,0);	//Power Controller Set: Booster circuit: ON/Voltage regulator circuit: ON/Voltage follower circuit: OFF
	LCD_Send(0x2F,0);	//Power Controller Set: Voltage follower circuit: ON
	LCD_Send(0xE3,0);	//Non-OPeration Command
	LCD_Send(0x40,0);	//Set the start line
	LCD_Send(0xAF,0);	//LCD On
	LCD_Send(0xA5,0);	//Display All Points: ON
    DelayMs(17);
	LCD_Send(0xA4,0);	//Display All Points: NORMAL

}

void CLS(void){
	unsigned char i,x;
	unsigned char line;
	line = 0xB0;

	for(x=0;x<9;x++){
		LCD_Send(line,0);	
		LCD_Send(17,0);
		LCD_Send(2,0);

		for(i=0;i<0x60;i++){
			LCD_Send(0x00,1);
		}
		line++;
	}
}

void SendByte(unsigned char data){
	char x;

	for(x=0;x<8;x++){
		CLRBIT(LCDP,SCL);
		CLRBIT(LCDP,SDO);
    		if(data & 0x80)
                SETBIT(LCDP,SDO);
		SETBIT(LCDP,SCL);
		data <<= 1;
	}
}

void LCD_Send(unsigned char cmd, unsigned char type){
	if(type){
        SETBIT(LCDP,DC);
    } else {
		CLRBIT(LCDP,DC);
    }

	CLRBIT(LCDP,CS);
	SendByte(cmd);
    SETBIT(LCDP,CS);
}

void LCD_Reset(void){
    SETBIT(LCDP,CS);
    DelayMs(8);
    SETBIT(LCDP,RST);
    DelayMs(8);
}
void LCDChar(unsigned char letter,unsigned char font,unsigned char style,unsigned char top, unsigned char left){
    unsigned char myData,x;
    unsigned char leftH,leftL;

	top += 0xB0;
	left += 18;
	leftH = (left >> 4) | 0x10 ;
	leftL = left & 0x0F ;

	LCD_Send(top,0);		//Page 0 (0xBx (x = page))
	LCD_Send(leftH,0);		//Column Upper Nybble (0x1x) (x = upper Nybble)
	LCD_Send(leftL,0);		//Column Lower Nybble (0x0x) (x = upper Nybble)

	letter -= 0x20;

    if(font){
		for(x=0;x<8;x++){
			myData = Font8x8[((letter*8) + x)] | style;
			LCD_Send(myData,1);
		}
    } else {
		for(x=0;x<5;x++){
			myData = Font5x7[((letter*5) + x)] | style;
			LCD_Send(myData,1);
		}
    }
    LCD_Send((0|style),1); //Spacer
}
void LCDString(const char *str,unsigned char font,unsigned char style,unsigned char top, unsigned char left){
	while(*str != 0){
        LCDChar(*str++, font, style, top, left);
        if(font)
            left += 9;
        else
            left += 6;
	}
}

Works!!! yay!
 
Last edited:
Hey Mark check these mods i added:

MOD 1: Female header added...
Top Side:
mod1-jpg.31305


Circuit Side:
mod1-1-jpg.31306


9v Snap: ( use them with the 4AA holder ) so for me its a 6v Snap :D
Full View:
mod2-jpg.31307


Circuit Side:
mod2-1-jpg.31308
 

Attachments

  • mod1.jpg
    mod1.jpg
    95.1 KB · Views: 1,402
  • mod1.1.jpg
    mod1.1.jpg
    87.5 KB · Views: 1,392
  • mod2.jpg
    mod2.jpg
    57.6 KB · Views: 1,365
  • mod2.1.jpg
    mod2.1.jpg
    35.8 KB · Views: 1,348
I did the same thing with an old PIC development board I had. In fact I still have it on the shelf. It's pretty ancient. (Ancient by my standards; not by the standards of the old guys who used vacuum tubes here.)

I know you got it as a deal, but I'm not a fan of those development boards with everything on them. They're too bulky. I had to make up my own plug in header board for the SAM7. The pins go above the board as well as below, so I can clip on the logic analyzer test leads.

(firefox is making my images look like crap for some reason.)
 

Attachments

  • 20090710-prototype-001.jpg
    20090710-prototype-001.jpg
    355.1 KB · Views: 439
  • 20090710-prototype-002.jpg
    20090710-prototype-002.jpg
    224.3 KB · Views: 340
  • 20090710-prototype-003.jpg
    20090710-prototype-003.jpg
    259.3 KB · Views: 269
heh... firefox on my side shows them well :D Thats a niec board. I havent dont a PCB in a long ...long time and i want to start so bad! Especially with these SMD parts.

I think i would have a ball making small boards like that for testing and using on a breadboard. Then making a final product.

The reason i like these larger boards is mainly because im a lazy guy . If i can save time by having a few buttons, sd card, buzzer, leds, usb, serial stuff already wired up and in a good configuration then i will love it. If anything i can simply copy the schematic with only the parts i need and save tons of time.

I due love those smaller boards because you have more choices of what goes where.
If i was you i would make small Mikro type addon boards. Where you can simple attach a header to that small board and have buttons and ect... ready to use.

Just give me a few weeks to get everything straight and ill try to create a board...

Remember this tho... if its crappy but works its ok but if it looks nice and fails its bad :D
 
heh... firefox on my side shows them well :D
It looks too dark on mine, and apparently it's because FF 3.5 uses colour profiles, but doesn't support ICC4. Check one of the pictures out in another browser like IE and tell me if it looks the same, would ya.


by the way where can i buy a 20 pin IDC cable like that?

That one came with my JTAG unit, but I did make one when I made that old wiggler. I just bought the ends and used a portion of old IDE or floppy ribbon cable. If I can find the part numbers for the ends, I'll post them.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top