Write data to I/O Port address
I want to write a function in C++ to do the "channel selection" for a hardware which is a A-to-D card with 16 channels.
The information provided by the card manual is here:
I/O port address H278: output A/D channel number (low nibble)
I want to know how to write the code. Can you give me some examples in your explanation. Thanks
Write data to I/O Port address
Thank you very much, Bubba, Your help is very useful!
Here I give u more information and hope you can understand what I want to do.
Actually, the hardward is an Analog-to-digital (A-D) conversion card with resolution 12-bit and ISA slot. It's not a sound card.
Now, I need to develop a user programme using C/C++ to drive the card.
The programme can be able to:
1. select a channel (from 16 channels)
2. clear A-D register memory and then capture the analog singal(i.e. sampling), then convert it into digital form(binary number)
3. save the digital data into file
4. open data file and plot it in graph
5. adjust some setting e.g. sampling frequency, sampling time ...
Now, the 1st function seems to be completed. I want to go on for the 2nd function:
The manual provide me with the following information:
I/O port address Description
H27B Clear register
H27C A/D conversion loop(low)
H27D A/D conversion loop(high)
The manual suggest a programming technique:
Clear register
OUT (port +3), 0
Should I put '0' in 0x027B to clear the register. But which channel's register will be cleared by doing this? How should I know that?
Then, to start conversion, the manual suggest:
FOR I=1 to 5
A = INP (port +4)
NEXT I=1 to 9
A = INP (port +5)
NEXT I
To read high byte(low nibble)
C = INP (port +2)
HB = (C/16 -INT(C/16))*16
To read low byte(8 bits)
LB = INP (port +1)
converted data = HB*256 + LB
I don't know what 'INP' and 'INT' is about? Please explain them to me with sample code if possible. Thanks
Since my target system to run the programm is DOS, so where can I find a C/C++ compiler for DOS. Window based VC++ cannot compiler a exe programme executable in MS DOS.