Friday, September 12, 2014

Using Raspberry Pi Serial Port

             By default the Raspberry Pi’s serial port is configured to be used for console input/output, it means you can't use the Serial Port in your programs and  needs to be disabled.To enable the serial port for your own use you need to disable login on the port. There are two files that need to be edited

The first and main one is     

              
 /etc/inittab


This file has the command to enable the login prompt and this needs to be disabled. Edit the file and move to the end of the file. You will see a line similar to

                      

Wednesday, September 10, 2014

Algotithm to Convert 4 byte Hex to 32 bit float


 I really struggled hard to find out some sorts of algorithm to convert 4 hex bytes to 32 bit float for my requirement on some analysis of MODBUS protocol. I didn't find it and it tok me nearly 2 days to design this. Here is the algorithm..


float ModbusRead(byte id,byte msbAddress,byte lsbAddress,byte msbCrc,byte lsbCrc)
{  
    num=1.00;
    Serial.write(id);
    Serial.write(0x03);
    Serial.write((byte)msbAddress);
    Serial.write((byte)lsbAddress);
    Serial.write((byte)0x00);
    Serial.write(0x02);