Babuino Project is powered by Creative Minds.

October 25, 2009

Configuring Modbus in Babuino with Cricket Logo

Current Modbus tests are being performed in Cricket Logo because it is much faster to make changes than in Logo Blocks.
This is how Modbus configuration for Babuino in Logo code looks likes.


; ===================================
; --- LOGO CODE FOR READING/WRITING
; --- TO MODBUS MEMORY
global [var temp]

to start
modbus_memory
modbus_config

loop
[
; --- setdp parameters start from 0 ---
setdp 1
setvar recall
wait 1

setdp 3
settemp recall
wait 1

setdp 5
record var + temp
wait 1
]
end
; ===================================


; ===================================
; --- MODBUS DATA MEMORY
to modbus_memory
resetdp
record 00 ; holding register 1
record 01
record 00 ; holding register 2
record 02
record 00 ; holding register 3
record 03
record 00 ; holding register 4
record 04
record 00 ; holding register 5
record 05
record 00 ; holding register 6
record 06
record 00 ; holding register 7
record 07
record 00 ; holding register 8
record 08
end
; ===================================


; ===================================
; --- MODBUS CONFIGURATION MEMORY
; --- Function 3 - Read Holding Registers
; --- Function 6 - Write Single Register
to modbus_config

setdp 16
record 5 ; slave adr
record 3 ; Modbus function
record 1 ; Function parameter
record 3 ; slave adr
record 3 ; Modbus function
record 6 ; Function parameter
record 3 ; slave adr
record 6 ; Modbus function
record 8 ; Function parameter

setdp 47
record 3 ; # of polls

end
; ===================================

No comments:

Post a Comment