<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to scan strings from keyboard much clever?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/42603/how-to-scan-strings-from-keyboard-much-clever</link><description> I want to scan string from keyboard and display on LCd ,but when scanning the next string ,the buffer for saving pre_string will be changed to the value in scanning buffer,and the display also will be changed. 
 
so i want a solution for scanning string</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: How to scan strings from keyboard much clever?</title><link>https://community.arm.com/thread/97262?ContentTypeID=1</link><pubDate>Fri, 08 Jul 2005 02:50:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1d5de994-8e16-4ffc-a0b4-0b729fdf93ee</guid><dc:creator>John Donaldson</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry, but I don&amp;#39;t understand your question. Could you try to explain the problem more clearly?&lt;br /&gt;
&lt;br /&gt;
One thought: do you really intend your switch case statements to fall through?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to scan strings from keyboard much clever?</title><link>https://community.arm.com/thread/73326?ContentTypeID=1</link><pubDate>Thu, 07 Jul 2005 09:20:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1c3e5f67-f719-42c1-a6bd-71846fb0135f</guid><dc:creator>Nantian Gumo</dc:creator><description>&lt;p&gt;My program structure as following:&lt;br /&gt;
&lt;pre&gt;
static unsigned char idata sKeyBuf[15]= {0};
static unsigned char idata sScanBuf[10] = {0};
static unsigned char idata cForm = 0,cPrePos = 0;
unsigned char *ptr;

void main()
{
	...
	sprintf(sKeyBuf,&amp;quot;%s&amp;quot;,&amp;quot;12345678&amp;quot;);

	while(1)
	{
		...
		cForm = StateMachine(key); //Scanning the functional key for switiching LCD PAGE
		ptr = ScanKeyboard(Key); //getting the string from keyboard
		ptr = DispFamat(ptr,cForm); //format string for displaying
		if ((cForm / 10) == 2) //getting in one LCD page
		{

			if (cPrePos != cForm % 10)
			{

				switch(cPrePos)
				{
					case 0:PrintFunc(obv,Pos0,sKeybuf); //  disp  full string obverse at position0 only when disp position be changed ;
					case 1:PrintFunc(obv,Pos1,sKeybuf);
					...
					default:break;
				}
				sprintf(sKeybuf,&amp;quot;%s\0&amp;quot;,ptr);//if disp position changed ,the previous string be saved in sKeyBuf;
				cPrePos = cForm % 10; // if disp position changed ,cPrePos changed.
			}

			switch(cForm%10)  //positioning where to display
			{
				case 0:PrintFunc(rev,Pos0,ptr); // disp  string  reverse at position0 every byte input ;
				case 1:PrintFunc(rev,Pos1,ptr);
				...
				default:break;
			}
			...

		}
		...
	}
}
&lt;/pre&gt;
&lt;br /&gt;
when display reverse ,the string can disp rightly,just when disp obverse ,the string in &lt;b&gt;sKeyBuf&lt;/b&gt; be changed as &lt;b&gt;ptr&lt;/b&gt; pointting to. tell me what is the mistake if you found after reading ?&lt;br /&gt;
Thanks all!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to scan strings from keyboard much clever?</title><link>https://community.arm.com/thread/44254?ContentTypeID=1</link><pubDate>Thu, 07 Jul 2005 04:48:41 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:08599c34-2c2e-4a1c-9017-fb6584e0cc8c</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;but when scanning the next string ,the buffer for saving pre_string will be changed&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
So don&amp;#39;t change it, then!&lt;br /&gt;
&lt;br /&gt;
Have a buffer to receive data from the keyboard, and a separate buffer for data to display; you &amp;quot;scanning&amp;quot; stuff should only ever read from the input buffer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>