trying to RS485 example on k60 tower kit having some issue in fread

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

trying to RS485 example on k60 tower kit having some issue in fread

622件の閲覧回数
vallinaths
Contributor II

using the rs485 example code

void rs485_read_task

   (

      uint_32 initial_data

   )

{

   MQX_FILE_PTR rs485_dev = NULL;

   char  data_buffer[256];

   rs485_dev  = fopen( RS485_CHANNEL, NULL );                    

   if( rs485_dev == NULL )

   {

      /* device could not be opened */

      _task_block();

   } 

 

   /* wait for data */

   fread(data_buffer, 1, 18, rs485_dev);

 

   while(1)

   {   

    printf("\n - Buffer_DAta              = %s Hz", &data_buffer);

   };

}

The write task is printing the "RS485 example " in the serial terminal ,so write routine is working sine  , but the read task is not reading the character typed on serial terminal . if anybody has tried this program please support anything to be modified .

0 件の賞賛
返信
1 返信

415件の閲覧回数
chandrasekarkan
Contributor III

Hi

      As you are trying to read 18 bytes in the fread call, it will block the task until all 18 bytes are received in the buffer.

Try reading byte by byte..

0 件の賞賛
返信