issues with pins ganged

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
joel_4789771
Level 2
Level 2
5 sign-ins Welcome! First solution authored

Working with board -059, I am trying to join two output pins (digital outputs) in order to feed more current to a sensor (ganed pins):

pastedImage_0.pngpastedImage_5.png

pastedImage_4.png

The C code I write is the following:

pastedImage_3.png

When I download the code to the -059 board, without connecting together  both pins, only one pin outs the pulsed signal (0-5 v), and the other signals always 0v.

When I connect both pines together, the signals is just 0-2.5 v...

What am I missing?. Am I properly calling every pin on the c code? My intention is to get a single ganged signal pulsed with 0-5 v.

Thanks for the answer 

0 Likes
1 Solution
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

1/ Do I have to replace the initial code by yours, within the for loop?.

2/ Just add your code? If so, where?.

Please replace your code " Pin_Write(1); " with "Pin_Write(3);". 

Because if you ganged the two sensors, you should use two bits to control it.

View solution in original post

0 Likes
3 Replies
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

Modify: Pin_Write(1); to Pin_Write(3);

You can check the source code :

void Pin_1_Write(uint8 value)

{

    uint8 staticBits = (Pin_1_DR & (uint8)(~Pin_1_MASK));

    Pin_1_DR = staticBits | ((uint8)(value << Pin_1_SHIFT) & Pin_1_MASK);

}

0 Likes

Good morning LinglinhG_46, thanks for the answer.

Sorry for the simple question, but I do not know what to do with your code:

1/ Do I have to replace the initial code by yours, within the for loop?.

2/ Just add your code? If so, where?.

Thanks for the help

0 Likes
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

1/ Do I have to replace the initial code by yours, within the for loop?.

2/ Just add your code? If so, where?.

Please replace your code " Pin_Write(1); " with "Pin_Write(3);". 

Because if you ganged the two sensors, you should use two bits to control it.

0 Likes