Re: I/O Port access from eVC++ 4.0
From: Michael Schwab (michael.schwab_at_cobecv.com)
Date: 04/27/04
- Previous message: Jian: "how to get the custom control?"
- In reply to: Anthony Marchini: "Re: I/O Port access from eVC++ 4.0"
- Next in thread: Paco Novell: "Re: I/O Port access from eVC++ 4.0"
- Reply: Paco Novell: "Re: I/O Port access from eVC++ 4.0"
- Reply: Steve Maillet \(eMVP\): "Re: I/O Port access from eVC++ 4.0"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 27 Apr 2004 14:40:35 -0600
_asm works fine.
Here's what I use on my Advantech PCM5820, and it's worked under both CE 3.0
and CE 4.2:
// To input a 16-bit data value from I/O port addr:
unsigned short inpw(unsigned short addr) {
unsigned short retval;
_asm{ push dx
push ax
mov dx,addr
xor ax,ax
in ax,dx
mov retval,ax
pop ax
pop dx
}
return(retval);
}
// To output 16-bit data to I/O port addr:
void outpw(unsigned short addr, unsigned short data){
_asm{ push dx
push ax
mov dx,addr
mov ax,data
out dx,ax
pop ax
pop dx
}
}
// To output 8-bit data to I/O port addr:
void outpw(unsigned short addr, unsigned short data){
_asm{ push dx
push ax
mov dx,addr
mov ax,data
out dx,al
pop ax
pop dx
}
}
"Anthony Marchini" <marchini@am_r_c.nl0ckerd0tcom> wrote in message
news:OY0uLZGLEHA.912@tk2msftngp13.phx.gbl...
>
> "Paco Novell" <anonymous@discussions.microsoft.com> wrote in message
> news:BDE6D8E6-2CF2-4A29-855D-7FC7665495DC@microsoft.com...
> > I am using an Advantech PCM-5820 SBC (Geode Processor)
>
> Didn't Advantech supply any drivers?
> Pehaps you can make a VC++ dll that creates an output and an input
function
> and
> uses an inline ASM series of instructions to use the OUT and IN opcodes.
> I don't know if the _asm{ } directive is still supported
> T.
>
>
- Previous message: Jian: "how to get the custom control?"
- In reply to: Anthony Marchini: "Re: I/O Port access from eVC++ 4.0"
- Next in thread: Paco Novell: "Re: I/O Port access from eVC++ 4.0"
- Reply: Paco Novell: "Re: I/O Port access from eVC++ 4.0"
- Reply: Steve Maillet \(eMVP\): "Re: I/O Port access from eVC++ 4.0"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|