I have generated a variable number using the ADC on a 16F818. I then used masking to test each bit in turn, to give a long flash on the LED for High or 1, and a short flash for a Low or 0. I have just used two bits to start and test my design.
When the output is 0, 1 or 2. I get : 2-short, 1-long/1-short 1-short/1-long respectively as planned.
However when the output is 3, ( binary 00000011) I get 2-short flashes instead of 2-long ( 1 for each High bit ).
I have tried everything I can think of but cannot solve the problem and move on to read and display all eight bits.
Maybe I have misunderstood how masking works or this is not the method to use. Can anybody help please.
Thanking you in anticipation.
PS. i have attached my flowcode file
Bit testing
Re: Bit testing
Thank you for replying. I tried your suggestion and changed to output icons. The result was worse, not even the reading of the first two bits worked! Am I correct in thinking that masking only allows the selected bit to be read. If so why do they work when the result of NumA is 00000000, 00000001, or 00000010. but not when it is 00000011. The reading of each bit should be a simple High or Low (0 or1), and not influenced by the condition of any other bit. Any thoughts?steve wrote:I think you are using an "output" icon instead of an "input" icon just before the decision icons.
Re: Bit testing
Sorry, I meant to say ' input ' icons. I did this as I said in my reply but to no avail.steve wrote:My suggestion was to change the "output" icons to "input" icons...