2 channel rs485 commamd AT commands (ASCII characters)
Note: 1 In the AT command mode slave ID is invalid 2 AT commands must be uppercase, lowercase invalid
3 DIP switch status: A5 must be !! state, A"#A$ random state %&"" 'and ,( Data bits,None Parit),1 Parit),1 *top 'it +ead *tatus: hannel 1: AT-+1 hannel 2: AT-+2 pen : hannel 1 : AT-1 hannel 2 : AT-2 lose: hannel 1 : AT-1 hannel 2 : AT-2
To..le /*el0#locin. hannel 1: AT-T1 hannel 2: AT-T2
atch /Inter#locin. /Inter#locin. hannel 1: AT-1 hannel 2: AT-2 4omentar) /Non#locin. hannel 1: AT-41 hannel 2: AT-42 Dela) hannel 1: AT-D16666 hannel 2: AT-D26666 6666 re0ers to the """" to %%%% 0i.ures, 7nit is seconds +eturn command : pen6, lose6 /6 1 or 2 89ample 1: *end command AT-D1""1", hannel 1 is pen, a0ter dela) o0 1" seconds, channel 1 is lose *end command AT-D2"1"", hannel 2 is pen, a0ter dela) o0 1"" seconds, channel 2 is lose 89ample 2: *end command AT-1, AT-1, hannel 1 is pen, hannel 2 is lose *end command AT-2, AT-2, hannel 2 is pen, hannel 1 is lose *end command AT-3, AT-3, hannel 1 is lose, hannel 2 is lose MODBUS command (functon code !" s Control command#!$ s %ead status command)
Note : 1 4D'7* command must be ;86 2 *lave ID /device address must be consistent with the DIP switches /A"#A$ 3 A5 pin o0 DIP switch must be N state
%&"" 'and ,( Data bits,None Parit),1 *top 'it 。 MODBUS "& ommand /Control command ,;86: ')tes 1 2 3 $ Number 4D'7* *lave ID !unction Address De0initions !unction Device !unction hannel Address number pen "9""# "9"& "9"""1 "91! "9"""2 lose "9""# "9"& "9"""1 "91! "9"""2 To..le /*el0# "9""# "9"& "9"""1 locin. "91! "9"""2 atch Inter# "9""# "9"& "9"""1 locin. "91! "9"""2 4omentar) "9""# "9"& "9"""1 /Non# "91! "9"""2 locin. Dela) "9""# "9"& "9"""1 "91! "9"""2
5
&
<
(
CRC Check
Data
CRC Check
"9"1
Dela) time "9""
"9"2
"9""
2')tes CRC
"9"3
"9""
2')tes CRC
"9"$
"9""
2')tes CRC
"9"5
"9""
2')tes CRC
"9"&
"9""# "900
2')tes CRC
ommand
2')tes CRC
+emars: 1 4omentar) mode, dela) time is "=5 seconds 2 Dela) mode, dela) time is "#255 seconds +eturn command: ommand is active, return to send commands> instruction is invalid no return= MODBUS "3 ommand /%ead status command ,;86: ')tes Number 1 2 3 $ 4D'7* *lave ID !unction Address De0initions !unction Device !unction *tartin. Address re.ister address +ead hannel 1 "9""#"91! "9"3 "9"""1 *tate +ead hannel 2 "9""#"91! "9"3 "9"""2 *tate +ead hannel 1 "9""#"91! "9"3 "9"""1 And hannel 2 *tate
+ead status command returns /0unction code "3, ;86 0ormat: ')tes len.th 1 1 1 4D'7* *lave ID !unction data data
5 Data
&
<
(
CRC Check CRC Check
+e.ister len.th "9"""1 "9"""1 "9"""2
2
CRC16 Check
De0initions !unction
hannel 1 open hannel 1 close hannel 2 open hannel 2 close hannel 1 open hannel 2 open hannel 1 open hannel 2 close hannel 1 close hannel 2 open hannel 1 close hannel 2 close
Device Address
!unction
len.th data len.th
"9""#"91!
"9"3
"9"2
+ela) state "9"""1 open "9"""" close "9"""1
"9""#"91!
"9"3
"9"2
"9""""
"9""#"91!
"9"3
"9"2
"9"""1
"9""#"91!
"9"3
"9"2
"9""""
"9""#"91!
"9"3
"9"$
"9"""1 "9"""1
"9""#"91!
"9"3
"9"$
"9"""1 "9""""
"9""#"91!
"9"3
"9"$
"9"""" "9"""1
"9""#"91!
"9"3
"9"$
"9"""" "9""""
4D'7* commands )ou can use 4odbus Poll input, as shown below (+ chec .enerated automaticall))
?ou can also use ;)perTerminal serial input, as shown below (4anuall) add + chec )
CRC16 Check
89amples /*lave ID is 1,DIP switch state hannel 1 pen :"1 "& "" "1 "1 "" D% %A hannel 1 lose :"1 "& "" "1 "2 "" D% &A hannel 1 To..le:"1 "& "" "1 "3 "" D( !A hannel 1 atch:"1 "& "" "1 "$ "" DA A hannel 1 4omentar): "1 "& "" "1 "5 "" D' 5A hannel 1 Dela) 1" seconds : "1 "& "" "1 "& "A 5' AD hannel 1 Dela) 1"" seconds: "1 "& "" "1 "& &$ DA $1
hannel 2 pen :"1 "& "" "2 "1 "" 2% %A hannel 2 lose :"1 "& "" "2 "2 "" 2% &A hannel 2 To..le :"1 "& "" "2 "3 "" 2( !A hannel 2 atch :"1 "& "" "2 "$ "" 2A A hannel 2 4omentar) : "1 "& "" "2 "5 "" 2' 5A hannel 2 Dela) 1" seconds : "1 "& "" "2 "& "A A' AD hannel 2 Dela) 1"" seconds : "1 "& "" "2 "& &$ 2A $1 +ead state /assumin. that the channel 1 is open, the channel 2 is close= +ead channel 1 state :"1 "3 "" "1 "" "1 D5 A +eturn open:"1 "3 "2 "" "1 <% ($ +ead channel 2 state :"1 "3 "" "2 "" "1 25 A +eturn close:"1 "3 "2 "" "" '( $$ +ead channel 1 and channel 2 state :"1 "3 "" "1 "" "2 %5 ' +eturn channel open and channel 2 close :"1 "3 "$ "" "1 "" "" A' !3
C%C chec& code(C5' MCU) :
const unsi.ned char code auch+;i@25& B "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$", "9"1, "9", "9(", "9$1, "9"1, "9", "9(", "9$1, "9"", "91, "9(1, "9$" C> const unsi.ned char code auch+o@25& B "9"", "9", "91, "9"1, "93, "9"3, "9"2, "92, "9&, "9"&, "9"<, "9<, "9"5, "95, "9$,"9"$, "9, "9", "9"D, "9D, "9"!, "9!, "98, "9"8, "9"A, "9A, "9', "9"', "9%, "9"%, "9"(, "9(, "9D(, "91(, "91%, "9D%, "91', "9D', "9DA, "91A, "918, "9D8, "9D!, "91!, "9DD, "91D, "91, "9D, "91$, "9D$, "9D5, "915, "9D<, "91<, "91&, "9D&, "9D2, "912, "913, "9D3, "911, "9D1, "9D", "91", "9!", "93", "931, "9!1, "933, "9!3, "9!2, "932, "93&, "9!&, "9!<, "93<, "9!5, "935, "93$, "9!$, "93, "9!, "9!D, "93D, "9!!, "93!, "938, "9!8, "9!A, "93A, "93', "9!', "93%, "9!%, "9!(, "93(, "92(, "98(, "98%, "92%, "98', "92', "92A, "98A, "988, "928, "92!, "98!, "92D, "98D, "98, "92,
"98$, "92$, "925, "985, "92<, "98<, "98&, "92&, "922, "982, "983, "923, "981, "921, "92", "98", "9A", "9&", "9&1, "9A1, "9&3, "9A3, "9A2, "9&2, "9&&, "9A&, "9A<, "9&<, "9A5, "9&5, "9&$, "9A$, "9&, "9A, "9AD, "9&D, "9A!, "9&!, "9&8, "9A8, "9AA, "9&A, "9&', "9A', "9&%, "9A%, "9A(, "9&(, "9<(, "9'(, "9'%, "9<%, "9'', "9<', "9
unsi.ned int +1&/unsi.ned char Estr,unsi.ned int usDataen B unsi.ned char uch+;i "9!! > FE hi.h b)te o0 + initialiGed EF unsi.ned char uch+o "9!! > FE low b)te o0 + initialiGed EF unsi.ned uInde9 > FE will inde9 into + looup table EF while /usDataen##FE pass throu.h messa.e bu00er EF B uInde9 uch+;i H Estr-- > FE calculate the + EF uch+;i uch+o H auch+;i@uInde9> uch+o auch+o@uInde9 > C return /uch+;i ( J uch+o > C