BitIO enable/disable pin

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

BitIO enable/disable pin

跳至解决方案
1,123 次查看
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

标签 (1)
0 项奖励
1 解答
912 次查看
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 项奖励
4 回复数
912 次查看
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 项奖励
912 次查看
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 项奖励
913 次查看
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 项奖励
912 次查看
avnergidron
Contributor III

Thanks

0 项奖励