Rearranging data -PIC 16F877 assembler

Thread Starter

atferrari

Joined Jan 6, 2004
4,771
I need to manipulate inputs pins and associated flags. For initial process I need this data arranged as follows:



INA A8 A7 A6 A5 A4 A3 A2 A1
INB B8 B7 B6 B5 B4 B3 B2 B1
INC C8 C7 C6 C5 C4 C3 C2 C1
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - --
ING G8 G7 G6 G5 G4 G3 G2 G1
INH H8 H7 H6 H5 H4 H3 H2 H1

Later, for further process I need the data rearranged like this:

reg1 A1 B1 C1 D1 E1 F1 G1 H1
reg2 A2 B2 C2 D2 E2 F2 G2 H2
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
reg7 A7 B7 C7 D7 E7 F7 G7 H7
reg8 A8 B8 C8 D8 E8 F8 G8 H8

I've been looking for matrix handling, in assembler for a 16F877 but found nothing simple to understand.

Could anyone point me in the right direction or just tell me what is the way to go? I am not asking for code (of course it would be good to have it ready) but for the idea to implement the conversion, back and forth, if necessary.

What I actually need is 8 "channels" with 16 ( 8 plus 8) flags, each.

All what I found in PICLIST related bits handling seem to lead to a unnecessary complex solution.

Thanks for concrete suggestions.
 

vineethbs

Joined Nov 14, 2004
56
ok this is just a suggestion.

y = address (rega)
c1 = 8
loop1:
x = address (inth)
c2 = 8
loop2:
fsr = x
rrf indf
fsr = y
rrf indf # u shift the last bit into carry and shift it back to the msb
x = x - 1
c2 = c2 - 1
loop to loop2 until c2 is 0
y = y + 1
loop to loop1 until c1 is 0

-----------------------
initially h1 will be shifted into carry and shifted back to msb of rega
then notice that rega is kept const and then g1 is pulled out and put into the same o/p register which wud be shifted.
essentially u need to pull off lsbs from all input registers and put them in one register
rotation causes the lsbs to be h1,h2 in seq
 
Top