| поискавой системы для электроныых деталей |
|
DM6210 датащи(PDF) 41 Page - List of Unclassifed Manufacturers |
|
|
|||||||||||||||||||||||||||||
DM6210 датащи(HTML) 41 Page - List of Unclassifed Manufacturers |
|
41 / 91 page ![]() 4-9 Programming the DM6210 This section gives you some general information about programming and the DM6210. The module is programmed by reading from and writing to the correct I/O port locations. These I/O ports were defined in the previous section. Most high-level languages such as BASIC, Pascal, C, and C++, and of course assembly language, make it very easy to read/write these ports. The table below shows you how to read from and write to I/O ports using some popular programming languages. In addition to being able to read/write the I/O ports on the DM6210, you must be able to perform a variety of operations that you might not normally use in your programming. The table below shows you some of the operators discussed in this section, with an example of how each is used with C, Pascal, and BASIC. Note that the modulus operator is used to retrieve the least significant byte (LSB) of a two-byte word, and the integer division operator is used to retrieve the most significant byte (MSB). Many compilers have functions that can read/write either 8 or 16 bits from/to an I/O port. For example, Turbo Pascal uses Port for 8-bit port operations and PortW for 16 bits, Turbo C uses inportb for an 8-bit read of a port and inport for a 16-bit read. Be sure to use the correct operation for each register on the DM6210. Clearing and Setting Bits in a Port When you clear or set one or more bits in a port, you must be careful that you do not change the status of the other bits. You can preserve the status of all bits you do not wish to change by proper use of the AND and OR binary operators. Using AND and OR, single or multiple bits can be easily cleared in one operation. Note that most registers in the DM6210 cannot be read back; therefore, you must save the value in your program. To clear a single bit in a port, AND the current value of the port with the value b, where b = 255 - 2bit. Example: Clear bit 5 in a port. Read in the current value of the port, AND it with 223 (223 = 255 - 25), and then write the resulting value to the port. In BASIC, this is programmed as: V_SAVE = V_SAVE AND 223 OUT PortAddress, V /DQJXDJH 0RGXOXV ,QWHJHU 'LYLVLRQ $1' 25 8 È hÃ2ÃiÃÈÃp hÃ2ÃiÃÃp É hÃ2ÃiÃÉÃp hÃ2ÃiÃÃp Qhphy HP9 hÃ)2ÃiÃHP9Ãp 9DW hÃ)2ÃiÃ9DWÃp 6I9 hÃ)2ÃiÃ6I9Ãp PS hÃ)2ÃiÃPSÃp /DQJXDJH 5HDG %LWV :ULWH %LWV 5HDG %LWV :ULWH %LWV U
iÃ8 9hh2v
i6qq
r
i6qq
r9hh 9hh2v
6qq
r
6qq
r9hh U
iÃQhphy 9hh)2Q
b6qq
rd Q
b6qq
rd)29hh 9hh)2Q
Xb6qq
rd Q
Xb6qq
rd)29hh |
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |