GPIO-> button and Led [MC51CN128]

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

GPIO-> button and Led [MC51CN128]

904 Views
problem_with_dr
Contributor I

Hi
I have very simple question. I try write program: When i push the button, led light.
I tried this but isn't work.

void main(void){   PE_low_level_init();  for(;;)  {  if(SW_GetVal()=1)      {            LED_SetVal();     }       } }

 



Led component is configurated as Output:

 

  • -Pin for I/O =>PTE3_KBI2P3_TPM1CH0
  • -autoslected pull-up
  • -push-pull
  • -Direction =>Output


SW component is configurated as Input

  • -Pin for I/O =>PTE5_KBI2P5_IRQ_TPM1CH2
  • -autoslected pull-up
  • -push-pull
  • -Direction => Input


I have TWR-MCF51CN(MCU=> MC51CN128)

PS. I don't want to use interrupts. I want use only methods GPIO!

 

Please help me...

0 Kudos
1 Reply

294 Views
DavidS
NXP Employee
NXP Employee

Hi Problem_with_driver,

Best to look at the Freescale MQX 3.6\mqx\examples\gpio\cwmcu63\gpio_twrmcf51cn.mcp project.  It does all of this and more.

The \mqx\examples has a wealth of really good short examples.

Regards,

David