USART.DataAvailableTimeout usage

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
bether
Posts: 3
Joined: Tue Dec 09, 2008 11:24 pm

USART.DataAvailableTimeout usage

Post by bether » Thu Dec 11, 2008 12:38 am

hello, i just trying to get it work

Code: Select all

Include "USART.bas"

dim 
   byteok as boolean,
  j as byte,
 terminator as string

terminator = #13 + #10
 USART.SetBaudrate(br1200)
While  true
                       byteok = USART.DataAvailableTimeout(500)
                       If byteok Then
                           j=USART.Readbyte // pop data 
                           USART.Write("Data available",terminator)
                           byteok = false
                       else
                         USART.Write("Data NOT available",terminator)
                       endif
                       DelayMS(500)
                       
                    Wend 
the flow must goes to data NOT available if there is no bytes incoming in near 500 ms, but my pic still waiting for ever it never reaches the timeout
thereis something missing ?
any help would b nice Thanks.
if (think)
exist;

Post Reply