Code:
engine = 2
scanboards:
SERIN2 rx_,bmode,500,final,[wait ("P"),dec2 function,dec3 board, dec3 dumy] ''receive the comando what to do
'
' ******************* PC ask the if have new data, the flag reg_complet have this information *******************
if (function = 30) and (engine = board) and (reg_complet = 1) then
''read the data from the 18F4520 eeprom
read 10,tmp0
read 11,tmp1
read 12,tmp2
read 13,tmp3
read 14,tmp4
read 15,tmp5
read 16,tmp6
read 17,tmp7
read 18,tmp8
read 19,tmp9
read 20,tmp10
read 21,tmp11
read 22,tmp12
read 23,tmp13
read 24,tmp14
read 25,tmp15
read 26,tecnico1
read 27,tecnico0
'
''send the new data to the PC
serout2 tx_,bmode,["dumi",";",hex2 tmp0,";",hex2 tmp1,";",hex2 tmp2,_
";",hex2 tmp3,";",hex2 tmp4,";",hex2 tmp5,_
";",hex2 tmp6,";",hex2 tmp7,";",hex2 tmp8,_
";",hex2 tmp9,";",hex2 tmp10,";",hex2 tmp11,_
";",dec3 tmp12,";",dec3 tmp13,";",dec3 tmp14,_
";",hex2 tmp15,";",hex4 tecnico,13,10]
serout2 tx_,bmode,["y",13,10] ''end of data
'
SERIN2 rx_,bmode,5000,final,[wait ("OK"),dec3 board] ''wait during 5 seg a confirmation from the PC application that have received the new data
if board = engine then
reg_completo = 0 ''data received, clear the flag that have no more new data to send
write 4, reg_complet ''save the flag for posterior test
endif
endif
final:
return
Bookmarks