Several levels of analog input from one PWM and another question.

I am trying to achieve something. Is that possible to using one PWM signal to split up maybe four analog input 0-255 means the analog input has level from 0-5v 256-511 means the second analog input h as level from 5-10v and so on up to 1023 which is the max resolution in MEGA2560. If the second analog input voltage has exceed then it do not read more than 512 of binary value or the small microcontroller in the analog input does not update the pwm source if it has no any electric input when the software turn it prompt without decreasing electric current. I may have demultiplexer to switch to analog input #4 which means from 768 to 1023 in PWM signal. Is that possible ? It might save byte size to have four PWM pins for 16 different equiments with demultiplexer to decide which equipment that shall become updated than 16 PWM signals which the MEGA2560 just provides up to 11 PWM pins.

Is that possible to make such configuration: PORT, not DDR and PIN, for example byte B 0000 0101 provide the continous analog circuit that 0 is off in arduino but in analog circuit means just low power and 1 means high power; so, it means always electric. If B0000 0000, means something still there to make 4-bits means 2^(4+4), not 2^(4); thus, I have 256 different values with that way circuit. I am asking this question because I want to use less bits to provide more values in demultiplexer because I not need to demand bit 0 to be absolutely off, but on and second higher electric on.

This post made my head spin.

Tell us what you want to do, without explaining how you think it should be done. Leo..

Is that possible to using one PWM signal to split up maybe four analog input 0-255 means the analog input has level from 0-5v 256-511 means the second analog input h as level from 5-10v

1) It sounds like you are confused with a PWM signal which is an output and an analogue input. 2) An PWM signal only gives you 256 levels of output between 0 and 5V. 3) The only way to get more than 5V from a PWM signal is to amplify it, either before the filtering with a transistor to give a range of say 0 to 10V, or after the filter with an op-amp adding a 5V DC offset on the signal. 4) The problem with splitting things up like this is ensuring monoticity. That means that an increase in digital numbers always results in an increase in analogue voltage. This imposes tight tolerance limits on each of the four stages which are difficult to achieve.

This post made my head spin.

Me too, I found it very confusing and maybe I have misunderstood what you intended to do, what with you using input and output in a wrong manor.

I can't even figure out if input or output is wanted!

Wawa: This post made my head spin.

Tell us what you want to do, without explaining how you think it should be done.

Hmmm.

I want that ONE PWM pin shall provide four aviation instruments. As you mentioned PWM value up to 255 and 5V. Then I want to have #1 0-63, #2, 64-127, #3 128-191, then #4 192-255. If I want to update one of three remained gauges, then the first turn suddendly off but at the other end, it has an small microcontroller that has just 1x analog input and one PWM to provide constant speed in the servo motor. Such as this: http://no.rs-online.com/web/p/microcontrollers/7559408/

To have levels in one PWM output and 4 analog input

1 level has one diode connected to avoid too much current to the analog input and something that prevent the analog input to read lower value so it will receive no electric current.

When it turn to another level, it prompt turned off completely before send a new PWM value suddently.

As Grumpy_Mike said that is difficult to achieve tight tolerance limit with such configuration. Hmmm...Maybe still possible if having something item that can such as potentiometer that avoid wearing error in time elapsing.

As I mentioned, I want to having an external circuit that read bit 0 but still has low electric currency. For example, let us say we have 2 bits. 00 = demultiplexer pin #1 01 = #2 pin to connect to the correct equiment. 10 = #3 11 = #4, the power source that provide the pins in this demultiplexer is NEVER completely off. When I using this configuration, the pins in microcontroller are always dedicated to this demultiplexer. I want more logic flip flop with this configuration than using 2x 4:16 demultiplexer in 8 pins, I want to using 4 pins as 4^4 because the external circuit breadboard has ALWAYS electric current wandering. But also possible to turn this electric circuit off thus I cannot write value to logic flip flops. If I building that, then 4 bits in PORT is available for other purposes!

Can you provide a link for these aviation instruments - its really hard to follow your post and you haven't provided any diagram of your proposed circuits. You mention having individual microcontroller driving servo motors too which is confusing.

I am sure if you explained fully what you are wanting to drive, we can figure out a way to drive them, and I am pretty sure your scheme is unworkable (though its not clear what your scheme actually is).

and maybe a little schematic of what you already have .....

it is not an XY problem, it is a SH (spinning head) problem ;-)

I want that ONE PWM pin shall provide four aviation instruments.

What instruments ? Why do you want this ?

As you mentioned PWM value up to 255 and 5V.

If you want "0-63", you need to write code that sends "0", increments by some value, waits some designated period of time, and so forth until it reaches the value of 63.

2, 64-127

If you want "64-127", you need to write code that sends "64", increments by some value waits some designated period of time, and so forth until it reaches the value of 127.

3 128-191,,

If you want "128-191", you need to write code that sends "128", increments by some value and so forth until it reaches the value of 191.

4 192-255.

If you want "192-255", you need to write code that sends "192", increments by some value waits some designated period of time, and so forth until it reaches the value of 255.

If I want to update one of three remained gauges, then the first turn suddendly off but at the other end, it has an small microcontroller that has just 1x analog input and one PWM to provide constant speed in the servo motor.

I have no idea what you are trying to say here.

Such as this: http://no.rs-online.com/web/p/microcontrollers/7559408/

HELLO ! This is an arduino forum, NOT A PIC FORUM !

To have levels in one PWM output

(see above)

A PWM can only have ONE duty cycle at any given moment. period.

and 4 analog input #1 level has one diode connected to avoid too much current to the analog input and something that prevent the analog input to read lower value so it will receive no electric current.

No idea what you are saying here.

When it turn to another level, it prompt turned off completely before send a new PWM value suddently.

No idea what you are saying here.

As Grumpy_Mike said that is difficult to achieve tight tolerance limit with such configuration. Hmmm...Maybe still possible if having something item that can such as potentiometer that avoid wearing error in time elapsing.

Nonsense

As I mentioned, I want to having an external circuit that read bit 0 but still has low electric currency.

Are you using Google Translate ? There is no such thing as "electric currency" . What is that , some kind of electric money ?

For example, let us say we have 2 bits. 00 = demultiplexer pin #1 01 = #2 pin to connect to the correct equiment. 10 = #3 11 = #4, the power source that provide the pins in this demultiplexer is NEVER completely off.

No idea what you are saying here.

When I using this configuration, the pins in microcontroller are always dedicated to this demultiplexer

. Ok , I understand that. So what ?

I want more logic flip flop with this configuration than using 2x 4:16 demultiplexer in 8 pins, I want to using 4 pins as 4^4 because the external circuit breadboard has ALWAYS electric current wandering.

What are you trying to say ? (you want more I/O ?) Maybe you should use an arduino instead of a PIC.

But also possible to turn this electric circuit off thus I cannot write value to logic flip flops. If I building that, then 4 bits in PORT is available for other purposes!

What ?

Several levels of analog input from one PWM and another question.

Are you aware that PWM is NOT an analog input ?

You are asking for a bow that shoots bullets or a gun that fires arrows.

PWM & analog input same as apples and oranges.

It is possible to convert PWM to analog but not the other way around (now directly anyway). What do you want ? PWM ? OR ANALOG INPUT ? WHICH ? (they are not the same)

It sounds like you are describing a DAC application.

Here’s attachment I described.

there's no attachment

raschemmel: there's no attachment

Maybe now that works?!

Can you please tell us what the devices are you are wanting to drive - part number, datasheet, something...

Yeah , actually , I don't know what that is but it's not a schematic. I've been in electronics 30 years and I have no idea what that means.

Why don't you try again to explain what you want in plain english. Starting by listing all the equipment /components that comprise you hypothetical circuit. Then describe what you want to do. You can't use a PWM output for different values. It can only be one value at a time. It can only be a 5V signal so I don't know why you have "10v" in two places on your drawing.

Last but not least, PWM is NOT an analog signal so you are talking about two different kinds of signals and you can not discuss them both in the same sentence.

Can you please tell us what the devices are you are wanting to drive - part number, datasheet, something...

I think that's the least of our worries.We need to determine what dialect of electronics is being spoken here because I don't recognize it.

raschemmel: Yeah , actually , I don't know what that is but it's not a schematic. I've been in electronics 30 years and I have no idea what that means.

Why don't you try again to explain what you want in plain english. Starting by listing all the equipment /components that comprise you hypothetical circuit. Then describe what you want to do. You can't use a PWM output for different values. It can only be one value at a time. It can only be a 5V signal so I don't know why you have "10v" in two places on your drawing.

Last but not least, PWM is NOT an analog signal so you are talking about two different kinds of signals and you can not discuss them both in the same sentence.

I think that's the least of our worries.We need to determine what dialect of electronics is being spoken here because I don't recognize it.

LOW means 1, HIGH means that the power source is double as LOW. That's why I wrote 5v and 10v. I determined that it operate only at 5v, so I want to add an external circuit that can supply another demultiplexer with 10v that the LOW means off with the demultiplexer that operate at 10v. And, the demultiplexer that operate 5v; if it reads 10v then it will be leaked with LED droid that prevent it to become overloaded and means off.

I think that I have found something similar. I have read the specification in the MEGA2560 board that I have bought. It shows that the MCU in it is 8-bit which means that the RAM and SRAM should be max 255 bytes because 2⁸ that is 256-1; but it is 4 banks of 64 kb?! So they have did something with the configuration that 8-bits means 8+8-bits. I do not know how ATMEL organized it.

I know that PWM can be one value at a time; therefore, I have put a value between higher and lower values in each level so the microcontroller that reads the PWM value knows that it shall not be updated again if it receive value 5-7, 15-17, etc to let the many SMALL microcontroller to know the value shall not become updated so the arduino can turn PWM value to zero then switch to another PWM that provide the second small microcontroller with information. That is not necessary with demultiplexer to switch to another servomotor.

Example this: https://www.adafruit.com/products/2442 It is necessary with an small microcontroller that reads the PWM value from arduino then send constant PWM value to this item; one analog input and one PWM output MCU between arduino and continous rotation servomotor.

PWM is not a value tha can be read. It id a digital signal with a duty cycle. You continue to talk about reading PWM when there us no such thing . Nothing yiu have ssid with respect to PWM makes any sense. If you can't start making sense and you are unable to describe the purpise of your objective in terms that make sense, I will have to withdraw from this thread becsuse I am unable to understand your objective .You need to stop talking about "if this happens, then such & such happens and start speaking in terms of: "I need a circuit that acceots "n" "XYZ" type signals and outputs "ABC" type signals , with the following conversion parameters : " etc etc etc"

Example this: https://www.adafruit.com/products/2442 It is necessary with an small microcontroller that reads the PWM value from arduino then send constant PWM value to this item; one analog input and one PWM output MCU between arduino and continous rotation servomotor.

This is a servo and servos do not use PWM, they use PPM with the Servo Library.

know that PWM can be one value at a time; therefore, I have put a value between higher and lower values in each level so the microcontroller that reads the PWM value

Microcontrollers don't read PWM (normally0 although software can be used to determine the duty cycle using PulseIn()

HIGH means that the power source is double as LOW. That's why I wrote 5v and 10v

Go study digital electronics and then come back and speak Electronics. Whatever it is you are saying is not electronics terminology so I have no idea what you are saying. There is no such thing as " double as LOW".

This is the General Electronics topic. You need to be able to speak basic electronics to be understood here. We usually make exceptions for noobies but only when we can make sense of what they are saying.

ANYONE ? When you combine ignorance of Electronics ( both Analog and Digital, as well as microprocessors) with ignorance of the Engish language ( as it relates to Electronics) , the result is complete gibberish that makes no sense and gives you a headache when you try go decypher it. All this talk about PWM, analog multiplexors and addressing bits ( OP doesn't kniw that's what they are called), suggests that what we have here is someone who has learned just enough about electronics to be dangerous, but not enough to understand it or speak the language correctly. Phrases like " double as low" indicate a fundamental abscence of formal education in electronics, similar to an auto mechanic trying to discuss nuclear physics. The only hope of unscrambling this ClusterFxxk of a post is to list all the components in the hypothetical system and draw a block diagram with arrows showing the direction of the data and the inputs to the system and the outputs , along with a truth table, WITHOUT trying to guess what goes INSIDE the boxes since you clearly do not have a clue there.

I'm out of here. Good luck

raschemmel: This is a servo and servos do not use PWM, they use PPM with the Servo Library. Microcontrollers don't read PWM (normally0 although software can be used to determine the duty cycle using PulseIn()

Go study digital electronics and then come back and speak Electronics. Whatever it is you are saying is not electronics terminology so I have no idea what you are saying. There is no such thing as " double as LOW".

This is the General Electronics topic. You need to be able to speak basic electronics to be understood here. We usually make exceptions for noobies but only when we can make sense of what they are saying.

ANYONE ? When you combine ignorance of Electronics ( both Analog and Digital, as well as microprocessors) with ignorance of the Engish language ( as it relates to Electronics) , the result is complete gibberish that makes no sense and gives you a headache when you try go decypher it. All this talk about PWM, analog multiplexors and addressing bits ( OP doesn't kniw that's what they are called), suggests that what we have here is someone who has learned just enough about electronics to be dangerous, but not enough to understand it or speak the language correctly. Phrases like " double as low" indicate a fundamental abscence of formal education in electronics, similar to an auto mechanic trying to discuss nuclear physics. The only hope of unscrambling this ClusterFxxk of a post is to list all the components in the hypothetical system and draw a block diagram with arrows showing the direction of the data and the inputs to the system and the outputs , along with a truth table, WITHOUT trying to guess what goes INSIDE the boxes since you clearly do not have a clue there.

I'm out of here. Good luck

I never studied electronics. My english is my fourth language. The first is norwegian sign language, the second is norwegian writing/reading language, the third is american sign language because I studied in an university in Washington, DC, the fourth is english writing/reading. If a person in internet is saying; "go to hell", I do not become shocked but flat mood and nothing changed in mood; as my brain is sleeping.

PWM stand for Pulse Width Modulation. AnalogRead stand for Analog to Digital Converter. To write pulse to PWM, I must use the DAC chip. To read the PWM, I must using ADC chip in another microcontroller, not the Arduino boards.

About the demultiplexer. See how Atmel has achieved that 8-bit memory in 64kb (65535 bytes) that should be only max at (2^8)-1. That's the algorithm I want to using to achieve more logic flip flop in only 8-bit with something in electric that provide that signal LOW means that there is something and HIGH means another pin to use. Thus, 8-bit LOW and 8-bit HIGH means 8+8 = 16-bit in 8-bit PORT that 0 means an LED diode will not glowing. So I must using a electronic board that ALWAYS provide the LOW signal to have stream. That I want to using instead using 2x 8-bit PORT to achieve 65535 pieces of logical flip flop if I am ever using a lot of that. Do you understood?

About analogread as PWM. I mean another microcontroller read PWM value with ADC chip from the MEGA2560 with DAC chip. MEGA2560 PWM -> another microcontroller -> AnalogRead function processing signal -> PWM value to servomotor.

You still don’t understand what PWM is.

PWM is NOT analogue.

It can’t be read by the analogue input of another micro.

A Mega has NO DAC, NO analogue ouputs.

Again, tell us WHAT you want to achieve.
16-bit LED dimming? servo control?
Leo…

To write pulse to PWM, I must use the DAC chip.

No No No.

To read the PWM, I must using ADC chip in another microcontroller, not the Arduino boards.

No No No.

You can only read PWM with an ADC chip if you FIRST pass it through a low pass filter.