Hi,
I would like to read an analogue voltage of 0-5V, and serially send (32 bits) to a LCD display. I just need to know how the conversion will work from getting a byte from the ADC and converting it to 32 bits so that it can go into the display (Lascar ddm4. RS components186-2679). I would like 0-5V to represent 0-100 on the display. The display consists of 4 digits, each digit has 7 segments with decimal points, the 32 bits represent the on/off of each segment effectively. Any ideas would be most appreciated!
The display consists of 4 digits, each digit has 7 segments with decimal points, the 32 bits represent the on/off of each segment effectively. Any ideas would be most appreciated!
My idea is that you should post a link to the device.
When developing the sketch, first, figure out what value needs to be sent to display " 1". Then, " 2", etc. When you can display each digit from 0 to 9 in the first position, determine what needs to be done to display the digits in the second, third, and 4th positions.
After that, reading a value from the analog pin, scaling it, and displaying the scaled value will be trivial.
The device i'll use is the leanardo. I can figure out what each of the 32 bits relate to on the display.Just cant get my head round how decisions will be made to drive display depending on the ADC value.The long way is mapping all 256 ADC combinations and assign them individual 32 bit patterns for the display-just seems long winded!
I thought you were looking at some graphic display but what you have is a 4x7 numeric display. All you need is a multi-digit seven segment LCD display driver chip. This will take the digital data I understand you already have, and drive the display for you. Very short-winded.
Yes I have a 4x7 display that will handle all the data. Could you guide how I take the ADC value and translate it on the fly to input to the display.Would I need to generate a table or something similar for each ADC step with the corresponding 32bit display value?
clulus:
Could you guide how I take the ADC value and translate it on the fly to input to the display.Would I need to generate a table or something similar for each ADC step with the corresponding 32bit display value?
No. I have now had a look at that device and, if nobody else can help you either, it wouldn't surprise me. I doubt that you have to do all that tabular stuff but, if you do, considering an alternative display might be a better option. On reflection, I submit the best thing you can do with that PoS is put it in the bottom drawer and invest $5 or so on a 4X7 LED display that is twice the size and a MAX7221 driver - devices that are known loved and understood by the multitude hereabouts.
If you must have a 4x7 LCD, I believe the ZD 1886 works essentially the same way as as 4x7 LED and might even use the same driver IC. No tables, just send it data like you would anything else in Arduinoland.
But you might be better off putting the same $$$ into a commonly-used 16x2 LCD, which is even simpler to get up and running.
You should only need to pre-define the 10 digits you need to dispay (0-9) and then convert the ADC reading (0-100) to separate digits and bit bang them to the display. To scale the 0-1023 value from the ADC to 0-100 use the map command.
For reference here is the datasheet http://docs-europe.electrocomponents.com/webdocs/002d/0900766b8002dbb3.pdf
I would like to give an example of what I am having problems sorting:
To the left is the ADC reading, middle value I would like to clock to the DDM4 display.Right value is what the display will actually show.
ADC value Dig 1 Dig2 Dig3 Dig4(Unused) Display reading
00000000=01111110 00000000 00000000 00000000 = 0
11111111=01111110 01111110 01111110 00000000 = 100
Obviously I will need the values inbetween but it would take ages to type out!
I am unsure how to compute this ADC value to the 32bit value to send the display.
Any ideas most appreciated!
clulus:
I would like to give an example of what I am having problems sorting:
To the left is the ADC reading, middle value I would like to clock to the DDM4 display.Right value is what the display will actually show.ADC value Dig 1 Dig2 Dig3 Dig4(Unused) Display reading
00000000=01111110 00000000 00000000 00000000 = 0
11111111=01111110 01111110 01111110 00000000 = 100
Sorry but I'm finding your description confusing. Firstly the arduino ADC is 10 bits so you get a value between 0 and 1023 but your second example is only showing an 8 bit ADC value of 255 for 100.
The sequence for ADC=0 looks correct but the sequence for ADC=255 (or whatever it's meant to be) would display on the LCD as 000. To get 100 on the LCD Dig 1 would need to be 00011000. For the example you show (255) the sequence would be
11111111=11101100 11101100 10110110 00000000 = 255
All you need to do is define the LCD segment patterns for the digits 0-9, something like this...
const byte digs[] = {
B01111110, // 0
B00011000, // 1
B10110110, // 2
B10111100, // 3
B11011000, // 4
B11101100, // 5
B11101110, // 6
B00111000, // 7
B11111110, // 8
B11111100; // 9
};
then loop through the number you want one digit at a time and extract it's bit pattern from the array.