This is my eventloop that I made when the program is checking for the
timing and sending a char 'a' when there is no input every second

static void RealTimeEventLoop(void)
{
EventType event;

do
        {
        EvtGetEvent(&event, 0);
        if (! RealTimeAppHandleEvent(&event))
                FrmDispatchEvent(&event);
        EndTimer = TimGetTicks();
        DifTimer = EndTimer - StartTimer;       //startimer declared in
eventloop                                         
                ReceiveData();
                if (DifTimer >=100)             //when time = 1 second
start this loop
                        {
                        SendData();
                        StartTimer = TimGetTicks();
                        DifTimer = EndTimer - StartTimer;
                        CheckData();
                        }
                if( rcvBuf[0] != '0' )         // serial data input =
yes start this loop
                        {       
                        StartTimer = TimGetTicks();
                        DifTimer = EndTimer - StartTimer;
                        CheckData();
                        }
        }while (RealTimeHandler == true);        // when stop button is
not hit
if (RealTimeHandler == false )      //close serialport and return to
other form when stopbutton is hit
        {
        CloseSerialPort();
        FrmGotoForm(MainForm);
        }

return;
}


This is the SendData function


static void SendData(void)
{
Err     error;
UInt port = 0;
Char SendBuf[ ]="a";        //send only one 'a'
UInt i;

i = SerSend(serRefNum, SendBuf, StrLen(SendBuf), &error);
SerSendWait(serRefNum, -1);
 }




This has been tested, I didn't write any data to the Palm, so the
rcvBuf stays empty and the program should only react to the stop button
and send a pulse every second. But somehow it sends also a pulse after
4ms. Sometimes, not always. I really haven't got a clue how this is
possible

When anybody could help me, Thanks,

Patrick Heynen
>>> [EMAIL PROTECTED] 04/05/00 03:05PM >>>
This doesn't sound like an OS problem.  I would check your code and
make
sure you're not sending the data twice.  Posting some of your code
might
also help pinpoint the problem.

-----Original Message-----
From: Patrick Heynen <[EMAIL PROTECTED]>
To: Palm Developer Forum <[EMAIL PROTECTED]>
Date: Wednesday, April 05, 2000 8:18 AM
Subject: Sending Serial Char


Hi,

I have made a program that sends a 'a' through the serial port for a
specific time period. I have tested is for several periods, 40msec,
80msec,
160msec and 1 second. But I have found some strange problem.
Everything
works okay. It sends the chars at the right moment, but somehow
sometimes it
sends two signals The first one on time and the second 4msec's later.
This
is a problem because my program must trigger a hardware device in the
future
and I want to trigger it one a second with accuracy of les than 5msec.
I
have written my own eventloop. It checks only for two thing. The first
is
whether it's time to sends a char and the the second if the stop button
is
hit, software button. All other things like menu's, hardware buttons
and
anything else won't work on this form.

Does anybody have a clue how why the Palm sends the signal twice with
a
period of 4msec.

I am using CW6, SDK1.2 and OS3.1.1. I use the normal serial manager.
I can't upgrade to os3.5, still waiting for an answer from Palm. So
that
isn't a proper solution.

Does it help to use the new serial manager, will the problem go away

Patrick Heynen
Medtronic, Trainee at Concept Development Department
[EMAIL PROTECTED] 
+31433566709



--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html 




-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html 


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to