Week 4 Progress:

    Our group ordered some necessary parts like the development board for the project.  We haven't done any active hardware work yet because we still want to map everything out and plan it well before we actually do something.  This will be more efficient because the parts were very costly.  We will help each other out with the hardware and VHDL programming because I feel that this will be the most challenging aspect right now.

    I spent a lot of time with the CodeWarrior tutorial.  After about eight chapters I was feeling confident about starting palm development.  I figured I'd use one of the tutorial's example (namely chapter 6) as a base point.  After spending over three hours, I couldn't make modifications to the existing project to make it work effectively for our project.  I decided to start from scratch with the project I already had when making screen captures for the previous week.  I created the results form and linked the forms so that the users can navigate between forms.  This is simple but numerous errors came up that impeded my progress.  Here are what my forms look like so far. 

1.  Our New Logo               2.  The Trigger Event Screen

 

3.  Results Page 1                4.  Results Page 2

    When the user clicks on send the program will navigate to "Results1."  Clicking on "Next Page" will go to "Results2".  "Prev. Page" will go back to screen one.  Pressing "Ok" will bring up the Trigger Event Screen which will allow users to enter a new string or quit the program.  

    I plan to put a message screen when the users click on send which indicate that the palm is waiting for signals from the logic analyzers.  I want to also add some drop down menus for each form to give version information, help, or information about the makers.  All this can wait because we just want it to work for now.  

    I spent a lot of time trying to make a new serial manager program function.  This is better than the normal serial manager in that it give access to multiple serial ports.  I found out that my program does not support this version but I can still use the old one.  This will do because we only need one serial port anyways.  For those of you who would like to use this function to Receive Data using the new serial manager, here is the function.  

#include <Pilot.h> // all the system toolbox headers
#include <SerialMgr.h>
#define k2KBytes 2048
/************************************************************
*
* FUNCTION: RcvSerialData
*
* DESCRIPTION: An example of how to receive a large chunk of data
* from the Serial Manager. This function is useful if the app
* knows it must receive all this data before moving on. The
* YourDrainEventQueue() function is a chance for the application
* to call EvtGetEvent and handle other application events.
* Receiving data whenever it's available during idle events
* might be done differently than this sample.
*
* PARAMETERS:
* thePort -> valid portID for an open serial port.
* rcvDataP -> pointer to a buffer to put the received data.
* bufSize <-> pointer to the size of rcvBuffer and returns
* the number of bytes read.
*
*************************************************************/
Err RcvSerialData(UInt16 thePort, UInt8 *rcvDataP, UInt32 *bufSizeP)
{
UInt32 bytesLeft, maxRcvBlkSize, bytesRcvd, waitTime, totalRcvBytes = 0;
UInt8 *newRcvBuffer;
UInt16 dataLen = sizeof(UInt32);
Err* error;

    // The default receive buffer is only 512 bytes; increase it if
    // necessary. The following lines are just an example of how to
    // do it, but its necessity depends on the ability of the code
    // to retrieve data in a timely manner.
    newRcvBuffer = MemPtrNew(k2KBytes); // Allocate new rcv buffer.
    if (newRcvBuffer)
    // Set new rcv buffer.
    error = SrmSetReceiveBuffer(thePort, newRcvBuffer, k2KBytes);
    if (error)
    goto Exit;
    else
    return memErrNotEnoughSpace;

    // Initialize the maximum bytes to receive at one time.
    maxRcvBlkSize = k2KBytes;
    // Remember how many bytes are left to receive.
    bytesLeft = *bufSizeP;
    // Only wait 1/5 of a second for bytes to arrive.
    waitTime = SysTicksPerSecond() / 5;
   
    // Now loop while getting blocks of data and filling the buffer.
    do {
    // Is the max size larger then the number of bytes left?
    if (bytesLeft < maxRcvBlkSize)
    // Yes, so change the rcv block amount.
    maxRcvBlkSize = bytesLeft;
    // Try to receive as much data as possible,
    // but wait only one second for it.
    bytesRcvd = SrmReceive(thePort, rcvDataP, maxRcvBlkSize, waitTime, &error);
    // Remember the total number of bytes received.
    totalRcvBytes += bytesRcvd;
    // Figure how many bytes are left to receive.
    bytesLeft -= bytesRcvd;
    rcvDataP += bytesRcvd; // Advance the rcvDataP.
    // If there was a timeout and no data came through...
    if ((error == serErrTimeOut) && (bytesRcvd == 0))
    goto Exit; // ...bail out and report the error.
    // If there's some other error, bail out.
    if ((error) && (error != serErrTimeOut))
    goto Exit;

    // Call a function to handle any pending events because
    // someone might press the cancel button.
    // YourDrainEventQueue();
    // Continue receiving data until all data has been received.
    } while (bytesLeft);
   
    // Clearing the receive buffer can also be done right before
    // the port is to be closed.
    // Set back the default buffer when we're done.
    SrmSetReceiveBuffer(thePort, 0L, 0);
    MemPtrFree(newRcvBuffer); // Free the space.

    Exit:
    *bufSizeP = totalRcvBytes;
    return error;
}

    More Information can we found at http://oasis.palm.com/dev/kb/manuals/1770.cfm

   For now I do not want to post my code yet because it is a little disorganized.  I also want to do some more work on it before I post it.  here are some of my function prototypes though.

static void StartApplication(void);
static Boolean MainFormHandleEvent(EventPtr event);
static void EventLoop(void);
static FieldPtr GetFocusObjectPtr(void);
static Boolean ApplicationHandleEvent(EventPtr event);
static Boolean Result1FormHandleEvent(EventPtr event);
static Boolean Resul2FormHandleEvent(EventPtr event);

  I plan to use the Serial Manager function calls: SerOpen, SerSend, and SerReceive to open the RS232 port and send and receive to the logic analyzer.