If I understand correctly you are clocking in all bit 7's followed by all bit 6's down to all bit 0's Try the following: acc = 0 for (int j=0; j<8; j++) { acc = (acc << 1) + count_one_bits(read_port()) } count_one_bits() could be implemented as a lookup table Sorry I don't have time to convert this to assembler. Regards Sergio Masci ----- Original Message ----- From: Ishaan Dalal To: Sent: Thursday, June 26, 2003 4:23 AM Subject: Re: [PIC]: 8-byte vertical adder? > > I have no idea what you mean by "vertically stacked data". Data is in > > RAM. Left, right, up, and down orientations are rather meaningless. > > For example, for bytes A...H > > 0x0020 LSB_A LSB_B LSB_C LSB_D ..... LSB_H > 0x0021 .. > 0x0022 .. > 0x0023 .. > 0x0024 ... > 0x0025 .. > 0x0026 .. > 0x0027 MSB_A MSB_B MSB_C MSB_D .... MSB_H > > > You have 8 bytes of data you want to add, so just add them. The PIC can > > do an 8 bit add in one instruction. What's the problem? > > Scott suggested the standard store vertically and then rotate each into > 8 different registers (thanks for the complete workthrough!). There wouldn't > be enough time on the "momma PIC" end to process these before the next round > of bitstreams started pouring in. I'll probably look at lowering my sample > rate -- then this might work. > > Cheers, > Ishaan > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads