Jump to content

Dip Switch Calc


3guk

Recommended Posts

Posted

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

  • Replies 31
  • Created
  • Last Reply
Posted
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
Posted

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

Posted
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).

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

Posted

Why whats wrong with highend gear ?!

 

Would you guys like one the other way round too ??

 

Regards

Posted
how do you calculate it in your head? whats the formula or order?

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!

Posted

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

Posted

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: 100

first power of 2 < 100 = 64

so

100 - 64 = 36. 64 is needed, we have 36 left

36 - 32 (32 is next power of 2) = 4. 32 is needed

16 wont work. so we have a 16 in the 16's column

8 likewise

4 works, and leaves 0. 4 is needed

2 isn't

1 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 1

0 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.

Posted
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.

Tis a complicated way of saying exactly the same as every one else and explains why I'm not a teacher!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.