B&B Electronics 232DRIO manual Appendix B

Page 27

APPENDIX B

Hexadecimal/Decimal Conversions

The decimal (base 10) numbering system represents each position in successive powers of 10, with each decimal symbol having a value from 0 to 9. The hexadecimal (base 16) numbering system represents each position in successive powers of 16 with each hex symbol having a value of 0 to 15. Since each hex position must have a single symbol, the symbols "A" through "F" are assigned to values 10 through 15 respectively. Refer to Table 1. The information and examples to follow will explain how to convert from a decimal number to a hexadecimal number and vice versa.

 

Table 1.

Decimal

 

Hexadecimal

Value

 

Symbol

0

 

0

1

 

1

2

 

2

3

 

3

4

 

4

5

 

5

6

 

6

7

 

7

8

 

8

9

 

9

10

 

A

11

 

B

12

 

C

13

 

D

14

 

E

15

 

F

232DRIO-0308 Manual

Appendix B

B-1

B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350

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

Image 27
Contents Internet Model 232DRIOElectronics Mfg. Co. Inc Designed and Manufactured Ottawa, IllinoisPage Table of Contents Appendix B Table of Contents 232DRIO-0308 ManualIntroduction 232DRIO FeaturesNon-polarized, Optically Isolated Input 232DRIO-0308 Manual 232DRIO SpecificationsEnvironment Power SupplyRelay Outputs CommunicationsGround ConnectionsOpto-isolated Input black terminal blocks Relay Outputs blue terminal blocksRS232 Connector Pinout 232DRIO Terminal BlocksSerial Port Connections Power Supply Connections 232DRIO To DTE Connections232DRIO To DCE Connections #0R 01FEComp = not x and &HFF Syntax 232DRIO CommandsFunction Command Response Equivalent ValuesData Bytes Bit Assignments for I/O LinesExample Set Output Lines Data Byte Relays Binary Decimal Relay #2 Relay #1Input #1 Relay #2 Relay #1 Shown in bold face Read I/O Lines CommandSet Output Lines Command 0R00000000…~… shown in bold face Argument … shown in bold face0S03 0S00000011Board Layout Opto-isolated Input Switch Input Isolated Mechanical Input Relay Outputs 232DRIO External Circuit Closing a COM Port SymbolDigital I/O Mask Values Opening a COM PortQuickBasic DEMO232.EXE and DEMO232.BAS Using the 232DRIO.LIB with QuickBasicRead I/O States Command Set Output States Command#include232DRIO.H void main ++ DEMO232.EXE and DEMO232.CPPQuickBasic Running Demonstration ProgramAppendix a Decimal to HEX to Ascii Conversion Table Appendix a 232DRIO-0308 ManualAppendix B Appendix B 232DRIO-0308 Manual Decimal to Hexadecimal Conversion