10
« on: August 11, 2011, 10:53:00 AM »
Have increased time, respons is around 200 ms.
see code mods below. always getting an error on the first modbus read. Modscan works, just great with the slave.
INIT FUNCTION
SETBAUD 2, &H09 ' 115.2K, 8N1
SETSYSTEM 6,4 ' MODBUS RTU
SETSYSTEM 25, &H0101 ' A/O 1 SET TO 5 VOLTS
SETSYSTEM 25, &H0201 'A/O 2 SET TO 5 VOLTS
SETPROTOCOL 3, 10 '
SETSYSTEM 1, 4
SETLCD 1,1, "INIT FINISHED"
GETDATA FUNCTION
SETLCD 1,1, " "
SETLCD 4, 1, "Time: " + STR$(TIME[1]) + ":" + STR$(TIME[2]) + ":" + STR$(TIME[3])
A=READMODBUS(12,10,11) 'READ DATA ON PORT 3 AS A MASTER RTU SALVE 10 ADDRESS 11
'A = 2048
IF STATUS(2) = 0
SETLCD 3, 1, "ERROR MODBUS"
RETURN
ENDIF
SETDAC 1, A ' SET DAC 1 (A/O 1) TO READ VALUE
SETLCD 1, 1, "Set 1 Gamma = " + STR$(A) ' SHOW VALUE ON DISPLAY
'DELAY 200 ' DELAY 200 MS
B=READMODBUS(12,10,12) 'SAME AS ABOVE
'B= 2048
SETDAC 2,B
SETLCD 2, 1, "Set 2 Gamma = " + STR$(B)