krishnasty Posted August 28, 2008 Report Share Posted August 28, 2008 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.. Quote Link to post Share on other sites
jcl Posted August 28, 2008 Report Share Posted August 28, 2008 I doubt it. Even if we could we'd need more information; there are thousands upon thousands of ARM µcs. Quote Link to post Share on other sites
iccaros Posted September 11, 2008 Report Share Posted September 11, 2008 yes, more informationis 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 thisextern 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 volatilewhile(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 @ 8MhzFormula: 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)) Quote Link to post Share on other sites
krishnasty Posted September 15, 2008 Author Report Share Posted September 15, 2008 thnx guys.. that code worked with little bit of changes..i just needed d concept of it.i translated it into arm code..thnx.. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.