Setup RS232 interface
Add background image to library
Add font file to library
Create page style using background image
Create text style for multi line recieved data
Create a variable for Recieved data, Processed data and how many sets of data
Create interupt for RS232 that runs SplitEvent
Define a page named "pageName" with style "pageStyle"
Create a text entity for the processed recieved data
Create a key to send to RS232 "RS232 Data 1\\0D"
Create a key to send to RS232 "RS232 Data 2\\0D"
Create SplitEvent fuction which is called when CR is recieved
Check if Num=7 if it does reset Num and TxtVar (check if maxrows is reached)
Increment Num by 1
Load the Recieved Data into text variable with CR
Add the Recieved data onto the processed data variable
Load the new processed variable into text entity and refresh page
After loading show the page named "pageName"
|
SETUP(RS2){baud=19200;data=8;stop=15;parity=N;rxi=Y; proc=CR;procDel=Y;rxb=128;txi=Y;txb=128;encode=sr;flow=N;}
LIB(background,"SDHC/bground.png");
LIB(asc_16,"SDHC/asc_16b.fnt");
STYLE(BlackPg,Page){image=background;}
STYLE(texts,Text){font=asc_16;col=navy;maxLen=32;maxRows=7;curRel=TC;}
VAR(RcvBuf," ",TXT);VAR(TxtVar,"",TXT128);VAR(Num,0,U8);
INT(DataRc,RS2RXC,SplitEvent);
PAGE(MainPg,BlackPg)
{
TEXT(Trec1,"",texts,240,55);
KEY(Key1,[LOAD(RS2,"RS232 Data 1\\0D");],180,25,TOUCH,100,235);
KEY(Key2,[LOAD(RS2,"RS232 Data 2\\0D");],180,25,TOUCH,380,235);
}
FUNC(SplitEvent)
{
IF(Num=7?[LOAD(Num,0);LOAD(TxtVar,"");]);
CALC(Num,Num,1,"+");
LOAD(RcvBuf,RS2,"\\0D");
LOAD(TxtVar,TxtVar,RcvBuf);
TEXT(Trec1,TxtVar);;
}
SHOW(MainPg);
|