Bit testing

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
mikey
Posts: 4
Joined: Fri Nov 14, 2008 10:04 pm

Bit testing

Post by mikey »

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
Attachments
818tx+Int.fcf
(8.5 KiB) Downloaded 235 times

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: Bit testing

Post by Steve »

I think you are using an "output" icon instead of an "input" icon just before the decision icons.

mikey
Posts: 4
Joined: Fri Nov 14, 2008 10:04 pm

Re: Bit testing

Post by mikey »

steve wrote:I think you are using an "output" icon instead of an "input" icon just before the decision icons.
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?

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: Bit testing

Post by Steve »

My suggestion was to change the "output" icons to "input" icons...

mikey
Posts: 4
Joined: Fri Nov 14, 2008 10:04 pm

Re: Bit testing

Post by mikey »

steve wrote:My suggestion was to change the "output" icons to "input" icons...
Sorry, I meant to say ' input ' icons. I did this as I said in my reply but to no avail.

Post Reply