B&B Electronics RS-485 Digital I/O Module 485SDD16 Benutzerhandbuch

Seite von 28
 
485SDD16-1005 Manual 
 
27 
B&B Electronics  --  707 Dayton Road  --  Ottawa, IL  61350 
PH (815) 433-5100  --  FAX (815) 433-5104
 
Step 1b - Set appropriate outputs power-up states LOW 
MSpups = MSpups AND (NOT(mask)) 
LSpups = LSpups AND (NOT(mask))
 
By "ANDing" the current power-up states with the complement of 
the appropriate mask of a digital output line, the power-up state's 
data bit will be set to a "0" (LOW). 
Step 1c - Completing the command string: 
Cmnd$ = "!" + CHR$(Maddr) + "SS" + CHR$(MSpups) + 
CHR$(LSpups) 
Step 2 - Transmitting the command string: 
Print #1, Cmnd$; 
 
Example 5.5 - Set Output #5's power-up state HIGH and Output 
#13's power-up state LOW on module #4. 
'Set module address to 4. 
Maddr = 4 
'Set bit 0 of LSpups to make Output #5's power-up state HIGH. 
LSpups = LSpups OR &H20 
'Clear bit 4 of MSpups to make Output #13's power-up state LOW. 
MSpups = MSpups AND (NOT(&H20)) 
Cmnd$ = "!" + CHR$(Maddr) + "SS" + CHR$(MSpups) + 
CHR$(LSpups) 
PRINT #1, Cmnd$; 
MSIO$ = INPUT$(1,#1) 
Module's #4 output line #5's power-up state will be set HIGH and 
output line #13's power-up state will be set LOW.  All other output 
power-up states will not be changed. 
 
Set Module Address Command 
 
The Set Module Address command is used to change the 
address of the 485SDD16.  This command requires a data byte.  
The data byte is used to specify the new address of the module. 
Step 1 - Construct the command string: 
Cmnd$ = "!" + CHR$(Maddr) + "SA" + CHR$(Naddr) 
Where Maddr if the module's current address and Naddr is the 
module's new address. 
Step 2 - Transmitting the command string: 
Print #1, Cmnd$; 
 
28 485SDD16-1005 
Manual 
B&B Electronics  --  707 Dayton Road  --  Ottawa, IL  61350 
PH (815) 433-5100  --  FAX (815) 433-5104
 
Example 5.6 - Change the address of module with a current address 
of 4 decimal to the new address of 5 decimal. 
Maddr = 4 
Naddr = 5 
Cmnd$ = "!" + CHR$(Maddr) + "SA" + CHR$(Naddr)
 
Print #1, Cmnd$; 
 
Set Turn-around Delay Command 
 
The Set Turn-around Delay command is used to set the amount 
of time the module will wait after receiving a command before it 
sends the response message. This ensures that no two 
communication drivers will be enabled at the same time, and is 
necessary when multiple modules share the same communica- 
tion lines. The command requires one data byte to specify the turn-
around delay.  Refer to this command in Chapter 3 for more 
information. 
Step 1 - Construct the command string: 
Cmnd$ = "!" + CHR$(Maddr) + "SC" + CHR$(Ntdly) 
Where Maddr if the module's address and Ntdly is the module's 
new turn-around delay. 
Step 2 - Transmitting the command string: 
Print #1, Cmnd$; 
 
Example 5.7 - Set the turn-around delay of module #5 to 10 
character times. 
Maddr = 5 
Ntdly = 10 
Cmnd$ = "!" + CHR$(Maddr) + "SC" + CHR$(Naddr)
 
Print #1, Cmnd$;