TAILIEUCHUNG - Programming Tools P1

Many programs that access the parallel port do many of the same things, including reading and writing to the port registers and finding and testing ports on a system . Another common task is reading, setting, clearing, and toggling individual bits in a byte. This chapter introduces tools to perform these functions in any Visual-Basic program. | Programming Tools Programming Tools Many programs that access the parallel port do many of the same things including reading and writing to the port registers and finding and testing ports on a system. Another common task is reading setting clearing and toggling individual bits in a byte. This chapter introduces tools to perform these functions in any Visual-Basic program. Routines for Port Access Listing 4-1 is a set of subroutines and functions that simplify the tasks of reading and writing to the port registers and performing bit operations. You can add the file as a .bas module in your parallel-port programs use Add Module and call the routines as needed in your code. The individual routines are very short. The reason to use them is convenience. For the port-write subroutines you pass the base address of a port and a value to write to the port. The routines automatically calculate the register address from the base address and invert the appropriate bits so the value passed matches the value that appears at the connector. You don t have to worry about calculating an address and inverting the bits every time you write to a port. For the port-read functions you pass a base address and the function returns the value at the port connector. For the bit operations you pass a variable and bit number and the routine auto- Parallel Port Complete 53 Chapter 4 Function BitRead Variable BitNumber Returns the value 0 or 1 of the requested bit in a Variable. Dim BitValue the value of the requested bit BitValue 2 A BitNumber BitRead Variable And BitValue BitValue End Function Sub BitReset Variable BitNumber Resets clears the requested bit in a Variable. Dim BitValue CurrentValue the value of the requested bit BitValue 2 A BitNumber Variable Variable And HFFFF - BitValue End Sub Sub BitSet Variable BitNumber Sets the requested bit in a Variable. Dim BitValue CurrentValue the value of the requested bit BitValue 2 A BitNumber Variable Variable Or BitValue End Sub Sub BitToggle .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.