readout PC3 set PD0

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm looking for a simple piece of code to do this:

PC3=high --> PD0=high
PC3=low --> PD0=low

The other bits must not be influenced by the code.

Thanks for your help

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

try this

if(PINC&(1<<PINC3))
PORTD |=(1<<PD0)
else
PORTD &= ~(1<<PD0)
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you!