In S08, port PTC2 not working. Unable to glow LED Red 3

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

In S08, port PTC2 not working. Unable to glow LED Red 3

1,458 Views
Tryhard
Contributor I

Working on MC9S08PT16 controller. Unable to glow LED on PTC2 port. Have tried on multiple boards. Have enabled output ports and disabled input ports. Am I missing something ? Below is my code. Any assistance/code would help. Thank you in advance.

Code:

void main(void) {

PORT_PTCIE = 0x00;

PORT_PTCOE_PTCOE2 = 1;

PORT_PTCPE = 0x00;

PORT_PTCD = 0x00;

while (1) {

PORT_PTCD_PTCD2 = 1;

}

}

0 Kudos
3 Replies

1,442 Views
MSR
Contributor I

I am also having the same issue. any help or code would be greatly appreciated.

Thanks in Advance.

0 Kudos

1,438 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Hi

Normally you on only need

//PTC2's Output Enable Register is set to enable output
PORT_PTCOE_PTCOE2 = 1 ;
//PTC2 pin is driven low (LED OFF)
PORT_PTCD_PTCD2 = 1;

 

I test it on the evk and this is working

 

0 Kudos

1,412 Views
MSR
Contributor I

Hi , 

Finally, I found the solution.

even after doing this PORT_PTCOE_PTCOE2 = 1, we may not be able to get the output.

because the port ptc2 is works based on the priority.

here what the happening is we are having the TSI8 input for the same ptc2 port, so it is giving high priority to the alternate TSI8.  so, we must do the input reading pin zero (0).

TSI_PEN1 |= 0x0.

Now after doing this, it will consider PORT_PTCOE_PTCOE2 = 1 this as high priority and will generate the output.

Regards@MSR ...!

0 Kudos