AnsweredAssumed Answered

STM32F091RC IO toggle

Question asked by luke on Nov 6, 2016
Latest reply on Nov 7, 2016 by luke
<p>Hello, I just started out with arm mcu's. I am using the Nucleo Board with the STM32F091RC mcu. </p>

<p>I encountered a problem that seems logically correct, however I receive no response from the board whatsoever. </p>

<code> if((GPIOC->IDR &= (1ul << 6)) == 0) {

<p>This is the code I am using such that when I press a switch(on PC.6), the output(PC.8) will start toggling. Set Rest(pin, set/Reset) function toggles the pin. </p>

<p>My problem is in the first statement i.e. <code> if((GPIOC->IDR &= (1ul << 6)) == 0) </code> When I assign it to 1, i.e. == 1, the output doesn't respond to switch inputs </p>

<p>Logically I am seeing no error, I expect when assigning the statement to 0, the output will toggle when asserted by the switch and when assigned to 1 the output will <strong>not</strong> toggle </p>

<p><em>Note that the switch is active low, i.e. by default the input pin, PC.6 is at logic high </em></p>