B&B Electronics 485SDD16 manual MSdefs = MSdefs and mask LSdefs = LSdefs and mask

Page 14

Step 3 - Receiving the data:

MSdefs$ = INPUT$(1,#1)

LSdefs$ = INPUT$(1,#1)

MSpups$ = INPUT$(1,#1)

LSpups$ = INPUT$(1,#1)

Maddr$ = INPUT$(1,#1)

Mtdly$ = INPUT$(1,#1)

Step 4 - Manipulating the data:

MSdefs = ASC(MSdefs$)

LSdefs = ASC(LSdefs$)

MSpups = ASC(MSpups$)

LSpups = ASC(LSpups$)

Maddr = ASC(Maddr$)

Mtdly = ASC(Mtdly$)

Step 5 - Determining the I/O line definitions:

MSdefs = MSdefs AND mask

LSdefs = LSdefs AND mask

By "ANDing" the value of MSdefs or LSdefs with the appropriate mask of an I/O line, the I/O line definition can be determined. If the status is equal to zero the I/O line is an INPUT. If the status is not equal to zero the I/O line is an OUTPUT. Table 5.1 shows the mask values for each I/O line.

Step 6 - Repeat Step 5 until the status of each I/O line has been determined.

Step 7 - Determining an OUTPUT's Power-up state:

MSpups = MSpups AND mask

LSpups = LSpups AND mask

By "ANDing" the value of MSpups or LSpups with the appropriate mask of an Output line, the Output line definition can be determined. If the status is equal to zero the Output power-up state will be LOW. If the status is not equal to zero the Output power-up state will be HIGH. Table 5.1 shows the mask values for each I/O line.

Step 8 - Repeat Step 7 until the power-up state of each Output line has been determined.

Example 5.2 - Determining the definition and power-up state of I/O lines #2 & #10 of module #5.

485SDD16-1005 Manual

23

B&B Electronics --

707 Dayton Road -- Ottawa, IL 61350

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

Maddr = 5 mask = &H4

Cmnd$ = "!" + CHR$(Maddr) + "RC" PRINT #1, Cmnd$;

MSdefs$ = INPUT$(1,#1)

LSdefs$ = INPUT$(1,#1)

MSpups$ = INPUT$(1,#1)

LSpups$ = INPUT$(1,#1)

Maddr$ = INPUT$(1,#1)

Mtdly$ = INPUT$(1,#1) MSdefs = ASC(MSdefs$) LSdefs = ASC(LSdefs$) MSpups = ASC(MSpups$) LSpups = ASC(LSpups$) Maddr = ASC(Maddr$) Mtdly = ASC(Mtdly$) MSdefs = MSdefs AND mask LSdefs = LSdefs AND mask MSpups = MSpups AND mask LSpups = LSpups AND mask

If LSdefs equals zero then I/O line #2 is an INPUT and if not equal to zero then I/O line #2 is an OUTPUT. If MSdefs equals zero then I/O line #10 is an INPUT and if not equal to zero then I/O line #10 is an OUTPUT. If LSpups equals zero then Output line #2's power-up state is LOW and if not equal to zero then Output line #2's power-up state is HIGH. If MSpups equals zero then Output line #10's power- up state is LOW and if not equal to zero then Output line #10's power-up state is HIGH. Maddr is the decimal address of the module. Mtdly is the decimal number of character times that make up the turn-around delay.

Set Output States Command

The Set Output States command is used to set the states of any I/O line that is defined as an output. This command requires two data bytes. Refer to this command in Chapter 3 for more information.

Step 1a - Construct the command string:

Set appropriate outputs HIGH

MSstates = MSstates OR mask

LSstates = LSstates OR mask

By "ORing" the current states with the appropriate mask of a digital output line, the output's bit will be set to a "1" (HIGH).

24485SDD16-1005 Manual

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

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

Image 14
Contents Internet Electronics Mfg. Co. IncDesigned and Manufactured Ottawa, Illinois Sales@bb-elec.com Support@bb-elec.comTable of Contents Introduction 485SDD16 Features485SDD16 Specifications Size Power SupplyCommunications 485SDD16 I/O Port Pinout ConnectionsDigital I/O Connections Serial Port ConnectionsExample of Multi-Node Network Equivalent Values Commands485SDD16 Commands SyntaxBit Assignments for I/O Lines Read I/O Lines CommandSet Output Lines Command Define I/O Lines Command Set Module Address CommandSet Turn-around Delay Command Command AddrSC ArgumentRead Configuration command returns the modules I/O Set Power-up States CommandRead Configuration Command Command AddrRC Argument None ResponseInterfacing Digital InputsIsolated Solid State Input Digital OutputsDigital I/O Mask Values SoftwareProgramming Techniques MSpups = MSpups and mask LSpups = LSpups and mask Set Output States CommandMSdefs = MSdefs and mask LSdefs = LSdefs and mask MSstates = MSstates or mask LSstates = LSstates or maskCmnd$ = ! + CHR$Maddr + SO + CHR$MSstates + CHR$LSstates Define I/O Lines CommandSet Power-up States Command Maddr =Cmnd$ = ! + CHR$Maddr + SS + CHR$MSpups + CHR$LSpups Set Module Address CommandMSpups = MSpups and NOTmask LSpups = LSpups and NOTmask 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 B3rd Hex digit Decimal to Hexadecimal Conversion252 240 4th Hex digit Decimal equals 10FC hexadecimalAppendix C DBM16 Interfacing Table C.1 DTB25 ConnectionsTable C.2 DBM16 I/O Connections Figure C.4 Solid State Input 485SDD16-1005 Manual Appendix CTotal DBM16 Specifications LinesPower Supply Input Voltage Connections SizeFigure C.10 DBM16 Schematic 00FF01FE #addrRDMsb~ I/O msbI/O lsb ~ I/O lsb Comp = not x and &HFFTable D-1 Extended Commands 485SDD16-1005 Manual Appendix D