Posted by jjwood@xxxxxxx.xxxxxxxxx.xx on 2000-11-09
Hello -
I am trying to control a homemade electrical device using a port on my
computer. I would like to be able to control the value of the bits attached to
each pin in the port. (I am running Win98, and compiling with MSVC 5.0 or
Borland 3.1)
1) My port addresses are 0x378(parallel) and 0x3F8(serial). As I understand
it, the pins are represented by 0x378+n, where n is the pin number. Does this
mean that each pin is represented by a BYTE, and not a BIT of memory? If so,
what constitutes a 1(high) or a 0(low)?
2) What is horribly wrong with this bit of code?
#include <stdio.h>
void main(void)
{
int *ptrPort = (*int) 0x378;
*(ptrPort) = 255; //Should this be 32 bit binary instead of 8?
}
I am trying to do this at a very low level. I don't want any of the overhead
of the pre-built functions because I would like to use all of my pins as
individual controls.
Thanks!
Jason.
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/
Previous post | Next post | Timeline | Home