BitIO enable/disable pin

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

BitIO enable/disable pin

Jump to solution
1,062 Views
avnergidron
Contributor III

Hi,

I want  to use the processor expert BitIoLddin order to enable and  disable output and input pins.

I  read this tutorial: Tutorial: Bits and Pins with Kinetis and the FRDM-KL25Z Board | MCU on Eclipse

I am  currently able to turn the red led on and off using the BitIO component (which have the BitIOLdd).

My code is doing the following:

(1) Turn on  Red led. (Bit1_SetVal();)

(2) Turn off Red Led. (Bit1_ClrVal();)

The problem is that after (2) runs and turn off the led it turns on again  in the next line of code...

 

Thanks,

Avner

Labels (1)
0 Kudos
1 Solution
851 Views
BlackNight
NXP Employee
NXP Employee

Hi Avner,

the LED is low active, so putting the pin LOW with ClrVal() will turn the LED on.

Check the schematics of your board :-).

Erich

View solution in original post

0 Kudos
4 Replies
851 Views
BlackNight
NXP Employee
NXP Employee

Could you share your code? I would put it into an endless loop with some waiting method (you can get the Wait component from SourceForge: McuOnEclipse Releases on SourceForge), like this:

for(;;) {

  RED_SetVal(RED_DeviceData);

   WAIT1_Waitms(100); /* wait 100 ms */

  RED_ClrVal(RED_DeviceData);

   WAIT1_Waitms(100); /* wait 100 ms */


Erich

0 Kudos
851 Views
avnergidron
Contributor III

Hi Erich,

Sorry for the long delay in replying.

I tested what you suggested and this is working,  turning the led on  and off.

When I changed it to run only  five times, it acted the same, but at the end it left the led turned on.

This is how I define the BitIO:

Untitled1.png

and my main is:

code_print_screen.png

Thanks,

Avner

0 Kudos
852 Views
BlackNight
NXP Employee
NXP Employee

Hi Avner,

the LED is low active, so putting the pin LOW with ClrVal() will turn the LED on.

Check the schematics of your board :-).

Erich

0 Kudos
851 Views
avnergidron
Contributor III

Thanks

0 Kudos