B&B Electronics 485SDD16 manual MSpups = MSpups and NOTmask LSpups = LSpups and NOTmask

Page 16

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$;

485SDD16-1005 Manual

27

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$;

28

485SDD16-1005 Manual

B&B Electronics -- 707 Dayton Road -- Ottawa, IL 61350

B&B Electronics -- 707 Dayton Road -- Ottawa, IL 61350

PH (815) 433-5100 -- FAX (815) 433-5104

PH (815) 433-5100 -- FAX (815) 433-5104

Image 16
Contents Electronics Mfg. Co. Inc Designed and Manufactured Ottawa, IllinoisInternet Sales@bb-elec.com Support@bb-elec.comTable of Contents 485SDD16 Specifications 485SDD16 FeaturesIntroduction Communications Power SupplySize Connections Digital I/O Connections485SDD16 I/O Port Pinout Serial Port ConnectionsExample of Multi-Node Network Commands 485SDD16 CommandsEquivalent Values SyntaxSet Output Lines Command Read I/O Lines CommandBit Assignments for I/O Lines Set Module Address Command Set Turn-around Delay CommandDefine I/O Lines Command Command AddrSC ArgumentSet Power-up States Command Read Configuration CommandRead Configuration command returns the modules I/O Command AddrRC Argument None ResponseInterfacing Digital InputsIsolated Solid State Input Digital OutputsProgramming Techniques SoftwareDigital I/O Mask Values Set Output States Command MSdefs = MSdefs and mask LSdefs = LSdefs and maskMSpups = MSpups and mask LSpups = LSpups and mask MSstates = MSstates or mask LSstates = LSstates or maskDefine I/O Lines Command Set Power-up States CommandCmnd$ = ! + CHR$Maddr + SO + CHR$MSstates + CHR$LSstates Maddr =Set Module Address Command MSpups = MSpups and NOTmask LSpups = LSpups and NOTmaskCmnd$ = ! + CHR$Maddr + SS + CHR$MSpups + CHR$LSpups LSpups = LSpups or &H20Demonstration Program Running Demonstration ProgramDecimal 485SDD16-1005 Manual Appendix a119 120 121 122 123 124 125 126 127 485SDD16-1005 Manual Appendix aAppendix B 485SDD16-1005 Manual Appendix BDecimal to Hexadecimal Conversion 2523rd Hex digit 240 4th Hex digit Decimal equals 10FC hexadecimalAppendix C Table C.2 DBM16 I/O Connections Table C.1 DTB25 ConnectionsDBM16 Interfacing Figure C.4 Solid State Input 485SDD16-1005 Manual Appendix CDBM16 Specifications Lines Power Supply Input VoltageTotal Connections SizeFigure C.10 DBM16 Schematic #addrRD Msb~ I/O msbI/O lsb ~ I/O lsb00FF01FE Comp = not x and &HFFTable D-1 Extended Commands 485SDD16-1005 Manual Appendix D