Colin Mitchell
- Aug 31, 2014
- 1,416
- Joined
- Aug 31, 2014
- Messages
- 1,416
There are 7 possibilities with xxx0
0000 0010 0100 0110 1000 1100 1110
0000 0010 0100 0110 1000 1100 1110
1 bit -> 2 results (0 | 1)There are 16 results from 4 bits. Bit testing a single bit does not tell you anything as each bit has 4 different possible results.
No, it doesn't. A bit in the generally known sense has only two states: 0 or 1.Each bit has 4 different possibilities in this case.
Of course you have.bit 0 will have 0000 0010 0100 0110 1000 1010 1100 1110 that corresponds with the last bit being zero and you haven't done much by just testing for bit zero.
A jump table is better than either of the methods discussed in this thread.
I've gone back to have another look as I nearly abandoned this project! Theres a purpose built TX/RX ic set that will work directly with the DTMF decoder and output serial data to interface with an FM short range module. However I have plenty of unused pic16f876 to use so it's a question of getting my head around the programing where I need the guidance. I had no idea with regards to masking, however the links Collin put up proved useful. Cracked that obstacle.. at least I'm getting there slowly.
Here's the subroutine. It's now only 10 lines. Once you get this working, you can add toggle.