Rank: Administration
Groups: Administration, Customer Joined: 10/24/2006(UTC) Posts: 3,979 Location: Nashville, TN
Thanks: 25 times Was thanked: 89 time(s) in 83 post(s)
|
here is how it is implemented. The first case is the default (both pins pulled up). #define FIRSEL_LOWA 6,2,0,0b001 #define FIRSEL_LOWB 6,2,0,0b011 #define FIRSEL 6,2,0,0b000 #define OSR_LOW 7,6,5,0 #define OSR_MED 7,6,5,1 #define OSR_HIGH 7,6,5,2 if (bit_is_set(PINB,PIN3) && bit_is_set(PINB,PIN1)) { setRegBits(FIRSEL_LOWA); setRegBits(OSR_LOW); } if (bit_is_set(PINB,PIN3) && bit_is_clear(PINB,PIN1)) { setRegBits(FIRSEL_LOWB); setRegBits(OSR_LOW); } if (bit_is_clear(PINB,PIN3) && bit_is_set(PINB,PIN1)) { setRegBits(FIRSEL); setRegBits(OSR_MED); } if (bit_is_clear(PINB,PIN3) && bit_is_clear(PINB,PIN1)) { setRegBits(FIRSEL); setRegBits(OSR_HIGH); } Edited by user Monday, February 14, 2011 4:24:39 PM(UTC)
| Reason: Not specified
|