<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Texte brut Car";
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
span.TextebrutCar
{mso-style-name:"Texte brut Car";
mso-style-priority:99;
mso-style-link:"Texte brut";
font-family:"Calibri","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR-CA link=blue vlink=purple><div class=WordSection1><p class=MsoPlainText><span lang=EN-CA>Hi all,<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-CA>I found my problem (I think).<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-CA>No interrupts for this job.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-CA>The following polling code works very well.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'>while(1)<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'>{<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'>. <o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'>.<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> ////////// read rotary encoder here ///////////// <o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> currentStateCLK = ROTARY_B;<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> <o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> if (currentStateCLK != lastStateCLK && currentStateCLK == 1)<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> {<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> if (ROTARY_A != currentStateCLK) <o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> {<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> scale_counter --;<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> // currentDir ="CCW";<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> } <o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> else <o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> {<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> // Encoder is rotating CW so increment<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> scale_counter ++;<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> //currentDir ="CW";<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> } <o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> }<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'><o:p> </o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> // Remember last CLK state<o:p></o:p></span></b></p><p class=MsoPlainText><b><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:red'> </span></b><b><span style='font-size:10.0pt;font-family:"Courier New";color:red'>lastStateCLK = currentStateCLK; <o:p></o:p></span></b></p><p class=MsoPlainText><b><span style='font-size:10.0pt;font-family:"Courier New";color:red'> <o:p></o:p></span></b></p><p class=MsoPlainText><b><span style='font-size:10.0pt;font-family:"Courier New";color:red'> __delay_us(500); <o:p></o:p></span></b></p><p class=MsoPlainText><b><span style='font-size:10.0pt;font-family:"Courier New";color:red'>.<o:p></o:p></span></b></p><p class=MsoPlainText><b><span style='font-size:10.0pt;font-family:"Courier New";color:red'>.<o:p></o:p></span></b></p><p class=MsoPlainText><b><span style='font-size:10.0pt;font-family:"Courier New";color:red'>.<o:p></o:p></span></b></p><p class=MsoPlainText><b><span style='font-size:10.0pt;font-family:"Courier New";color:red'>}<o:p></o:p></span></b></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";color:black'><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-CA>Now everything works well even with a 1msec interrupt on TIMER1.<br>Blinking a variable every 200 interrupts.<br>When the encoder moves it bilnks the choice on an LCD<br>at a rate of 1/(2x200msec) => 2,5Hz rate.<br>When the encoder's push button is pressed<br>change is then accepted and the display stops blinking.<br>Polling the encoder's A & B pins. No encoder missed counts so far..<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-CA>THANK YOU FOR YOU ALL !<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-CA>JP<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New";color:black'><o:p> </o:p></span></p></div></body></html>