Hi guys, I've setup 16 LEDS on PORTC and PORTD and have joined them both to form a full 32bit PORT. Both ports are full 16bits each.
When I turn each bit ON using GPIO PAD DATA OUTPUT REGISTER for PORTs C & D, all LEDS 0 to 31 turn ON or turn off individually.
When I write a full 32bit word to PORTC the last 2 bits (bits 30 and 31) will not turn ON but setting them individually bits 30 and 31 work fine. I find that to be pretty STRANGE. LOL.
Here's my code, can anyone see a problem with this?
.equ base, 0xC3F90000
.equ portcd, base+0x0C04 // PORT C &D Parallel register
// I HAVE ALREADY SET ALL BITS in PORT C & D to OUTPUT.
lis r29,portcd@h // PORTC & D Parallel output address register
ori r29,r29,portcd@l
lis r28,0xFFFFFFFF@h // r28 = 32bit number.
ori r28,r28,0xFFFFFFFF@l
stw r28,0(r29) // This should turn ALL bits on PORT C & D on but Bits 30 and 31 not turning on.
Can't use PORT C & D to create a 32 bit bus if bits 30 and 31 won't turn on.
Any help here would be very much appreciated.
Thanks guys and hope to hear from you soon.
Pete
Solved! Go to Solution.
Hi, according description it is all shifted two bits left. PCR number always fits to PDO number.
PPDO[x][y] = PDO[(x*32)+y]
PCR30-45:
x*32+y=30 => PPDO[0][30]
x*32+y=45 => PPDO[1][13]
PCR46-61:
x*32+y=46 => PPDO[1][14]
x*32+y=61 => PPDO[1][29]
Hi, according description it is all shifted two bits left. PCR number always fits to PDO number.
PPDO[x][y] = PDO[(x*32)+y]
PCR30-45:
x*32+y=30 => PPDO[0][30]
x*32+y=45 => PPDO[1][13]
PCR46-61:
x*32+y=46 => PPDO[1][14]
x*32+y=61 => PPDO[1][29]
Hi David, thank you for the info.
Ahhhh, so I write directly to the PCR registers and not the Parallel registers.
Why have the parallel registers if they don't match up to 16bits.
Ok, I'll give that a go.
Thanks David for your support, very much appreciated.
Have a great day
Peter