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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

2,098件の閲覧回数
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 件の賞賛
返信
3 返答(返信)

2,082件の閲覧回数
MSR
Contributor I

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

Thanks in Advance.

0 件の賞賛
返信

2,078件の閲覧回数
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 件の賞賛
返信

2,052件の閲覧回数
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 件の賞賛
返信