Added main for testing (cmd byte has bit0=1 for read, bit0=0 for write)