How to configure GPIO as output port for MPC5604B(32 bit)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to configure GPIO as output port for MPC5604B(32 bit)

Jump to solution
1,640 Views
shri
Contributor II

i'am new to this MPC5604B 32 bit controller.i wanted to make port F as output port.how do i make it. And i need to send 16bit data out of these port continuosly .how do i do it.Will this piece of code work.Thank you.

 

for(j=0;j<16;j++)

{

SIU.PCR[80 + j].R = 0x0200;

}

while(1)

{

SIU.PGPDO[2].R = 0x0000FFFF;

}

 

Tags (2)
0 Kudos
Reply
1 Solution
1,030 Views
shri
Contributor II

Oh my god, I got it

instead of 

for(j=0;j<16;j++)

{

 SIU.PCR.R[80+j] = 0x0200;

}

i did used this

for(j=0;j<16;j++)

{

 SIU.PCR.R[80+j] = 0x0203;

}

Now it works

 

 

View solution in original post

0 Kudos
Reply
3 Replies
1,030 Views
shri
Contributor II

why no one replying to this question.it is very urgent.plz replay

0 Kudos
Reply
1,030 Views
TomE
Specialist II

> why no one replying to this question.it is very urgent.plz replay

 

Mainly because your code doesn't show the sending of any data at all. You don't say what sort of output you want. Do you want to control single bits on and off or are you trying to write data to a 16 bit peripheral? If you want the latter then tou haven't mentioned write strobes or control pins.

 

if it is so urgent, have you TRIED your code at all? What happened?

 

Have you searched for example code anywhere? Have you downloaded Linux ports and looked for examples?

 

for(j=0;j<16;j++){    SIU.PCR[80 + j].R = 0x0200;}

 That looks like it should set the 16 pins to be GPIO outputs.

 

while(1){    SIU.PGPDO[2].R = 0x0000FFFF;}

 Without seeing the code that defines what ".R" means I have no idea. You want to write your user data as a 16-bit write to the lower 16 bits. There's probably a definition in the header where ".R" means 32-bit write and there are two other ones that mean "16 bit upper" and "16 bit lower". You should be using one of them.

 

Continuously writing in a hard loop isn't going to do anything useful. You only have to write data ONCE for the port to then drive that data until you write something else to the port.


Tom

 

0 Kudos
Reply
1,031 Views
shri
Contributor II

Oh my god, I got it

instead of 

for(j=0;j<16;j++)

{

 SIU.PCR.R[80+j] = 0x0200;

}

i did used this

for(j=0;j<16;j++)

{

 SIU.PCR.R[80+j] = 0x0203;

}

Now it works

 

 

0 Kudos
Reply