<?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>Question about keypad?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/19059/question-about-keypad</link><description> I had post a same message before. 
Timer0 scan a 3*4&amp;#39;s keypad with 10mS Interval,and var Key will be changed to a value when button be pressed or 0xff when all buttons be unprssed.Every button include 4 letters,like,one button has &amp;#39;1&amp;#39;,&amp;#39;a&amp;#39;,&amp;#39;b&amp;#39;,&amp;#39;c&amp;#39;and</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Question about keypad?</title><link>https://community.arm.com/thread/97617?ContentTypeID=1</link><pubDate>Mon, 31 Oct 2005 08:28:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ddef32bc-9bff-4f91-930b-6a9e008c847f</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;basic keypad code (assuping you drive columns and read rows.&lt;br /&gt;
1) feed all columns, if no row,: no key&lt;br /&gt;
2) scan columns till row active = key found&lt;br /&gt;
3) at exit if now_key is not = prev_key ignore&lt;br /&gt;
4) if 2 identical reads and result different from last key presented present key.&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about keypad?</title><link>https://community.arm.com/thread/73594?ContentTypeID=1</link><pubDate>Sat, 29 Oct 2005 22:50:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ac29bc09-f9e5-4dd3-99c2-372eb223d8d2</guid><dc:creator>Nantian Gumo</dc:creator><description>&lt;p&gt;The first thinking as following :&lt;br /&gt;
&lt;pre&gt;
void Timer0(void) interrupt 1
{
		if (bKeyDwF == 1 &amp;amp;&amp;amp; bKeyRdyF == 1)	 		//Twice scan finished
        {
			cCount ++;
			if (KeyTemp0 == KeyTemp1)		 		// scan result being same would changed value to var Key
                Key = KeyTemp0;
	            else Key = 0xff;			 		// Or Key would be changed to NUll (0xff)
			bKeyFree = 0;
            bKeyDwF = 0;
            bKeyRdyF = 0;
 		}

        if (bKeyDwF == 1 &amp;amp;&amp;amp; bKeyRdyF == 0)	 		//Scanning a Key the second time
        {
            KeyTemp1 = Scan();
            bKeyRdyF = 1;
        }

        if (bKeyDwF == 0 &amp;amp;&amp;amp; bKeyRdyF == 0)	 		//Scanning a Key the first time
        {
            KeyTemp0 = Scan();
            bKeyDwF = 1;
        }





		if (Key == 0xff )
		{
			bFF = 1;	    						//Set unpressed Flag;
		}
		if (Key != ETB &amp;amp;&amp;amp; Key != ESC &amp;amp;&amp;amp;	Key != SPR &amp;amp;&amp;amp; Key != PDW &amp;amp;&amp;amp; Key != 0xff)
		{
			if (bLetterNum == 0)					//Resolve Keys in Letter mode
			{
				if (Key != cKeyTemp)   				//A new Key pressed;
				{
					cKeyTemp = Key;	   				// Key value be taken to  buf;
					cHarKey = KBChar[Key][0];  		//Return the key &amp;#39;s first value ;
					cCount = 0;
				}
				else 				 				//The same Key pressed ;
					{
						if(bFF == 1)  				//The same Key unpressed ;
						{
							cCount = 0;
							cHarKey = KBChar[Key][cKBCount];  			// Return the Key &amp;#39;s another value
							if (cKBCount &amp;lt; 3)
							{
								cKBCount ++;
							}
							else
								{
									cKBCount = 0;
								}
							bFF = 0;									//Clear unpressed Flag;
						}


					}
			}
			else if (bLetterNum == 1)	 								//Resolve Keys in Number mode
				{
					if (Key != cKeyTemp) 								//A new Key pressed;
					{
						cKeyTemp = Key;
						cHarKey = KBChar[Key][0];  						// Return the Key &amp;#39;s first value ;
						cCount = 0;
					}
					else 			   									// The same Key pressed ;
						{
							if (bFF == 1) 								// The same Key unpressed;
							{
								cCount = 0;
								if (Key == 0 || Key == 9)				//Resolve mutil_value Key
								{
									if (Key == 0 )
									{
										if (cKBCount != 0)
										{
											cHarKey = &amp;#39;-&amp;#39;;	  			//Return the NEG symbol;
										}
										else
										{
											cHarKey = &amp;#39;0&amp;#39;;
										}

									}
									else if (Key == 9)
										{
											if (cKBCount != 0)
											{
												cHarKey = &amp;#39;.&amp;#39;;	  		// Return the value point
											}
											else
												{
													cHarKey = &amp;#39;9&amp;#39;;
												}
										}

									if (cKBCount &amp;lt; 1)			 		// The mutil_value Key counter;
									{
										cKBCount ++;
									}
									else
										{
											cKBCount = 0;
										}
								}
								else
									{
										cHarKey = KBChar[Key][0];  		//Not mutil_value Key,return the Key &amp;#39;s first
									}							   		//value immediately;
								bFF = 0;  // Clear unpressed flag;

							}



						}

				}


		 	if (cCount == 8)  											//The same Key pressed 8 times
			{
				bValKey = 1;  											// Set the valid Key &amp;#39;s flag,CHARKEY would be main() taken to resolve;
			}
		}

}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about keypad?</title><link>https://community.arm.com/thread/44966?ContentTypeID=1</link><pubDate>Sat, 29 Oct 2005 14:40:33 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e86436a6-4ffc-494a-8c2f-62eb13f022b5</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;I had post a same message before.&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
and have you been thinking about it during the intervening time?&lt;br /&gt;
What ideas have you come up with?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about keypad?</title><link>https://community.arm.com/thread/44965?ContentTypeID=1</link><pubDate>Sat, 29 Oct 2005 14:38:27 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:74b03ab5-4f35-47d2-a302-437a3d531d2c</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;Sounds like a &lt;b&gt;State Machine&lt;/b&gt; would be an ideal approach to this problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>