Week 9 Progress:

    I'm finishing up the sending part of the palm.  As I said last week, I changed the trigger condition menu to add check boxes.  I've updated the code to send to the triggering condition based on these check boxes.  I've also commented my code for the this logic so that it would be easier to follow:

//*Channel 0 and 1
if (LogicMainCh0dcCheckbox)
if (LogicMainCh1dcCheckbox)
//*Both don't care
sendbits[2] = 0x77;
else
//*Don't care and high
if (LogicMainCh1hlCheckbox)
sendbits[2] = 0x17;
//*Don't care and low
else
sendbits[2] = 0x27; 
else
//*High 
if (LogicMainCh0hlCheckbox)
//*High and don't care
if (LogicMainCh1dcCheckbox)
sendbits[2] = 0x71;
else
//*High and High
if (LogicMainCh1hlCheckbox)
sendbits[2] = 0x11;
//*High and low
else
sendbits[2] = 0x21; 

else
//*low and don't care
if (LogicMainCh1dcCheckbox)
sendbits[2] = 0x72;
else
//*low and High
if (LogicMainCh1hlCheckbox)
sendbits[2] = 0x12;
//*low and low
else
sendbits[2] = 0x22; 
SerOpen(num,0,57600);
SerSend(num,sendbits,StrLen(sendbits),&error);
SerSendWait(num,-1);
SerClose(num);
//*Channel 2 and 3
if (LogicMainCh2dcCheckbox)
if (LogicMainCh3dcCheckbox)
//*Both don't care
sendbits[2] = 0x77;
else
//*Don't care and high
if (LogicMainCh3hlCheckbox)
sendbits[2] = 0x17;
//*Don't care and low
else
sendbits[2] = 0x27; 
else
//*High 
if (LogicMainCh2hlCheckbox)
//*High and don't care
if (LogicMainCh3dcCheckbox)
sendbits[2] = 0x71;
else
//*High and High
if (LogicMainCh3hlCheckbox)
sendbits[2] = 0x11;
//*High and low
else
sendbits[2] = 0x21; 

else
//*low and don't care
if (LogicMainCh3dcCheckbox)
sendbits[2] = 0x72;
else
//*low and High
if (LogicMainCh3hlCheckbox)
sendbits[2] = 0x12;
//*low and low
else
sendbits[2] = 0x22; 
SerOpen(num,0,57600);
SerSend(num,sendbits,StrLen(sendbits),&error);
SerSendWait(num,-1);
SerClose(num);
//*Channel 4 and 5
if (LogicMainCh4dcCheckbox)
if (LogicMainCh5dcCheckbox)
//*Both don't care
sendbits[2] = 0x77;
else
//*Don't care and high
if (LogicMainCh5hlCheckbox)
sendbits[2] = 0x17;
//*Don't care and low
else
sendbits[2] = 0x27; 
else
//*High 
if (LogicMainCh4hlCheckbox)
//*High and don't care
if (LogicMainCh5dcCheckbox)
sendbits[2] = 0x71;
else
//*High and High
if (LogicMainCh5hlCheckbox)
sendbits[2] = 0x11;
//*High and low
else
sendbits[2] = 0x21; 

else
//*low and don't care
if (LogicMainCh5dcCheckbox)
sendbits[2] = 0x72;
else
//*low and High
if (LogicMainCh5hlCheckbox)
sendbits[2] = 0x12;
//*low and low
else
sendbits[2] = 0x22; 
SerOpen(num,0,57600);
SerSend(num,sendbits,StrLen(sendbits),&error);
SerSendWait(num,-1);
SerClose(num);
//*Channel 6 and 7
if (LogicMainCh6dcCheckbox)
if (LogicMainCh7dcCheckbox)
//*Both don't care
sendbits[2] = 0x77;
else
//*Don't care and high
if (LogicMainCh7hlCheckbox)
sendbits[2] = 0x17;
//*Don't care and low
else
sendbits[2] = 0x27; 
else
//*High 
if (LogicMainCh6hlCheckbox)
//*High and don't care
if (LogicMainCh7dcCheckbox)
sendbits[2] = 0x71;
else
//*High and High
if (LogicMainCh7hlCheckbox)
sendbits[2] = 0x11;
//*High and low
else
sendbits[2] = 0x21; 

else
//*low and don't care
if (LogicMainCh7dcCheckbox)
sendbits[2] = 0x72;
else
//*low and High
if (LogicMainCh7hlCheckbox)
sendbits[2] = 0x12;
//*low and low
else
sendbits[2] = 0x22; 
SerOpen(num,0,57600);
SerSend(num,sendbits,StrLen(sendbits),&error);
SerSendWait(num,-1);
SerClose(num);

    Sorry it doesn't get indented when I cut and paste.  Here is the new user interface for the triggering condition.     

If the user checks both don't care and high, the don't care presides.

I'm currently working on making the receiving the results.  Receiving is easy but displaying the data with codewarrior is very difficult.  You have to first get a form pointer, then field index, and a field object pointer.  Then you have to create handles and then allocate memory and set a text to it.  You then do a string copy and set the text handle of the field using the field pointer.  Yes, this is very confusing.  It took me a lot of work to figure it out because the tutorial does not explicitly teach this.  Anyways the code is as follows:

FormPtr frm;
FieldPtr fld;
CharPtr text,a,newText;
Word fldIndex;
Handle newHandle;
Boolean handled = false;
a = "Toan";
frm = FrmGetActiveForm();

newHandle = MemHandleNew(StrLen(a) + 1);
newText = MemHandleLock(newHandle);
StrCopy(newText, a);
fldIndex = FrmGetObjectIndex(frm, Result1C0Field);
fld = FrmGetObjectPtr(frm, fldIndex);
FldSetTextHandle(fld, newHandle);

This will set the text field to "Toan" as follows:

   I will now work on grabbing the string passed from the FPGA and display it on these text fields. I will also work with Ilya and Jae to incorporate the hardware with the palm and make something happen.