Nine Bit Binary Compare
Posted: Wed Mar 07, 2012 5:56 pm
All,
I’m embarking on a project that will require me to compare a binary number from an external source with a binary number entered into Flowcode. If they are the same, an output goes high. All fairly straightforward, except I need to be able to count to 1000 so I need 9 bits. My processor is a PIC 18F4520 which is, of course, 8 bits so I’ll need to “borrow” a bit from a second port. My first thought was to simply divide the ports into high-byte and low-byte and do separate comparisons. The problem is that would take more than twice as many clock cycles as a single port and speed is also an issue since the external binary number could be changing as fast as every microsecond. I would very much appreciate any thoughts from the community on how I might do this in the most efficient manner, preferably without the use of C or Assembly as I’m not terribly advanced in that level of programming.
Thanks,
Jim Bell
I’m embarking on a project that will require me to compare a binary number from an external source with a binary number entered into Flowcode. If they are the same, an output goes high. All fairly straightforward, except I need to be able to count to 1000 so I need 9 bits. My processor is a PIC 18F4520 which is, of course, 8 bits so I’ll need to “borrow” a bit from a second port. My first thought was to simply divide the ports into high-byte and low-byte and do separate comparisons. The problem is that would take more than twice as many clock cycles as a single port and speed is also an issue since the external binary number could be changing as fast as every microsecond. I would very much appreciate any thoughts from the community on how I might do this in the most efficient manner, preferably without the use of C or Assembly as I’m not terribly advanced in that level of programming.
Thanks,
Jim Bell