It seems that in the DAT files AVRX16DD14.DAT to AVRX64DD32.DAT there is a typo in [b:1425574b05]Config-adc0[/b:1425574b05]. In the lines [b:1425574b05]OPTION13DATA[/b:1425574b05] and [b:1425574b05]OPTION14DATA[/b:1425574b05] there is a missing comma between the values [b:1425574b05]$1D and $1E[/b:1425574b05]. Without the correction, the ADC0 setting for measuring the chip temperature, the voltages Vdddiv10, Vddio2div10 and so on are mixed up.
Here is an image showing there has been and currently is the correct display activity after changing TWI channel. Obviously they are not running concurrently which is where the 2x2 library is used..
[quote:e635227bb2]Then you can download and test the attached lib. Same test. NO variable named I2C_ADDR and see if it still works.[/quote:e635227bb2]
This still works....
Finally
[quote:e635227bb2]Then the last test would be to create I2C_ADDR and assign it with &H78 BEFORE you use config graphlcd. It should work too.[/quote:e635227bb2]
And this works too!
Thank you to all who contributed to fixing this!
Best r Guy
This is how simple it now is to swap the SSD1306 from TWI port 0 where it might conflict with high ADC channel usage on Port C, to the second hardware TWI on Port E. [code:1:e635227bb2]Config Scl1 = PortE.1 ' used i2c pins Config Sda1 = PortE.0 Config Twi1 = 400000 ' i2c speed
I2cinit
Const cTWI = 1
$lib "I2c_twi-multi.lib" ' we do not use software emulated I2C but the TWI $lib "glcdSSD1306-I2C-TWI-option.lib" ' override the default lib with this special one
Dim _i2cchannel as byte _i2cchannel = 1 ' 0 for TWI0, 1 for TWI1
Dim I2c_addr as byte I2c_addr = &H78 [/code:1:e635227bb2]
[quote:f8a643f4d1]So please try that first if that is right. glcdSSD1306-I2C-TWI-option.lib I2C_TWI-MULTI.lib [/quote:f8a643f4d1]
This works like a charm - toggling _i2cchannel redirects the display correctly. I did notice that as long as one TWI is configured , then both ports work.
I will do the other test in a moment.....
[code:1:f8a643f4d1]'------------------------------------------------------------------------------- ' SSD1306-I2C.BAS ' (c) MCS Electronics 1995-2020 ' Sample to demo the 128x64 I2C OLED display ' '------------------------------------------------------------------------------- $regfile = "m328pbdef.dat" $hwstack = 32 $swstack = 32 $framesize = 32 $crystal = 8000000 Config Clockdiv = 1 ' make sure the chip runs at 8 MHz
'$lib "i2c_twi.lbx" ' we do not use software emulated I2C but the TWI $lib "I2c_twi-multi.lib" ' we do not use software emulated I2C but the TWI '$lib "glcdSSD1306-I2C.lib" ' override the default lib with this special one $lib "glcdSSD1306-I2C-TWI-option.lib" ' override the default lib with this special one
Dim _i2cchannel as byte _i2cchannel = 1 ' 0 for TWI0, 1 for TWI1
#if _build < 20784 Dim ___lcdrow As Byte , ___lcdcol As Byte ' dim these for older compiler versions #endif
Ok this version is the same as the previous one except it supports dynamic LCD address. In order to use that create a variable named I2C_Addr and assign it the value of your LCD. That is typical &H78 For the rest use the I2C_TWI-MULTI.lib with its instructions.
You use 1 LCD so you only set the _I2CCHANNEL to the second TWI. Now i think of it : the LCD lib you have now should work with the second TWI too ( I2C_TWI-MULTI.lib)
So please try that first if that is right. glcdSSD1306-I2C-TWI-option.lib I2C_TWI-MULTI.lib
And use the lib you tested last. It should work.
Then you can download and test the attached lib. Same test. NO variable named I2C_ADDR and see if it still works. Then the last test would be to create I2C_ADDR and assign it with &H78 BEFORE you use config graphlcd. It should work too.
For users that want to use 2 LCD with different address : the multi lib is needed and since the lib initialize 1 LCD you have to call initlcd twice (one time with the address loaded in I2C_addr)
[quote:ee32c5ef9a="albertsm"]ok i will post a similar version for the v2x2 version so you can use both SPI interfaces.[/quote:ee32c5ef9a]
Great - not that it matters but it was a case of being able to use [b:ee32c5ef9a]either[/b:ee32c5ef9a] TWI interface. This design does not actually use both but I needed to use the second TWI for the display as the ADC inputs on PortC were already used...
Odd that the sample works since it uses R20 in the lib which the TWI will use too. I will check that. But for the option lib i made a dumb error. I corrected it so you can download it again and try again.
R.I.P Ben Zijlstra
Remembering Ben Zijlstra
We hope that people who love Ben will remember and celebrate his life.
more info at MCS
www.mcselec.com/index2.ph...
»
KaRadio webradio ESP8266
The Dimitris board is available at https://github.com/dsaltas/WiFi-WebRadio
This is a hardware project for Ka-Radio
»
93C46 small tool to edit 93C46 eeprom written in BascomAVR & VB
Bascom control the 93C46 so we sent data via comport from VB
code will be added later ...
»
nRF24L01+ RC Controller This is a RC controller TX & RX unit with nRF24L01+
nRF24L01+ / with PA and LNA for longer range
facts:
TX
1 x potmeter for servo
...
»
RAW lcd Connecting RAW lcd to atmega8
the lcd is 6 digit + time glass
LCD Hour Meter for tractor ,air compressor, ect
the lcd have 4 com pins & 14...