Fixed Point Integer calculations in small controllers like the Barionet
icon4 08 19th, 2008| icon3Comments Off on Fixed Point Integer calculations in small controllers like the Barionet

Hi,

This is a quick post in regards to how to present and calculate “analog” values or other things you want to express with a decimal point in the Barix Barionet and also on our Audio platforms (when programming in BCL):

Let’s assume you want to use input #1 on the Barionet to measure a current of 0.00-20.00 Amperes, and you have the necessary converter which delivers an analog voltage of 0..5V representing the full scale range of the measured current.

Connecting the converter to the Barionet will allow you to instantly see the corresponding voltage on the UI using a browser.

But .. how do you get the shown values converted to 0-20 Amp ?

The analog resolution of the current Barionet inputs is 10bit, so “full scale” is 1023. You probably want a higher resolution than just the integer part 0..20, so i would suggest to use 2 decimals.

Calculations can easily be done in integer if you just calculate/use the value, converted to 10mA units.

How ?

a=(iostate(501)*2000)/1024

…. this gets the value, multiples by the full scale value (20.00->2000) and divides by the 10 bit fullscale value, resulting in values which are 100 times the current Amp reading.

For example, a voltage value of 2.5V will be digitzed to 512, resulting in a value of 1000 (which is 10.00 Amp).

BCL supports a special format to easily display these values with a decimal point:

sprintf$(“Value: %.2F”,a)

will return a string with “Value: 10.00” content you can use for writing, displaying, storing.

If you just want to display the value on the UI using dynamic HTML tags, things are even easier, no programming in BCL is required ! The following term will emit (for our example) the string “10.00” on the Barionet if used in a dynamic HTML page:

&LIO(2,”%0.2F”,501,2000,0,1024);

Note the multiple parameters here. The decimal point is set in the format sting (%0.2F) to be 2 decimals. The first parameter after the format string is the I/O point (501), the second parameter is the multiplicator, the third parameter is an optional offset (if you put -1024000 here, you will have a reading of -10.00 …+10.00 for the example), and the term is divided by the last parameter before being displayed.

So, as with the above example, the value of IO point 501 (let’s assume it is 512) is taken, multiplied with 2000, nothing is subtracted, and the resulting value is divided by 1024. The result (1000) is then formatted as 10.00.

I hope this sparks some ideas how to use the products !

Johannes

It’s a well kept secret within Barix that the X8, our low cost “interface” widget, can do more than just contact closure interfacing via Modbus/RTU.

The X8 is quite a powerful little device ! In the “standard” firmware mode, it provides 8 universal 5V capable input/outputs which can be used as

  • digital inputs with or without pull-up
  • analog inputs with or without pull-up
  • wiegand decoding input
    common formats, 4, 8, 26, 40 bit supported !
  • Dallas Onewire Temp sensor interfaces
    one sensor per input, such as our Barix TS

All these functions are accessible via the Modbus/RTU interface.

But pssst – there are some more “special functions” hidden in the device, which we now intend to publish. The X8 can be put in “special” modes which then provide the following functions:

  • 8 input analog encoder (8 bit) sending ASCII message (non-polled) on change or interval
  • rotary switch encoder
  • 8 bit keypad interface for the Annuncicom-100

We even do things like interfacing the X8 directly to the RS-232 inputs of Exstreamer and Annuncicom for volume control, channel selection etc !

In general, the X8 can be seen as a quite universal, low cost, 5V I/O interface for automation purposes. With its support for Modbus/RTU, Wiegand readers, Dallas Onewire temp sensors, it is suitable for many applications in the automation and data collection area.

Oops – for those who don’t know what a wiegand interface is … nowadays, the “de facto” standard interface for access control readers, keypads etc. Originally a wiegand reader was a specific card reader, able to decode cards which contained a wire pattern, based on the “wiegand” effect. Wikipedia has more, here is the link to the term Wiegand Interface.

If anyone is interested in these special functions, please let me know !

Johannes

Use a PC for Music on Hold, Instore Audio or Streaming ?
icon4 06 30th, 2008| icon3Comments Off on Use a PC for Music on Hold, Instore Audio or Streaming ?

Read this post to understand how an Exstreamer-100 can save you its purchase price per year in energy savings.

A Barix customer had PCs available at no cost to him. He thought about using them for audio distribution for instore audio purposes through his stores nationwide distribution. Fortunately, he evaluated the cost of operations. Besides updating, mechanical failures and other service calls, the operation cost in terms of energy and cooling jumped into his mind.

24*365=8760 hours per year (this year even 24 more !). With a power requirement of approx. 200W, translating into 1752 kWh/year, the cost for the operation of the PC, just the power!, is roughly 175$ (at an energy price of 0.10$/kWh – and this is likely to raise and not drop !).

In contrast, the Exstreamer-100, Barix’ best selling Audio over IP device, needs only about 2W – or 1% – of the above amount. So for $1.75/year you can operate it.

In addition to the energy cost, you need to add the cost of energy for cooling (your Rack), depending on where you are located this can add significantly to the bill.

Well – you can guess, for the customer this was a striking advantage, the Exstreamer roughly pays back for itself with the energy savings every year ! And so they bought 1200 pieces, for savings of roughly $210k, EVERY YEAR.

Consider installing Barix to conserve natural resources – go green !

Next Entries »