It is a long time since I used the MCP3201, so I am not current with the information. I will suggest the following change to be made
This change will ensure that only 10 stable level readings will be counted. Any fluctuation will be ignored.Code:if b_level=last_b_level then b_cnt=b_cnt+1 pauseus 500 if b_cnt > 10 then TRISc = %11111111 gosub comenzi ENDIF else b_cnt = 0 endif
The ADC way for reading keys is not the ideal way.
Regards
Jerson
Bookmarks