<root>
<file schema='101' />
<macros >
<macro >
<flowline name='rs232_recv' description='This is the receiver routine to detect FF and newline characters etc. 
Give kudos to EtsDriver if you use this macro as part of your program. 
' >
<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
<local name='recv' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
<local name='pos' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
<local name='tmp_str' type='T8' description='' isconst='0' isinit='1' usrinit='&quot;&quot;' setinit='&quot;&quot;' >
<array size='20' />
</local>
<local name='testvalue' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
<command class_type='comment' title='' comment='Gets maximum of 20 characters from RS232 to string' textarea='12,0,12,0' cmdcolor='14609663' cmdcolor_sec='14609663' />
<command class_type='calculation' title='zero out all values' cmdcolor='12865180' cmdcolor_sec='12865180' >
<exp exp='.recv = 0' />
<exp exp='.pos = 0' />
</command>
<command class_type='loop' title='Loop until LF or CF received from terminal' cmdcolor='13945981' cmdcolor_sec='13945981' type='1' exp='.recv = 13 | .recv = 15' start='0' >
<flowline >
<command class_type='call' title='Call Component Macro' cmdcolor='7260111' cmdcolor_sec='7260111' component='RS232' macro='ReceiveChar' >
<return exp='.recv' />
<argument exp='255' />
</command>
<command class_type='decision' title='Timeout handling to not accumulate values with 255' cmdcolor='13945981' cmdcolor_sec='13945981' exp='.recv = 255' swap='0' >
<flowline />
<flowline >
<command class_type='decision' title='Backspace was pressed on serial terminal handling' cmdcolor='13945981' cmdcolor_sec='13945981' exp='.recv = 127' swap='0' >
<flowline >
<command class_type='decision' title='Going back one position if 127 received until zero reached' cmdcolor='13945981' cmdcolor_sec='13945981' exp='.pos = 0' swap='0' >
<flowline />
<flowline >
<command class_type='calculation' title='Calculation' cmdcolor='12865180' cmdcolor_sec='12865180' >
<exp exp='.tmp_str[.pos] = 0' />
<exp exp='' />
</command>
<command class_type='calculation' title='Calculation' cmdcolor='12865180' cmdcolor_sec='12865180' >
<exp exp='.pos = .pos + 1' />
</command>
</flowline>
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Append input to string' cmdcolor='12865180' cmdcolor_sec='12865180' >
<exp exp='.tmp_str[.pos] = .recv' />
<exp exp='.pos = .pos + 1' />
</command>
</flowline>
</command>
</flowline>
</command>
<command class_type='decision' title='Last position?' cmdcolor='13945981' cmdcolor_sec='13945981' exp='.pos &gt; 20' swap='0' >
<flowline >
<command class_type='calculation' title='Calculation' cmdcolor='12865180' cmdcolor_sec='12865180' >
<exp exp='.pos = 0' />
</command>
</flowline>
<flowline >
<command class_type='comment' title='' comment='If buffer gets full, we carry over.' textarea='12,0,12,0' cmdcolor='14609663' cmdcolor_sec='14609663' />
</flowline>
</command>
</flowline>
</command>
<command class_type='calculation' title='Return the string' cmdcolor='12865180' cmdcolor_sec='12865180' >
<exp exp='ReturnS = .tmp_str' />
</command>
</flowline>
</macro>
</macros>
<variables >
<variable public='0' >
<def class_type='variable' name='ReturnS' type='T8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
<array size='20' />
</def>
</variable>
</variables>
</root>
