3guk Posted July 7, 2005 Posted July 7, 2005 Guys, Just finished coding a DMX dip switch calculator !! I would appreciate it if you guys could have a play and tell me if you find anything wrong. This is my first attempt at javascript and I have tried all the browsers I can think of but there may be some I have forgotten !! http://www.ukslc.org/DMX/DMX.html
peternewman Posted July 7, 2005 Posted July 7, 2005 Your calculator allows you to enter the value 512, but doesn't have the 10th bit so can't display it and instead displays zero. Also have a look at these two from Martin:Dip Switch CalculatorDMX Address Calculator HTH PN
SparkySteve Posted July 7, 2005 Posted July 7, 2005 personally, a bit of paper/hand and a sharpie does me. it isn't that hard to do it in the head either, start at the largest number and work backwards. quite nice to test the brain sometimes instead of relying on gadgets to work it out
ben.suffolk Posted July 7, 2005 Posted July 7, 2005 Hi, You seem to be displaying the dip switches in reverse order, I would expect to see them in the same order as the binary values (i.e. 1 on the right). Otherwise I can confirm it works in Safari on the Mac. Regards Ben
peternewman Posted July 7, 2005 Posted July 7, 2005 You seem to be displaying the dip switches in reverse order, I would expect to see them in the same order as the binary values (i.e. 1 on the right).<{POST_SNAPBACK}>It works the same as the Martin one and I in fact had a long "discussion" with a friend about this. Certainly having just checked the Martin Atomic has its dip switches "backwards". I personally usually do it in my head, although I find it can be quite hard to concentrate in a noisy environment. Although I did write a calculator for my PDA, primarily for fun, so if anyone has a Windows Mobile Pocket PC I can send you a copy. It also seems it doesn't seem to like trying to display 123, "picnum is null or not an object". PN
merlin24 Posted July 7, 2005 Posted July 7, 2005 Works unless you are using Highend gear with dipswitches on.. Andy
3guk Posted July 7, 2005 Author Posted July 7, 2005 Why whats wrong with highend gear ?! Would you guys like one the other way round too ?? Regards
propmonkey Posted July 7, 2005 Posted July 7, 2005 how do you calculate it in your head? whats the formula or order?
Andrew C Posted July 7, 2005 Posted July 7, 2005 how do you calculate it in your head? whats the formula or order? <{POST_SNAPBACK}> All you need to work out is :- How many 1s, 2s, 4s, 16s, 32s, 64s, 128s and 256s there are. There are 10 types of people in the world; those who understand binary, and those who don't!
SparkySteve Posted July 7, 2005 Posted July 7, 2005 if you're looking for say 100... start with 64 - the largest number which fits into 100, then work backwards through the dips i.e. 64 +32 = 96 + 4 = 100 process of elimination... simple yes no to each switch
Modge Posted July 7, 2005 Posted July 7, 2005 My way (and others exist. many many others some of them more mathatical, its a preference thing) is to take the number or aiming for and try to subtract each of the powers of two from it, starting with the bigest one which is smaller than the number in question, then try each one in turn, on whats left. If you can do it then you have a one in that column (turn that dipswitch on). Best demonstrated by an exmple:aimed for: 100first power of 2 < 100 = 64so100 - 64 = 36. 64 is needed, we have 36 left36 - 32 (32 is next power of 2) = 4. 32 is needed16 wont work. so we have a 16 in the 16's column8 likewise4 works, and leaves 0. 4 is needed2 isn't1 isn't.It's worth mentioning at this point (so as the next step makes sense) that the world uses 8 bit bytes i.e. 8 binary digits to represent a number thus if your number uses less than that pad it to 8 with leading 0's.128 64 32 16 8 4 2 10 1 1 0 0 1 0 0 Thus we have it: 01100100 .Now hopefully some one can ethier explain this better \ explain it in a way that works for you. Also you can use windows calc. Yep I did have a courage failour and check It before posting this.
david.elsbury Posted July 7, 2005 Posted July 7, 2005 Meh that's complicated, Modge. (or I'm not smart enough :D )Much prefer SparkySteve's method.Easy, and it works.Or, as said, windows calculator.
propmonkey Posted July 7, 2005 Posted July 7, 2005 which order do the switch go in? 2,4,16... or 256, 128, 64...
Andrew C Posted July 7, 2005 Posted July 7, 2005 which order do the switch go in? 2,4,16... or 256, 128, 64...<{POST_SNAPBACK}>Depends. Everything I can think of off hand is 256, 128, 64... but it seems that it's not universal.
Modge Posted July 8, 2005 Posted July 8, 2005 Meh that's complicated, Modge. (or I'm not smart enough :D )Much prefer SparkySteve's method.Easy, and it works.Or, as said, windows calculator.<{POST_SNAPBACK}>Tis a complicated way of saying exactly the same as every one else and explains why I'm not a teacher!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.