Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have installed pci parallel port card on my computer as my motherboard does not have one. The address assigned to the Port is c100 - c107 . I am unable pass this address to inpout32.dll as the dll accepts short data type.
Please help me
Posted
Comments
Sergey Alexandrovich Kryukov 20-Aug-12 14:26pm    
What are you going to use this card for? It looks like using it for a printer is unlikely. What data does not fit in "short data type"? What is exactly "short"? Your addresses are of the type ushort, only byte is shorter... :-)
--SA

1 solution

short is a 16 bit dtaatype, but it is signed - so you can't use the top bit easily, and you will get a compilation error if you try directly.
Use a ushort instead:
C#
ushort u = 0xC106;
Console.WriteLine("{0:X}", u);
 
Share this answer
 
Comments
ravi369 23-Aug-12 5:04am    
Hi,

I tried ushort datatype, the parallel port is not getting detected ie. i'm not able to send any data via pci parallel port.
i am using inpout.dll from www.logix4u.net/ website.

Below is the code that i am using

[DllImport("Parallel Port.dll")]
private static extern void Out32(ushort PortAddress, short data);

[DllImport("Parallel Port.dll")]
private static extern short Inp32(ushort PortAddress);

private void button1_Click(object sender, EventArgs e)
{
ushort DataBusAddress = 0xc100;
Out32(DataBusAddress, Convert.ToInt16(Inp32(DataBusAddress) | 1));
}

I am running windows 7 64-bit os on my pc.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900