Hello Everyone,
Having a little trouble with some coding. I have a manufacturer's product that I decided to reprogram. It is a 16F687 chip that connects its outputs to some MOSfets. They are all arranged in a row from 1-10, but the pins used are not. I wanted to be able to use coding like this:
This style makes it easy to see which MOSfets are turning on and in essence is easy on the eyes, but the pins are arranged like this:Code:ZigZag DATA Word %0000000001, 2
DATA Word %0000000010, 2
DATA Word %0000000100, 2
DATA Word %0000001000, 2
DATA Word %0000010000, 2
DATA Word %0000100000, 2
DATA Word %0001000000, 2
DATA Word %0010000000, 2
DATA Word %0100000000, 2
DATA Word %1000000000, 2
DATA Word %0100000000, 2
DATA Word %0010000000, 2
DATA Word %0001000000, 2
DATA Word %0000100000, 2
DATA Word %0000010000, 2
DATA Word %0000001000, 2
DATA Word %0000000100, 2
DATA Word %0000000010, 2
DATA Word %0000000001, 2
DATA Word %0000000000, 0
RC5, RC0, RC4, RC1, RC3, RC2, RC6, RB4, RC7, RB6
As you can see, they are not in order, so if I used the above format, the outputs won't zigzag like the layout, but rather be randomly jumping around.
So my question is this, is there a way to reassign the bits after reading the zigzag code above? In plain english, I want it to say:
read pin 0 (from zigzag) and display it on RC5
read pin 1 (from zigzag) and display it on RC0
etc....
Is there a way to do this? The obvious thing would be to set up the traces in the correct order, but this is the manufacturer's board and I'm reprogramming it to do something else. I was told to use something like translating the bits, but the sample code did not work and I can't find anything else anywhere.
The rest of my code reads each line from above and displays them one line at a time. But with this board, you can imagine how it's going to jump around.
Thanks for your help in advance,
Tony