>----------
>From: Josh Koffman[SMTP:
listsjosh
spam_OUT3MTMP.COM]
>Sent: Friday, September 12, 2003 6:53 PM
>To:
@spam@PICLISTKILLspam
MITVMA.MIT.EDU
>Subject: [PIC]: Data Bus Issue
>
>
>
>>Ok, this is half EE, half PIC. I'm designing a circuit that uses a 4 bit
>>data bus (plus a few flow control lines) to transfer some values between
>>a 16f877 and a Scenix SX28 chip. I'd like to put these chips close
>>together to avoid long PCB traces. I don't have to use specific pics to
>>transfer the data, but ideally it I could get 4 pins to line up between
>>the two chips ie, RA0-RA0, RA1-RA1, RA2-RA2, RA3-RA3. That way all the
>>data I transfer is correct LSB-MSB without having to do some sort of
>>software translation on it.
>>
>>
>
>
>
>>However, all is not going quite so easily. Both chips use a similar
>>numbering convention, so pins on the left of the chip increase in value
>>as they go down, and pins on the right increase as they go up. For
>>example:
>>RA0 |\/| RB7 RA0 |\/| RB7
>>RA1 | | RB6 RA1 | | RB6 (these are just for
>>RA2 | | RB5 RA2 | | RB5 illustration only)
>>RA3 | | RB4 RA3 | | RB4
>>etc
>>
>>
>
>
>
>>So things don't line up nice. I'd like to avoid a huge copper trace
>>spider's web trying to fix that. I'd even thought about rotating one
>>chip 180degrees, but the problem remains.
>>
>>
>
>
>
>>So my questions. Short of putting one chip on top of the board and one
>>on the bottom, can anyone think of an easy solution? Secondly, does
>>anyone have a routine for reversing the order of bits in a byte? If I
>>transfer data and it ends up MSB-LSB order swapped, what is a good way
>>to swap it back? I could just use a bunch of btfsc's I suppose.
>>
>>
>
>
>
>>Thanks,
>>
>>
>
>
>
>>Josh
>>
>>
>
>To reverse the bits in a byte, shift the byte to the right and shift a second byte
>to the left. After 1 right shift, CY has the LSB of the first byte. Shift the second
>byte left and CY ends up as the LSB of byte #2. After 8 shifts, byte 2 has
>byte #1 in bit reverse order. If you only want the lower 4 bits of #1, shift 4
>times. Use swapf to exchange nybbles if needed.
>
>John Power
>
>--
>
http://www.piclist.com hint: PICList Posts must start with ONE topic:
>[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
>
>
>