Bascom ---> Pascal

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Page 3 of 6
Mathias
Benutzer
Avatar
Gender: n/a
Location: Weingarten - Baden
Posts: 307
Registered: 07 / 2003
Subject:

Re: Bascom ---> Pascal

 · 
Posted: 05.08.2022 - 13:45  ·  #17
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1373
Registered: 03 / 2005
Subject:

Re: Bascom ---> Pascal

 · 
Posted: 05.08.2022 - 13:59  ·  #18
There is no 'NOSTOP' option on I2CRead. Instead it just inherits the NOSTOP value from the previous write (i.e. the address write, I assume). I am not sure that is correct.

I can easily apply the NOSTOP to read as well if required.

Can you advise, please, Miparo?
miparo
Administrator
Avatar
Gender:
Location: Germany
Age: 59
Posts: 956
Registered: 09 / 2007
Subject:

Re: Bascom ---> Pascal

 · 
Posted: 05.08.2022 - 15:04  ·  #19
Hi Merlin,
correct with the I2Cread also a NOSTOP is needed to not abort the auto-increment of the slave.
See here: Link

This is also for Matthias how I2C works in Bascom. Basic is of course a bad example. If sample then look in C. It is always best to look at Arduino examples.
BME Driver Code

miparo
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1373
Registered: 03 / 2005
Subject:

Re: Bascom ---> Pascal

 · 
Posted: 05.08.2022 - 16:47  ·  #20
Hi Miparo.

Yes, looking at the documentation I thought it was so.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1373
Registered: 03 / 2005
Subject:

Re: Bascom ---> Pascal

 · 
Posted: 05.08.2022 - 18:52  ·  #21
Hi Mathias

Miparo and I have been discussing this and the answer seems to be a new function I2CStop, used like this:

Code
I2cout(addr,reg,data, NOSTOP); 
I2Cin(addr,data);
I2Cin(addr,data);
I2Cin(addr,data);
I2Cstop();


I will implement this.

The issue Miparo found with

Code
I2Cout(BME280, Reg, data[idx], NOSTOP); 


seems to be part of a more general problem that I will need to investigate more fully because the variable is seen as a pointer (which it is) and whenever a pointer is found an extra length parameter is expected.

=================================================================

Hallo Mathias

Miparo und ich haben darüber diskutiert, und die Antwort scheint eine neue Funktion I2CStop zu sein, die wie folgt verwendet wird:

Code
I2cout(addr,reg,data, NOSTOP); 
I2Cin(addr,data);
I2Cin(addr,data);
I2Cin(addr,data);
I2Cstop();


Ich werde dies implementieren.

Das von Miparo gefundene Problem mit

Code
I2Cout(BME280, Reg, data[idx], NOSTOP); 


scheint Teil eines allgemeineren Problems zu sein, das ich noch genauer untersuchen muss, da die Variable als Zeiger betrachtet wird (was sie auch ist) und immer, wenn ein Zeiger gefunden wird, ein zusätzlicher Längenparameter erwartet wird.




Übersetzt mit www.DeepL.com/Translator (kostenlose Version)
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1373
Registered: 03 / 2005
Subject:

Re: Bascom ---> Pascal

 · 
Posted: 05.08.2022 - 23:26  ·  #22
I have now fixed the issue of const (and var) with 'NOSTOP' (I think...) and implemented I2CSTOP as a parameterless procedure.

Could either (or both) of you test with a real chip?

Attachment not intended for general release.

Thanks

============================================

Ich habe jetzt das Problem der const (und var) mit 'NOSTOP' (glaube ich...) behoben und I2CSTOP als parameterlose Prozedur implementiert.

Könnte einer (oder beide) von Euch mit einem echten Chip testen?

Der Anhang ist nicht für eine allgemeine Freigabe gedacht.

Vielen Dank
Mathias
Benutzer
Avatar
Gender: n/a
Location: Weingarten - Baden
Posts: 307
Registered: 07 / 2003
Subject:

Re: Bascom ---> Pascal

 · 
Posted: 08.08.2022 - 19:00  ·  #23
Werde es installieren und brichten wie ich zurechtkomme.
miparo
Administrator
Avatar
Gender:
Location: Germany
Age: 59
Posts: 956
Registered: 09 / 2007
Subject:

Re: Bascom ---> Pascal

 · 
Posted: 09.08.2022 - 00:53  ·  #24
Hi Matthias,
so funktioniert der BME280 im Anhang.
Das ist ja ein MCU Rechnemonster ?

Harry ist der Rechenmeister und kann das bestimmt verkleinern :)


BME 280 Test....
Sensor found at Addr: 0x76
Temp: 25.22 C
Humity: 50.55078 %


Nicht den letzten Beta Compiler hier im Thread benutzen, da geht kein I2Cout mehr.

miparo
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Page 3 of 6
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   135   149 · Page-Gen-Time: 0.032943s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI