hog
Good Morning,
I'm new at openPLC and I'm not shure what to do. I want to read the value of a DS18B20 sensor on the %IW0.3 input of the Arduino. I pulled the Input up with a 4k7 resistor. But everytime when I compile my programm there is an error.
Compiling .st file...
plc_prog.st:3-5..3-26: error: Bit size of data type is incompatible with bit size of location.
1 error(s) found. Bailing out!
Error: Couldn't find LOCATED_VARIABLES.h. Check iec2c compiler output for more information

Could anyone help me?
My programm is an follows:


Bildschirmfoto von 2023-01-20 09-59-15.png
Reply 1 0
hog
Goog morning,

sorry, is something wrong with my question? Please could someone help me?

many thanks
Gerhard
Reply 0 0
thiagoralves
That’s not how you use this block. You should put the pin number of your Arduino board on the PIN input (2,3,4, etc). That should be the pin where your sensor is connected. Also, location %IW0.2 does not exist. Just remove the location from that variable and insert the pin number on the variable initial value and you should be good
Reply 1 0
hog
Hello, thanks for your answer. Tomorrow in the Morning I will try this and then I‘ll tell you the result. Many thanks and have a nice day.
Reply 0 0
hog
Hello Thiagoralves,

Thanks for your help, everything works fine, I'm using pin 16 (A3) of the Arduino Nano.Really great project, I use it for higher class education
Reply 0 0
ndepka
Hello Hog, it would be nice if you could post your solution here, it could also be interesting for others. Thx ;-) 
Reply 0 0
hog
Hello ndepka,
here's my solution, hope it's helpful, I use the A3 pin of the Arduino Nano. If the temperature is higher than 24.0 degree, the led1 is on. Don't forget the 4k7 resistor to pullup the input (16) 
 
Screenshot 2023-04-12 184555.png
Reply 1 0
hog
Hello ndepka, it's pin A2 at the Nano, my mistake, sorry
Reply 0 0
ndepka
THX hog! 
Reply 0 0
Tiziano
Ciao a tutti io sono nuovo , non ho alcuna esperienza su openplc, sto provando qualche piccolo esercizio, volevo collegare un sensore di temperatura come DS18B20 a una scheda arduino uno ho fatto vari tentativi ma ho smpre un errore sull'ingresso dove collego il sensore, alla fine ho rinuciato. Qualcuno mi può fare un esempio su openplc funzionante? quelli che ho trovato qui sopra danno sempre errore !
 
uscito con stato 1 (pid 4072)
C:\Users\tizpi\OneDrive\Documents\OpenPLC Editor\OpenPLC Prove\DS18B20\build\plc.st:101-6..101-26: error: Bit size of data type is incompatible with bit size of location.
In section: PROGRAM sonda_temperatura
0101: pinDS AT %IX0.0 : SINT;
1 error(s) found. Bailing out!
 
grazie
 
Tiziano
Reply 0 0
hog
Helo Tiziano,
have a look at my example some posts ago, there is the number of the used pin at the DS18B20 function block. E.g. pin 2 (instead of %IX0.0) if you use the pin 2 for temperature mesurement. 
kind hog
Reply 0 0
Tiziano
Ciao Hog,
Grazie per la tua risposta !
Si certo che l'ho visto, devi scusarmi ma sono molto poco eperto di questo programma "openPLC", ho provato il tuo esempio ma non mi funziona , il pin di ingresso è il 2  %IX0.0 , io uso arduino UNO cambia qualcosa? e comunque dove e dichiarato che pin usi per l'ingresso del blocco ds18b20 ? io vedo che sull'igresso blocco ds18b20  c'e' una variabile con valore 16! 
Reply 0 0
hog
Ciao Tiziano,
it is not nessesary to declare the pin an %IX0.0 or similar, my number (16) at the function block would be 2 for your pin!
 
kind 
Reply 0 0
Tiziano
Hi hog, where do I get " your block 16 from " ? sorry again for my ignorance!
Reply 0 0
hog
if you use pin 2 you don't need pin 16!! you only have to write 2 instead of 16!!
Reply 0 0
Reply