Need help, STK500/525 and a 3.3v LCD

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, so not sure where to start so I will give a quick over view then my current issue.

I have a stk500 and a 525 using a at90usb1287. My goal is to drive a NHD-0220FZ-FSW-GBW-P-3V3 (2x20 char LCD, 3.3v). So I was running the two piggy backed and ran a simple blinking LED program to make sure it was working and all went well.

Then I took a stock program written by the mfg'er and ported it to work on the 1287. No dice, so then after some trial and error I'm still not sure whats wrong. But I am starting to think that I can't use the 500 as it only does 5v logic. This being the case I wanted use flip and run the 525 solo and set it to 3.3v but I can't connect to the bootloader and I tried reloading it with no success.

Please help! Also just ask for info if you need more to help me, I understand I might not have given enough details.

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

But I am starting to think that I can't use the 500 as it only does 5v logic.

Not true - one of the features of the STK500 is the on-board variable PSU that can easily adjust from 5V to 3.3V and all the STK500 logic is designed to level adjust.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

/facepalm I never found this before. Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
the STK500 is the on-board variable PSU that can easily adjust from 5V to 3.3V
..and reverts back to 5V several seconds after you turn it off and on again possibly damaging 3.3V electronics at the next power up! :evil:

https://www.avrfreaks.net/index.p...

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have another question in regards to the same project. I am confused how to determine which clock I am using and what has priority. Is it the stk500 525 or the internal clock?

I set F_CPU to 1000000 (1M) and my fuses are set to Int. Osc. Please correct me if I am wrong but my understanding is that the fuse is just a quick way to change the cksel register without having to code it. My issue is that using this should give me a 8Mhz clock but using the _delay_ms(); I figured out that I clearly have a 1M clock running I just don't know where its from.

Thanks again

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Is it the stk500 525 or the internal clock?

It is set by your CKSEL fuse selection.
Quote:

my fuses are set to Int. Osc.

Then that's what will be used irrespective of what happens at the XTAL1/XTAL2 pins.

If you are on int and have not changed CKDIV8 then the 8MHz internal *WILL* be divided to 1MHz. rather than messing with the CKDIV8 fuse just do the doble write to CLKPR thing to over-ride the effect of CKDIV8. In fact all programs that have a CLKPR should probably start the program with this anyway so the state of CKDIV8 does not matter.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am posting in this thread just cause its the same project, but new problem.

I am having trouble getting the display to function properly. The set-up is working I get a cursor with a blink etc.

But as soon as I start to write the screen seems to reset. This is my code for writing:

#define F_CPU 1000000UL

#include 
#include  
#include 
#include 
#include 
#include 


/*; I/O pins that are not used are set to be output pins 

; DDRx:  ; 0 = input, 1 = output
; Portx :  1 = pullup resistors ON for input pins, will read 1 initially
*/
//DB for LCD
#define DDRA_Setup     0b11111111    
#define PORTA_Setup    0b00000000


//Controls (E, RS, R/W) 
#define DDRD_Setup     0b11111111    
#define PORTD_Setup    0b00000000    

#define R_W 2 //assigned to port c pins 1-3 //bgr-012-rs/rw/e
#define E   1
#define D_I 0
 
char const text1[] = {"Newhaven Display"};
char const text2[] = {"Character LCD   "};

void home();
void disp_pic();
void command(char);
void write(char);

/*********************************************************/
void home(){
	command(0x01);
	_delay_ms(50);
	//PORTD ^=(1<<PIND7);
}
/*********************************************************/
void nextline(){
	command(0xc0);
	//PORTD ^=(1<<PIND6);
}
/*********************************************************/
void disp_pic(){
	int i;
	home();
	_delay_ms(250);
	_delay_ms(250);
	_delay_ms(250);
	for (i=0;i<16;i++){
		write(text1[i]);
		_delay_ms(250);
		_delay_ms(250);
		_delay_ms(250);
		PORTD ^= (1<<PIND7);
	}
	 nextline();
	 _delay_ms(250);
	 _delay_ms(250);
	 _delay_ms(250);
	 for (i=0;i<16;i++){
		write(text2[i]);
	}
	//PORTD ^=(1<<PIND5);
}
/*********************************************************/
void ioSetup(void)
{

	//Port A

	DDRA  = DDRA_Setup;
	PORTA = PORTA_Setup;

	//Port D

	DDRD  = DDRD_Setup;
	PORTD = PORTD_Setup;
}
/**********************************************************/
void command(char i)
{
PORTA = i; //put data on output Port
_delay_ms(10);
PORTD &= (0<<D_I);
PORTD &= (0<<R_W);
PORTD |= (1<<E); 
_delay_ms(10); //enable pulse width >= 300ns
PORTD &= (0<<E);
_delay_ms(15);
}
/**********************************************************/
void write(char i)
{
PORTA = i; //put data on output Port
PORTD |= (1<<D_I);
PORTD &= (0<<R_W);
PORTD |= (1<<E);
_delay_ms(100); //enable pulse width >= 300ns
PORTD &= (0<<E);
_delay_ms(10);
}
/**********************************************************/
void init()
{
PORTD &= (0<<E);
_delay_ms(100); //Wait >15 msec after power is applied
command(0x30); //command 0x30 = Wake up
_delay_ms(30); //must wait 5ms, busy flag not available
command(0x30); //command 0x30 = Wake up #2
_delay_ms(10); //must wait 160us, busy flag not available
command(0x30); //command 0x30 = Wake up #3
_delay_ms(10); //must wait 160us, busy flag not available
command(0x38); //Function set: 8-bit/2-line
command(0x10); //Set cursor
command(0x0f); //Display ON; Cursor ON
command(0x06); //Entry mode set
}
/**********************************************************/
void main()
{

	
	ioSetup();
	init();
	disp_pic();
	while(1){

	};

}
}