Prop pins equaling more numbers
Humanoido
Posts: 5,770
A hardware question
Eight prop pins can represent 256 unique binary numbers
and nine pins 512 numbers.
But pins are rare. Can less than nine pins do 512 numbers?
Thank sincerely for your reply.
humanoido
Eight prop pins can represent 256 unique binary numbers
and nine pins 512 numbers.
But pins are rare. Can less than nine pins do 512 numbers?
Thank sincerely for your reply.
humanoido
Comments
In parallel: of course not. In serial: you can use a 2 pin protocol to transfer a number of any size. You could e.g. add one ore more serial to parallel shift registers to obtain the parallel result of the serial transfer. An example for such a shift register is the CMOS 4094. If you want to avoid intermediary outputs, you would need 3 pins and use the LE of the 4094 to latch the result after 8 shifts. By using 2 of these chips, connecting Q0 of the first chip to D of the second, attaching the Propeller pin for the data bit to D of the first chip, the pin for clocking to both CLK and the pin to latch the result to both LE, you can shift out up to 16 bit numbers and latch them after 16 shifts.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
He died at the console of hunger and thirst.
Next day he was buried. Face down, nine edge first.
Post Edited (pullmoll) : 3/23/2010 10:27:48 AM GMT
humanoido
I'm not sure what you're talking about. 512 different circuits?
If you want to read an external number which is available as parallel bits, you can use a parallel to serial shift register, or more than one, and do it in a similar way as shifting the bits out. The 4021 is a 8 bit PISO (parallel in, serial out) you could use for that job. Two of them will give you up to 16 bits via 3 Propeller pins.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
He died at the console of hunger and thirst.
Next day he was buried. Face down, nine edge first.
humanoido
This can be extended further using an RC circuit on each pin and measuring the time it takes the pin to charge or discharge. That way, one pin could reliably take on many possible states.
-Phil
humanoido
Post Edited (humanoido) : 3/23/2010 5:41:28 PM GMT
Use more than one pin.
-Phil
If you have different "classes" or types of devices you are addressing, you could also "hard code" some of the digits, and use the switches for the balance. This would reduce the number of pins required while still allowing you to set the specific addresses (more properly, set a portion of them).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
Click here to see my Nomad Build Log
I had changed my post about r/c saying that it would be a workable solution to have three states for each pin. For some reason, the edit was not accepted by the Forum server.
humanoido
What do you mean by "hard code?"
Phil: thanks for explaining the technique of reading a floating pin.
humanoido
Phil said...Make sure you don't have any floating inputs, as they can make the Prop draw excessive power. Either use pull-ups/pull-downs or set unused pins to outputs to reduce power consumption.
Phil said...Just don't connect anything to it. To detect this state, set it to a high output, then set it to an input and read the pin. Do the same with a low output. If the pin reads the same both times, you know it's pulled to that state with a resistor. If it reads differently, you know it's floating.
Phil, just cross-checking this information. With high, low, and floating pins, does this information agree and are any special procedures necessary? Is there a dangerous or undesired software condition to be aware of that could cause less than optimal performance?
humanoido
-Phil
·
Each of those types could be given a 3 bit code (up to eight different devices or more bits for more device types or “prefixes”[noparse];)[/noparse] that was "hard coded" into the application code.· (A host would always be 000, Analog input 001 ...·type 8 module 111)· Then you could have however many inputs you needed to fill out the address, but you save three (or however many) input pins by using the "prefix".
·
This only works if you can "pre assign" a part of the address as described, and depending on what you're doing, this may not be workable.
·
Depending on how bad you need the input pins, and how much circuit board real-estate (and ability to bear costs) you have, you could also hook up a bank of dip switches to the parallel side of a Parallel Serial converter (or shift register, not sure what the proper term is), and read the address in serially.
·
I'm toying with a few of these ideas myself for a network of aquarium sensors.·
·
I'm also looking at possibly doing a "self addressing" daisy chain serial network.· Basically, each unit would have a send and receive data connection.· Each unit would "echo" the communication in and out.· You could then send a command with "set address" and the first unit in the chain would grab address one, the second two, etc.· This would support both a "broadcast" message, as well as messages to/from a specific node.· This method does not help with other types of communication (Ethernet, wireless, etc.)· It depends on a true daisy chain, with each station receiving, interpreting and either responding to and/or passing on (with or without modification) the command packet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
Click here to see my Nomad Build Log
humanoido
humanoido
humanoido
You could probably get the count down lower by using a serial ADC and use a voltage divider to set the address on the input(s).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
Click here to see my Nomad Build Log
Re: "The challenge is... the same program loads into all devices". How is this program loading accomplished without an eeprom? Are all the props loaded in parallel from the same serial bit stream? If so, how are they all synchronized?
If it is possible to load the same program to all the props pullmoll's idea seems to be the most practical way to go. It takes only 3 pins ( 1 to load the data into the shift register, 1 to read the shift register output data, and 1 for clocking the data in) and allows numbers to be any arbitrary bit length.
We're down to 3 pins with this method: (shift register, 3 components)
Actually I see now, by sketching out the circuit, the shift register requires only three pins on the prop side and on the switching side, it can read up to eight bits, with no need for extra serial connections. That's plenty of bits for lots of ID numbers especially in base 3 (thanks Phil). I like this idea because the bits can be changed around with a dip switch. But, it comes with a price - the shift register chip, a dip switch, and a sip resistor array.
This method uses 2 pins: (eeprom, 2 components)
I was overlooking this method, thinking that the eeprom had to boot, but it does not need to boot if relocated to other pins. If it is possible to put the eeprom on pins 26 and 27 instead of 28 and 29, the prop will not try to boot from it and it can be used for storage of a unique sequential ID number and read by prop software. The component count is down too - one chip and one resistor. However, the question is...with lots of props, how will you get the number into the eeprom? I suppose the brute force method is just plug the eeprom into a prop circuit and run software to burn in the number, one eeprom chip at a time... Additional thoughts on this? You mean a lower number of pins? How can you get any lower than the eeprom's two pins? Is there a sketch of this circuit?
humanoido
The ADC was for lower than some of the other methods, not the eeprom.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
Click here to see my Nomad Build Log
Edinburgh Accommodation
NBA and NCAA Picks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Russell Khan
[noparse][[/noparse]000]->[noparse][[/noparse]001]->[noparse][[/noparse]002]->[noparse][[/noparse]003]->[noparse][[/noparse]004]->[noparse][[/noparse]005]->...->[noparse][[/noparse]997]->[noparse][[/noparse]998]->[noparse][[/noparse]999]
On boot-up, the props would look at their input pin and determine if they're the first prop.· All the props that are not the first one would wait to be assigned their number from the previous prop.· You could use a high-speed serial protocol to communicate from one prop to the next.· With a little bit of external logic the zero state on prop number 0 could go away, and a connection could be estabished to the last prop's output pin.· This way, you could create a token ring network that would allow sending messages from any prop to any other prop.
Dave
Edit:· I was editing my post·before I saw·Russell's post.· Quite a coincidence, or maybe the thread was slowing drifting that way.
Edit 2: Oh, I should have read the whole thread.· I see that John R. proposed this yesterday.
Post Edited (Dave Hein) : 3/24/2010 7:12:14 PM GMT
Wow - Unbelievable! We're at 2 pins and no parts.
Advantages? Fewest number of pins, consecutive sequential numbers, no parts, no cost.
Downside? Probably waiting times for assignments to complete (with large numbers of props), no way to "long term" remember the ID number unless eeprom storage is added (process must be repeated at every boot), and any fault in the hardware or software of any previous computer (such as hanging).
humanoido
Post Edited (humanoido) : 3/24/2010 8:50:08 PM GMT
Prop 0 starts up with reset. It copies eeprom contents to ram(like normal) it then inctrements address $7FFF on the EEPROM and allows the next prop to start its boot.
Props will alwasy have same id number in hub ram at location $7FFF
Only con is the EEPROM will wear out after 100,000 boots.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
24 bit LCD Breakout Board now in. $24.99 has backlight driver and touch sensitive decoder.
If you have not already. Add yourself to the prophead map
If I'm understanding your original question correctly, your trying to figure out how to convert an 8-bit value to individually address one of 256 physical lines, like the device in the following:
The left most column with inputs 1 through 8 correspond to the 8-bit addressing, and the right side is pins 1 to 256 that are activated based on the 8-bit address. I don't know if any specific device exists for this function (especially a full 8-bit one), but any mcu with a lot of pins could obviously easily do this.