Another method, and the way I would do this is to not use the library you are using, but instead to know and understand the INA219 type of sensor. The library is giving you the float data, not the chip itself.
From the chip, the data is all 16 bit.
You can look inside that library and see how it works and pull it apart if you wish, or just address the chip itself and get the data directly, they are quite nice chips.
I have been trying to figure out how to divide a 32bit into two 16bit registers. So far the only solution I have found is to use something called a union. Was just wondering if there was an easier way.
I have also noticed that if I have a value of example -200 and I set my scada software to read that register as a signed 16bit then it displays correctly.
Using an union is probably the suggested method, otherwise you can do it with pointers, by pointing to the high order 16 bits of the float and then the low order 16 bits placing each into a holding register.
Yes, I suspect for low values you may well get the SCADA to read some values, though you would need to make that unsigned 16 bits. But, this is not the solution, you need to interpret the float as a float in the SCADA system.
As I mentioned, the other way to tackle this is to get the data directly from the INA219, I recall register 4 for two bytes, so 16 bits.
This is the raw ADC data and you then need to adjust this to meaningful values by factoring the calibrated shunt value.
Another thing you might think on is the range of your expected current values.
For example, if for instance you are only reading a full scale range of 0 to 3 Amps and you want or need precision to two decimal places, then what is commonly done is to multiply the data by 100, so you have a value ranged from 0 to 300.
Then, in the SCADA system you simply take the value and divide by 100 to get a floating point value once again.
Using this method is simple and only needs a single 16 bit holding register to hold that data range of 0 to 300.
If you want precision to three decimal places, then use a factor of 1000, and it will still work for a holding register.
rockwallaby:
Another thing you might think on is the range of your expected current values.
For example, if for instance you are only reading a full scale range of 0 to 3 Amps and you want or need precision to two decimal places, then what is commonly done is to multiply the data by 100, so you have a value ranged from 0 to 300.
Then, in the SCADA system you simply take the value and divide by 100 to get a floating point value once again.
Using this method is simple and only needs a single 16 bit holding register to hold that data range of 0 to 300.
If you want precision to three decimal places, then use a factor of 1000, and it will still work for a holding register.
The scada also have a feature to combine two registers, which is the reason why I wanted to split the 32bit reading. BUt any how, seems like it is more coding, value times 100 seems like a lot less complicated solution.
Hello,
I am working on WinTr Scada actually. I need some help:
I want to read the arduino data which come from sensors on WinTr. I have an arduino mega and an Ethernet shield. I have installed Modbus Plc simulator like the tutorial.
I need to read data on different modbus adresses to draw diagram. I meet some problems, when I created more than one tag and I click on run there is always a constant graph.
How can I proceed to resolve this problem please?
Hello,
The gauge changes value but only for a tag so one address.
I contacted the person in charge of answering WinTr scada's questions and according to him, Barcode reader should not be used. You have I should write a slave code in the arduino so that Modbus plc simulator can read my temperature and humidity values coming from the arduino on different addresses at the same time. My problem is that I can not read the data of the arduino card by USB port on Modbus PLC simulator. I also have an Ethernet shield and the cable.
If you can help me please it would help me a lot,
Thank you for your availability,
Hello Sir,
I do not use RTU. I use TCP / IP with my arduino. I have an ethernet shield with the cable. Because after having found the way to read the values of the arduino on WinTr, I should send the data on a cloud.
In the tutoriels of Wintr, they use modbus plc simulator thus I did the same thing but that doesn't work correctly.
Exactly, I don't know how can I manage to code of the arduino by using TCP to put in a register the temperature and in an other one the humidity and this for several values of temperatures and humidity.
I contacted the Mister of WinTr but he doesn't understand when I ask him for help to configure WinTr as Master. I don't know how can I proceed.
I have attached some code I am using. This is not all my own code but code that is currently working and giving values to Wintr. I have 12 other pages of code because I like to run sub routines like a plc would.
this attached code will probably not compile for you because of all the libraries and the sub routines. But you might find something useful. This forum has upload limit so I can not upload my Wintr project. Currently looking for a cloud service to use.
Thank you for your code. I think It is litle bit complicate to understand there is a lot of sub routines. I just want to communicate with WinTr scada via Modbus arduino code and be able to read my sensors values.
Thank you for you availibility,
O.k. Attached code should get you started. This modbus library does not support 32bit values. So to get temp to wintr you have to multiply by 100. In wintr you will have to create a new internal tag to convert back to float.
I tried to make the code with your example there is in attachment. I think it is false it doesn't run.
Should I connect the Ethernet shield to communicate with WinTr?
My arduino sould support three code : one for the reception of NRF24L01 module, one to modbus to connect with WinTr as I tried just here and thingspeak to send data to the cloud.
Her trl otomasyon işinizde insan ara yz olarak kullanabileceğiniz WinTr scada 2009 yılından itibaren yzlerce projede kullanılmıştır. Scada programı standart scada programlarının tm kaabiliyetlerine sahip olmakla birlikte script fonksiyonlarının tm .net komutlarını desteklemesi sayesinde ulaşılması g bir başarıya imza atmıştır.
Visual Basic ve C# scriptleri ile neredeyse script fonksiyonu iersinde ikinci bir Scada yazılabilir. Scada .net platformunda geliştirilmiştir. Bu sayede Scada sayfaları Windows 95 grnmnden kurtulup Win 7 grnm kazanmıştır. Her yıl Windows tarafından birinci seilen Chart ve Gauge nesneleri ile inanılmaz gzellikte grsel nesneler oluşturabilirsiniz.
* Web Server ile kontrol edilen nesneler: Button, Checkbox, Radio Button, Picturebox, SymbolFactory, Cutaway, Drawing, invisible Button, Textbox, Numericupdown, Horizantal Scrollbar, Vertical Scroolbar. Diğer nesneler ile sadece izleme yapılabilir.
b37509886e