X86 cpu pc/104 bus mounting data acquisition card register operation experiment

Source: Internet
Author: User

After a week, I finally completed the read/write test on the peripheral registers, so I had little knowledge about the hardware.
The operating system Windows ce5.0, the CPU board of the X86 architecture of the hardware platform, the multi-function data acquisition card mounted on the PC/104 bus, and the software development tool evc4 are tested using MFC.

Read and Write the peripheral Register address for 363h. (363h is the 0-channel and 8-bit Dio control register of the data acquisition card .)

The read button is the value of the read di register, indicating the level of the input bit. During the test, the corresponding bit is 1 when the voltage is 1.2v/100 ohm resistor. For example, when dio2 is input, the displayed value is 4.
The write button is the write do register value in the range of 0-255. It is used to control the eight-bit output of do channel 0, and the display output is illuminated by LEDs.

Experience:
(1) If you use the port operation macro that comes with Wince: read_port_uchar, write_port_uchar
1. Copy ceddk. H, pkfuncs. H, toolhelp. H, and ceddk. dll corresponding to the platform customized in Pb, and link ceddk. Lib.
2. It is best to use the corresponding physical port and value definition
# Define Port 0x363
# Define value 1
This facilitates modification and avoids data loss during type conversion. Because the macro read_port_uchar (unsigned char *) port), write_port_uchar (unsigned char *) Port, (unsigned char) value) requires the operation object to be of the uchar type and the range is between 0 and 25.

(2) If an assembly is embedded in EVC
Avoid system reserved keywords, such as writing out to avoid syntax errors reported by the compiler.

(3) a deeper understanding of the register Concept
When a register on the same address can be read and written, it cannot be expected that the written value can be read back.
In the hardware system, reading and writing a peripheral register is actually a bus signal. If the reading signal is low, the value of the corresponding register is read, which is irrelevant to the value previously written in this register. To put it simply, the same physical address may be used by several data registers and reused by signals.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.