Serial Int Question [modified]
-
I have a serial interface on a device with 6 pins: 1 NC 2 0v 3 +12v 4 SClk 5 SData 6 0v Now I want to wire this to a serial Port on a PC, I have wired the 12v and 0v to a molex, but I need to work out were to wire SClk and SData, I'm guessing (on previous experience) that I should be wiring SClk to DTR and SDATA to RX on the RS232. I'm I warm or completely cold. BTW: The 12v and 0v and input supply voltages. -- modified at 9:02 Thursday 9th August, 2007 -- modified at 9:07 Thursday 9th August, 2007
Roger Irrelevant "he's completely hatstand"
Just reading this thread it appears that you want to interface to an I2C device. For simply writing to the device, it is pretty easy to do this using the PC parallel port. I have intefaces to many ICs that use this interface in this manner. It is even easier if you have an old PC running Win98, as there you could simply write to the parallel port using an OUT instruction. On OSs based on NT (i.e. Win2k and XP), you need a device driver. To give you an idea, here is a code snippet synchronously clocking n bits of data out of hte parallel port on a Win98 machine:
const int PORT = 0x378; // base address of LPT1 on
const char ENABLE = 1; // syn enable PC Pin # 2
const char CLOCK = 2; // syn clock PC Pin # 3
const char DATA = 4; // syn data PC Pin # 4char state;
void OutputP(long data, int n, bool bSync)
{
// take enable low
state &= ~ENABLE;outp(PORT, state);
long current_bit = pow(2,n-1);
for (int i = 0 ; i < n ; i++)
{
// set data bit
if (data & current_bit)
state |= DATA;
else
state &= ~DATA;
// output data bit
outp(PORT, state);// clock it state |= CLOCK; outp(PORT, state); state &= ~CLOCK; outp(PORT, state); current\_bit /= 2; }
// take enable high
state = ENABLE; // ensures all other lines are low
if (bSync)
state |= SYNC;
outp(PORT, state);
}depending on the speed of your PC you may need some delays to slow down the clocking.
Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
-
Thanks Margret ;)
Roger Irrelevant "he's completely hatstand"
Hi Norm, I came across this today and as they say "I thought of you", its an I2C USB Interface! I bet not many women have said that to you! :-D http://www.elektor.com/default.lynkx?pointer=1-28-16120-16357-16368-26623 Anyway, I had to pass it on in case it might be handy ..... Cheers,
Ali
-
Hi Norm, I came across this today and as they say "I thought of you", its an I2C USB Interface! I bet not many women have said that to you! :-D http://www.elektor.com/default.lynkx?pointer=1-28-16120-16357-16368-26623 Anyway, I had to pass it on in case it might be handy ..... Cheers,
Ali
Alison Pentland wrote:
I came across this today and as they say "I thought of you", its an I2C USB Interface! I bet not many women have said that to you!
Oh you're just one of millions ;) Had a look: articles date around 2004, there are newer ones, I'm just about buy a device under £20 USB->IC2, apparently these things are getting popular, whats needed is somebody to design a board and manufactor in China and bingo $$$. Sell for under £10 including an API:~ -> Norm <-
Roger Irrelevant "he's completely hatstand"