BestTechie Forums: Text Scroll On Lcd - BestTechie Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Text Scroll On Lcd


#1 User is offline   krishnasty 

  • Member
  • Pip
  • Group: Members
  • Posts: 19
  • Joined: 15-July 08
  • Location:pune,india

Posted 28 August 2008 - 12:35 PM

hey guys..
i wanted certain help from u..can anyone give me a small code in c only to display a scrolling text on any lcd(particularly 16x2)..i am using a arm controller..
thnx..

#2 User is offline   jcl 

  • UberTechie
  • Group: Linux Experts
  • Posts: 1304
  • Joined: 30-August 04
  • Location:The Internet
  • Operating System:Arch

Posted 28 August 2008 - 05:42 PM

I doubt it. Even if we could we'd need more information; there are thousands upon thousands of ARM µcs.

#3 User is offline   iccaros 

  • UberTechie
  • Group: Linux Experts
  • Posts: 1292
  • Joined: 31-August 04
  • Location:Great State of Washingtion
  • Operating System:Gentoo,Iccaros-Linux(of course),Slackware,GentooX,Red Hat, Windows (3.1 to VISTA BETA), MAC OSX (10.4 currently),LFS, Solaris 8,9,10, Trusted Solaris, FreeBSD, OPENBSD, NETBSD

Posted 11 September 2008 - 04:51 PM

yes, more information

is the LCD direct connected, parallel or serial LCD. are using a LCD interface. there is no such thing as code that will work on any LCD, as all LCD's or most, use different pin outs.

and which ARM


PIC code could be like this

extern unsigned char delayus_variable;

#if (PIC_CLK == 4)
	#define dly125n please remove; for 32Mhz+ only
	#define dly250n please remove; for 16Mhz+ only
	#define dly500n please remove; for 8Mhz+ only
	#define dly1u asm("nop")
	#define dly2u dly1u;dly1u
#endif

#if (PIC_CLK == 8)
	#define dly125n please remove; for 32Mhz+ only
	#define dly250n please remove; for 16Mhz+ only
	#define dly500n asm("nop")
	#define dly1u dly500n;dly500n
	#define dly2u dly1u;dly1u
#endif

#if (PIC_CLK == 16)
	#define dly125n please remove; for 32Mhz+ only
	#define dly250n asm("nop")
	#define dly500n dly250n;dly250n
	#define dly1u dly500n;dly500n
	#define dly2u dly1u;dly1u
#endif

#if (PIC_CLK == 20)
	#define dly200n asm("nop")
	#define dly400n dly250n;dly250n
	#define dly2u dly400n;dly400n;dly400n;dly400n;dly400n
#endif

#if (PIC_CLK == 32)
	#define dly125n asm("nop")
	#define dly250n dly125n;dly125n
	#define dly500n dly250n;dly250n
	#define dly1u dly500n;dly500n
	#define dly2u dly1u;dly1u
#endif

#if ((PIC_CLK != 4) && (PIC_CLK != 8) && (PIC_CLK != 16) && (PIC_CLK != 32))
	please define pic_clk
#endif

//delay routine

#if PIC_CLK == 4
	#define DelayDivisor 4
	#define WaitFor1Us asm("nop")
	#define Jumpback asm("goto $ - 2")
#endif

#if PIC_CLK == 8
	#define DelayDivisor 2
	#define WaitFor1Us asm("nop")
	#define Jumpback asm("goto $ - 2")
#endif

#if PIC_CLK == 16
	#define DelayDivisor 1
	#define WaitFor1Us asm("nop")
	#define Jumpback asm("goto $ - 2")
#endif

#if PIC_CLK == 32
	#define DelayDivisor 1
	#define WaitFor1Us asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop")
	#define Jumpback asm("goto $ - 6")
#endif

#if ((PIC_CLK != 4) && (PIC_CLK != 8) && (PIC_CLK != 16) && (PIC_CLK != 32))
	please define pic_clk
#endif

#define DelayUs(x) { \
			delayus_variable=x/DelayDivisor; \
			WaitFor1Us; } \
			asm("decfsz _delayus_variable,f"); \
			Jumpback;
			
/*

timeouts:

C code for testing with unsigned chars & ints, using simulator for verification:

unsigned char timeout_char;
unsigned int timeout_int;
volatile unsigned char x=0,y=1;	//good practice, make main/int vars volatile

while(1)
{
	//for max 491512us timeout @ 8Mhz
	//for max 245756us timeout @ 16Mhz
	timeout_int=timeout_int_us(500);
	b;
	while(timeout_int-- >= 1)
	{
		if (x==y) break;		//typical overhead for checking ring buffer
	}
	b;

	//for max timeout of 1147us @ 8Mhz
	//for max timeout of 573us @ 16Mhz
	timeout_int=timeout_char_us(500);
	b;
	while(timeout_char-- >= 1)
	{
		if (x==y) break;		//typical overhead for checking ring buffer
	}
	b;

}

Time taken:	optimisations on:		9cyc/number loop, 4.5us @ 8Mhz
			with extra check ie:	&& (RB7==1), +3cyc/number loop, +1.5us @ 8Mhz

Formula:	rough timeout value = (<us desired>/<cycles per loop>) * (PIC_CLK/4.0)

*/

#define LOOP_CYCLES_CHAR	9							//how many cycles per loop, optimizations on
#define timeout_char_us(x)	(unsigned char)((x/LOOP_CYCLES_CHAR)*(PIC_CLK/4.0))

#define LOOP_CYCLES_INT		16						//how many cycles per loop, optimizations on
#define timeout_int_us(x)	(unsigned int)((x/LOOP_CYCLES_INT)*(PIC_CLK/4.0))


#4 User is offline   krishnasty 

  • Member
  • Pip
  • Group: Members
  • Posts: 19
  • Joined: 15-July 08
  • Location:pune,india

Posted 14 September 2008 - 10:52 PM

thnx guys.. that code worked with little bit of changes..i just needed d concept of it.i translated it into arm code..thnx..

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users