Scusa se ti porto fuori binario e non sono di aiuto ....ma ti funziona bene il programma scaricato da radzio? Io l'ho scaricato pero' mi da solo uno schermo vuoto.master simulator
Print #3 , Makemodbus(2 , 6 , 100 , Rcv_buff(8));
Waitms 500
Print #3 , Makemodbus(2 , 6 , 110 , Rcv_buff(10));
If Mem_modbus = 0 Then
Print #3 , Makemodbus(2 , 6 , 100 , Rcv_buff(8));
Mem_modbus = 1
Else
Print #3 , Makemodbus(3 , 6 , 110 , Rcv_buff(10));
Mem_modbus = 0
End If
'-----------------------------------------------------------------------------------------
'rs485-modbus-master_2560.bas
'FS
'-------------------------------------------------------------------------------
$regfile = "m2560def.dat" ' used micro
$crystal = 16000000 ' used xtal
$hwstack = 40
$swstack = 40
$framesize = 40
'-------------------------------------------------------------------------------
$lib "modbus.lbx" ' specify the additional library
'the libray will call a routine for UAR0,UART1,UAR2 and/or UAR3.
'when you get an error message that a label is not found with _SENDCHAR3 or _SENDCHAR4 then add these labels
'when you later use these routines you might get a duplicate label error and then you need to remove them
Config Print2 = Portc.0 , Mode = Set 'porta seriale per Modbus
Config Pinc.0 = Output
Rs485dir Alias Portc.0 'make an alias
'set direction register to output
Rs485dir = 0 ' set the pin to 0 for listening
'configure the second UAR for RS485/MODBUS. Make sure all slaves/servers use the same settings
Config Com3 = 19200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
'use OPEN/CLOSE for using the second UART
Open "Com3:" For Binary As #3
'dimension some variables
Dim W As Word
'Print "RS-485 MODBUS master"
Do
Waitms 500
Incr W ' delay
Print #3 , Makemodbus(2 , 6 , 100 , W);
Waitms 200
Print #3 , Makemodbus(2 , 6 , 110 , W);
Loop
Close #3
_sendchar0:
_sendchar1:
_sendchar4:
End
Users browsing this forum: No registered users and 16 guests