Hello mackrackit
I have this run without interrupts, and now want like i said use Darrel interrupt solution
This is the simplified code that i use, apreciate any help how to do this with interrupt routine
Thanks
Best regards
Pedro

maq = 114 'board number
The PC send example: P20114123


main:
gosub blink 'not important
gosub progboard
goto main


blink: only to see that the program runs
' led blink 2x
return


progboard:
vezes = 0
low transmite 'set MAX 487 in receive mode
repeted: 'manual timeout
vezes = vezes + 1
if vezes > 15 then final
SERIN2 rx_485,bmode,250,repeted,[wait ("P"),dec2 func,dec3 board,dec3 dumy] 'receive commands to execute
'
high led 'to see that receive a command
Pause 500
low led
'
if (func = 20) and (maq = board) then 'test if it is for this board to set on board RTC
low transmite 'set MAX 487 in receive mode
vezes = 0
repetec: 'manual timeout
vezes = vezes + 1
if vezes > 20 then final
low transmite 'set MAX 487 in receive mode
'receive the data to set the realtime clock
SERIN2 rx_485,bmode,250,repetec,[wait ("G"),hex2 rtchr,hex2 rtcmin,hex2 rtcyear,hex2 rtcmonth,hex2 rtcdate,hex4 obra,hex2 rtcday,hex2 daylight]
rtcsec = $00
'
toggle led
Gosub settime 'set the RTC on the board
'
pause 100
rtchr = 0:rtcmin = 0:rtcyear = 0:rtcmonth = 0:rtcdate = 0:rtcday = 0
pause 100
segu_daylight = daylight 'backup
'
Gosub gettime 'read the board RTC after setting
'
pause 10
vezes = 0
repeteb: 'timeout manual
vezes = vezes + 1
if vezes > 40 then final
low transmite 'set MAX 487 in receive mode
Serin2 rx_485,bmode,250,repeteb,[wait ("R")]
'
HIGH transmite 'set MAX487 in transmit mode
pause 2000 'important
'
'send received data back to PC to test if the on board RTC it correct set
serout2 tx_485,bmode,["dumi",";",hex2 rtchr,";",hex2 rtcmin,";",hex2 rtcyear,";",hex2 rtcmonth,";",hex2 rtcdate,";",hex4 obra,";",hex2 rtcday,13,10]
return
endif 'if func = 20
'
' ******************* Test if new data available for the PC *****************
'The PC scan sequencialy all boards on the network for new data
If (func = 30) and (maq = board) and (reg_completo = 1) then 'test if the request of data is for this board

tmp0 = 0:tmp1 = 0:tmp2 = 0:tmp3 = 0:tmp4 = 0:tmp5 = 0:tmp6 = 0:tmp7 = 0:tmp8 = 0:tmp9 = 0:tmp10 = 0
tmp11 = 0:tmp12 = 0:tmp13 = 0:tmp14 = 0:tmp15 = 0:tmp_tecn = 0
'get the data from the CPU Eeprom to send to the PC
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,tmp_tecnH
read 27,tmp_tecnL
'
'make a simple checksum
som = tmp0 + tmp1 + tmp2 + tmp3 + tmp4 + tmp5 + tmp6 + tmp7 + tmp8 + tmp9 + tmp10 + tmp11 + tmp12 + tmp13 + tmp14 + tmp15 + tmp_tecn
'
HIGH transmite 'set MAX487 in transmit mode
pause 2000 '### important
serout2 tx_485,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 tmp_tecn,";",dec som,13,10]
'
low transmite 'set MAX 487 in receive mode
vezes = 0
repete: 'manual timeout
vezes = vezes + 1
if vezes > 36 then final
SERIN2 rx_485,bmode,250,repete,[WAIT ("OK"),dec3 board] 'receive confirmation from PC that data OK
if board = maq then
toggle led 'only for debug
endif
endif

final:
return