Good mornig and for all of you a happy new year !!

I hope one or all of the members can help with my little problem. I'm rebuilding a dasboard for a VW T3 on the RPM side. The RPM-clock was no problem but there are two signals that i want to check and those are fuel en coolwatertemp.
By lack of space in the clockbox i will use a 08M2 and the I2C connection for the display. No problem so far. Then it becomes tricky because i see only one ADC input en one DAC output.

My question: how do i realise to use the one ADC for two signals or can change the DAC to an ADC-input.

All suggestions are welcome.

Have a nice day !!,



Senior Member
Hi Hans,

Welcome to the forum and a Happy New Year.

You can use a PWM output (with a small external low-pass RC filter) for a DAC output. Much lower output impedance and higher resolution (10 bits versus 5 bits) than the internal DAC. There's only one "official" PWM output on the 08M2 (c.2) but we might be able to find another method.

Even the 08M2 has three ADC inputs (c.1, c.2 and c.4) and you can even use the "DAC" output pin as an ADC input (ReadDAC) if you're desperate (and not using it as a DAC).

The I2C does rather eat up two valuable pins (c.1 and c.2) but might be "bit banged" on other pins if essential. However, there are limits on how much I/O you can get with an 8 pin chip ! ;)

Cheers, Alan.


Technical Support
Staff member
You need I2C ( two pins ) and two ADC inputs. The only way to implement an 08M2 solution with two separate ADC inputs would be to use bit-banging for I2C.

Bit-banged I2C should not be too difficult to achieve and there would be help available here for implementing that.

It would be recommended to get the display working with hardware I2C from a breadboard or prototype so you know that does work. That will avoid trying to figure out if it's the bit-banging code or what is being sent which is a problem if the bit-banging solution doesn't immediately work, will give a better chance of it doing so.


Senior Member
My question: how do i realise to use the one ADC for two signals or can change the DAC to an ADC-input.
Sorry, I didn't read your question carefully enough.

You can use (hardware) I2C on c.1 and c.2 and read an ADC signal on c.4. Then the DAC can be used as an ADC input by using the ReadDAC command:

The DAC has a high source resistance; set it to DACLEVEL 16 and the input/output impedance is about 30k ohms (or it can be set even higher with few "special" commands). The only problem is that the pin MUST remain as a digital output for Programming and at power-up. So you should connect a "safety" resistor of perhaps 1k between the PICaxe pin (c.0) and the analogue voltage source. If high accuracy is required, then the PICaxe can calculate the "offset errors" caused by the source impedances.

Alternatively use any two of the available ADC inputs and "bit bang" the I2C. SDA needs the remaining (digital) I/O pin but SCL is generally output-only. This might be the serial output / programming pin (c.0) , or I might put a FET (2N7000) and 1M pull-down resistor on c.3 and switch it on and off with a PULLUP 8 command. It's even "possible" on c.5 if you need another digital input for something else. ;)

Cheers, Alan.
More "disguisting"details: First of all; the whole I2C technics is not familiar for me. I grow uo with 6502,6800 and Z80 processors but as an grandpa i still claim my place in the digital world. Ha, ha.
The two ADC signals are voltages coming from an NTC in cilinderhesd and potentiomater in the fueltank. Both are voltages fluctuating between 1 and 12V but with resisteor devider that isn't the problem. I already fixed that wit an standard output port and and a ICshaped chip relais so i can swith from one to the other.
I got stuck with controlling the I2C LCD-unit which has an adres $0x27 or $0x3F. It is not clear for me how to send data to the LCD. The adressing part is the problem. I use the setup command as follows: hi2csetup i2master, $27,i2cslow,i2cbyte.
This means for me that i made my 08M2 master, the slave adres will %00100111, dataspeed is set at slow and the adres one byte long. Correct??
When i program my PICAXE the screen stays blank although i get no errrors with prechecking or programming.
What is wrong me? Sorry with my program
At this moment a think with melanchally for my 6502 :giggle:


Senior Member
I got stuck with controlling the I2C LCD-unit which has an adres $0x27 or $0x3F.

Those are obviously "7-bit" addresses, but PICaxe uses 8-bit addressing (with the LSB always 0). So try address $4E or $7E.

Ah yes, the 6502 was a real "Programmers" micro. But as an "Engineer", I preferred the Z80. ;)

Cheers, Alan.


New Member
If the address is 0x27 or 0x3F where the least significant bit is 1, it suggests perhaps that this is 7-bit addressing, and the address needs to be shifted left as described in the manual under hi2csetup ...
Most datasheets give the slave address in 8 bit format e.g.
1010000x - where x is don’t care (the read/write bit, PICAXE controlled)
However some datasheets use a 7 bit format. In this case the bits must be shifted
left to take account for the read/write bit.
which I think makes them 0x4E and 0x7E (01001110 and 01111110)
Well that was a disapointing experience. The only result i get regardles which adres i use is line filled with highlighted character positions. But that is all. At this moment i put the I2C trip ar a holt and take an 18M2 chip. I have redesign my circuitboard but that goes faster then trying to understand I2C. Maybe in a retirementhome sitting in my wheel chair and drewling over my notes i will try to understand it again.
For the rest thanks for all of you and again it's proven: You cann't teach an old dog new trics ;-)


Senior Member

Firstly, have you checked the Contrast potentiometer/voltage on the LCD display?

However, if it is one of the LCDs with an "I2C Backpack", then they are not easy to drive. They require 4-bit data with "clock/enable" signals elsewhere in the transmitted bytes. But it has been done with a PICaxe and there should be program code here on the forum, so don't give up yet. ;)

Cheers, Alan.


Senior Member
You cann't teach an old dog new trics
Hey--this old dog (8080/Z80-era) is still learning, and some older on the forum are as well, so don't give up so quickly. Exactly which i2c LCD is this? Please post your code within the tags, "[ code]" and "[ /code]" (but without the spaces), plus a clear photo of your rig. The forum is likely to be able to get you running if you persist.
Hello Ibenson. It's not a matter of quiting so quickly but i need the dashboard in my VW-van. So its easier for me to design a new circuitboard because i am good in doing that (i think) On the otherhand there is no pressure on the design and it is always good for the VW-van Dash mark 12 ;-)
Take notice please of the image that i made. the indentity on the chip is PCF85741 from that Lightbulb Factory in Holland (PHILIPS) The jumper is for backlight and the trimpot is for intensity. adressing should be 0x27 or 0x3F.
I hope you can make cake of it (correct expression?) or bake something else ;-)



Senior Member

Hmm, Philips ICs have been "branded" NXP for many years now, but it will probably work fine. ;)

Yes, those LCD modules are very well-known but not all quite the same. There are various code versions on the forum, but this quite recent "Finished Project" looks like it might be a good starting point. But don't struggle with it, the total program need be only 10 or 20 lines. As we mentioned, above, the address byte will NOT be 0x27 or 0x3F. ;)

Cheers, Alan.
I noticed that the post #2 they used a code that is for PIC's not for the PICAXE. How do I enter that in my PICBASIC? Secondly Ibenson speaks about PIC 8574 but as far i can read the label it is a PIC 85741. Any difference between them.

Can i copy the code as flat text as we called here and paste it in the PICAXE Editor? I did probably something wrong because i was doing two things and i am afraid that some female qualities starts taken over ;-)


Senior Member
I noticed that the post #2 they used a code that is for PIC's not for the PICAXE
Not sure what you mean. If you mean the code in post # 2 of the first thread I linked to, that's straight (if somewhat unusual) PICAXE code. It's possible that you can just paste it into PE6, download and run it, and this will appear on the 4 lines of your LCD (if it is 4x20):
Line 1 8901234567890
Line 2
Line 3
Line 4
If not, tell us what happens (adjust PICAXE 20M2 to suit your picaxe, but I think it should work for any M2 or X2).

(I just copied and pasted it into PE6, and it passes the syntax check.) If it's just 2 lines, delete or comment out the part that writes to lines 3 & 4, although if you leave them in, it probably won't matter.
Last edited: