Self-Test mode for Instruments by using Watchdog Timer!

Hello pals,

As I may have mentioned earlier, I am currently working as R&D engineer in Instrumentation Division. Hence, my current posts will be regarding to challenges faced by the Online Instruments, where the functioning of those instrument for 24×7 are at most important.

Recently faced problem was:
If any of the I2C based components that are faulted, then the controller used to get hanged. Quite a few forums discussed about the problem but didn’t find how to overcome the problem.

Below is the method which use Watchdog timer to find the faulted RTC (for eg):
1. Define a variable to store in internal EEPROM memory of a microcontroller, and initialise to some known value(test_var=0x03).
2. Write a function named Self_test with content as below:
a. Rewrite the variable with some other known value(say test_var=0x04).
b. Start the Watchdog timer.
c. Read/write the RTC.
d. Stop the timer.
d. Now change back the value of that variable(test_var=0x03).
3. If the RTC is not working, the controller is restarted and now you check back the test_var value.
4. If you still have test_var variable’s value 0x04, then you say RTC is faulted.

You can have multiple and varied components self-tested, by having their respective error values.
There may be other ways to do these but, make sure you do. This provides better diagnosis to your instrument and instrument can self check itself!

-Happy Instrumenting!

 

 

EEPROM write!

Hello people,

Here is a small tip for the Embedded System Engineers in writing the EEPROM. This method was one of the result, while finding the simple ways to optimize the storage space in the device I am working on.

As we know, the smallest possible data that can be written in single write is 8 bits or 1byte. Hence even to store a single bit of data we must sacrifice the other 7 bits.

If you want to avoid this without worrying about writing your own data structure or complex algorithms, you can directly use the inbuilt data structure called BITFIELDS in c or c++ .

The example code is as follows:

#include
#include

struct clock
{
unsigned char dd:5, mm:4, yy:7; // Line 1
unsigned char sr:5,hr:5, mn:6, sc:6; // Line 2
unsigned int reading.    // Line 3
} log_data;

int main()
{
printf(“Size of logged data is %d”,sizeof(log_data));
getchar();
}

In the above code, a structure has been defined. The Line 1 is to store timing information. You can calculate that, the maximum number of bits required to store date information is 5 bits (2^5=32, where maximum date occurs is 31). In the same way, for month it is 4bits and for year to store last two digital 7 bits.
So totally 5+4+7=16. Hence this data structure will pack these bits in two bytes.

Similarly in Line 2, 5+5+6+6=22. The other two bits are added to complete the full byte, because as I mentioned previously only 8bit or a byte can be written in single write operation.

When you check the size of the log_data will be 16+24+16=56(7bytes). In normal structure it would have been 24+32+16=72(9bytes). Yeah you may think it is small difference, but when you store the data 24×7, as it is done in online monitoring systems you must have efficient way of storing them.

The very good example is the present news on Pluto. Data stored by New Horizon space craft takes 18 months to reach earth. Consider, how careful engineers would have considered the even single bit of data.

In-amp vs Op-amp

Hello fellas, This is Anand, geared up to guide you all in the journey of electronics planned by Electr’O’rithm. The start of the journey may look boring (as in all other journeys) and irrelevant, but bear with me, it’ll soon get interesting. Well, through this post let us start the journey with a bit of quarrel. The “In-amp vs Op-amp”. Many of you are familiar with using op-amps. Some of you are so good to turn your basic op-amp to workfor almost all the applications. There are many other configurations of op-amps out there to use for specific purpose. One of those is what we are going to deal in this post.

Continue reading In-amp vs Op-amp

Ambiguity in that last minute …

Making decisions is an integral part of our life. Taking Decisions and what comes out of it both stay with us till the end and this article came out to throw light on the “Ambiguity”, that we all face, when making some important decisions in our lives.

Continue reading Ambiguity in that last minute …

Model – View – ViewModel (MVVM)

MVVM is a way of software development, which primarily helps in separation of concerns for developers between UI design and Data Model. This architectural pattern mainly focuses on Event-Driven Programming. The MVVM was used for WPF and silverlight applications, but I believe that this pattern can be used for any application developement.

In this post, I’ll try to explain MVVM with simple diagrams and least complicated codes as examples. 

Continue reading Model – View – ViewModel (MVVM)

Job…..Passion……Dreams

Job, Passion, Dreams (by dreams I am talking about Career Dreams) are few things which trespasses the minds of everyone with or without our consensus. I see these things as three distinct dots on a plane. They cant converge completely, but I believe we can get them in a line through our hard work and Perseverance.

Continue reading Job…..Passion……Dreams

Data Science…….. A journey through labyrinth of data

We all use many interconnected devices (may it be our smartphones, computers, sensors etc) which produces so much of data. By this a number of questions will pop-up like “Where does all this data go?”,”Where is it stored?” and the most important question “What do we do with all this data?”.

Continue reading Data Science…….. A journey through labyrinth of data