Last active
December 20, 2015 03:19
-
-
Save alepez/6062849 to your computer and use it in GitHub Desktop.
Calculate 24xx eeprom addresses relationship with A0-A1-A2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8.times { |i| p "0x#{(0x50 + i).to_s(16)} => A0: #{(i & 0x1) == 1 ? "HIGH" : "LOW "}, A1: #{((i & 0x2) >> 1) == 1 ? "HIGH" : "LOW "}, A2: #{((i & 0x4) >> 2) == 1 ? "HIGH" : "LOW "}" } | |
# "0x50 => A0: LOW , A1: LOW , A2: LOW " | |
# "0x51 => A0: HIGH, A1: LOW , A2: LOW " | |
# "0x52 => A0: LOW , A1: HIGH, A2: LOW " | |
# "0x53 => A0: HIGH, A1: HIGH, A2: LOW " | |
# "0x54 => A0: LOW , A1: LOW , A2: HIGH" | |
# "0x55 => A0: HIGH, A1: LOW , A2: HIGH" | |
# "0x56 => A0: LOW , A1: HIGH, A2: HIGH" | |
# "0x57 => A0: HIGH, A1: HIGH, A2: HIGH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment