Port registers on the uno


hi folks,

i've been tinkering uno (just started learning) , need can read 16 pin inputs, read fast. had approached "serial" approach, reading pin pin, think not fast enough, i'm exploring port registers: http://www.arduino.cc/en/reference/portmanipulation, reads entire port @ once instead of pin pin.

i hooked heathkit electronic testing kit (http://j2phenom.iheartanthony.com/wp-content/uploads/2012/03/wpid-1330981223835.jpg) such connected 4 inputs (arbitrary number) dip switch uno's port d's pins 0-3, wrote "digitalwrite(portb, digitalread(pind))" read high/low's port d, , write port b. port b (pins 8-11) wired led outputs on heathkit display outputs read uno dip switches.

the idea want verify can read each individual dip switch inputs (whether high or low) , write heathkit led outputs (for example, 1111 on dip switches = 1111 on leds, 1010 on dip switches = 1010 on leds, etc etc).

the problem: if 4 of dip switches on high, 4 heathkit leds high (on). however, if turn number of dip switches low position, of leds go low (off).

does make sense? can offer suggestions/advice? in advance!

wayne

quote
can offer suggestions/advice?
attach sketch using <> icon in posting menu.


Arduino Forum > Using Arduino > Microcontrollers > Port registers on the uno


arduino

Comments