Hello ...
I wanna use an ATMega162 as an I2C master, with I2C-software-routines since this processor has apparently no I2C hardware interface. The data line is bidirectional for the I2C bus, unfortunately the Mega ports are not. So my question : do GC-Basic I2C-software-routines switch the data direction automatically, as needed ? Thanks in advance ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried to adapt the prog written for the Chipino for my STK200 board (prog attached) to find the ID of a device that I bought online (LCD Display 40 chars x 2 with I2C), I wanted to display the ID in GCBasic's Terminal via a CP210x based USB to serial adapter ; first I had to copy I2C.h from "include\lowlevel" to "include" . And then at compilation I got :
An error has been found:
Error: GCASM: Symbol INITI2C has not been defined at CALL INITI2C
My OS is Windows 7 x64 pro. Now the terminal does no more crash (?) ... Finally I found that the DeviceID is 0x4E. Unfortunately the control codes for the display are ... nowhere, the only thing I found is that Bit3 switches the backlight on/off. So the display seems to be useless ! Now I tried to contact the seller, wait and see !
Last edit: Bertrand BAROTH 2020-09-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Meanwhile I saw that GCBasic has routines for alphanumeric displays ... I tested them, but the system worked "randomly", I saw only one correct sequence ; I suspect that there is a hardware problem with the I2C or the reset ; unfortunately I am not able to desolder the interface, when I bought the display I thought that it was only "plugged in" ... In a few days I will get displays with only parallel interface. I hope they will work better !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello ...
I wanna use an ATMega162 as an I2C master, with I2C-software-routines since this processor has apparently no I2C hardware interface. The data line is bidirectional for the I2C bus, unfortunately the Mega ports are not. So my question : do GC-Basic I2C-software-routines switch the data direction automatically, as needed ? Thanks in advance ...
Yes.
Thanks ... And is the "weak" pull-up activated when the line acts as an input ?
No. You should always use external pull-ups.
No. You should always use external pull-ups.
I tried to adapt the prog written for the Chipino for my STK200 board (prog attached) to find the ID of a device that I bought online (LCD Display 40 chars x 2 with I2C), I wanted to display the ID in GCBasic's Terminal via a CP210x based USB to serial adapter ; first I had to copy I2C.h from "include\lowlevel" to "include" . And then at compilation I got :
An error has been found:
Error: GCASM: Symbol INITI2C has not been defined at CALL INITI2C
What is going wrong ? Thanks in advance ...
PS : about pull-ups : 10K on both lines ?
Last edit: Bertrand BAROTH 2020-09-08
You do no tneed the include line. Anything in lowlevel is included automatically.
Compiled with RC24 OK here with the include line removed.
Another gaseous plant which does not work ... Bye I2C ! And Terminal crashes sometimes : unable to disconnect !
Software I2C works. So, what is happening?
What is happening on the SDA and SCL lines? Do you have an cheapo analyser?
What is your operating system? I do not get crashes with Terminal - unless I totally overload the input buffer.
My OS is Windows 7 x64 pro. Now the terminal does no more crash (?) ... Finally I found that the DeviceID is 0x4E. Unfortunately the control codes for the display are ... nowhere, the only thing I found is that Bit3 switches the backlight on/off. So the display seems to be useless ! Now I tried to contact the seller, wait and see !
Last edit: Bertrand BAROTH 2020-09-08
Meanwhile I saw that GCBasic has routines for alphanumeric displays ... I tested them, but the system worked "randomly", I saw only one correct sequence ; I suspect that there is a hardware problem with the I2C or the reset ; unfortunately I am not able to desolder the interface, when I bought the display I thought that it was only "plugged in" ... In a few days I will get displays with only parallel interface. I hope they will work better !