Click here to Skip to main content
15,916,432 members
Home / Discussions / Hardware & Devices
   

Hardware & Devices

 
GeneralRe: Serial Int Question Pin
Luc Pattyn9-Aug-07 5:44
sitebuilderLuc Pattyn9-Aug-07 5:44 
GeneralRe: Serial Int Question Pin
NormDroid9-Aug-07 20:47
professionalNormDroid9-Aug-07 20:47 
GeneralRe: Serial Int Question Pin
Luc Pattyn9-Aug-07 22:39
sitebuilderLuc Pattyn9-Aug-07 22:39 
GeneralRe: Serial Int Question Pin
NormDroid9-Aug-07 22:50
professionalNormDroid9-Aug-07 22:50 
GeneralRe: Serial Int Question Pin
Luc Pattyn9-Aug-07 23:29
sitebuilderLuc Pattyn9-Aug-07 23:29 
GeneralRe: Serial Int Question Pin
NormDroid9-Aug-07 23:34
professionalNormDroid9-Aug-07 23:34 
GeneralRe: Serial Int Question Pin
Luc Pattyn9-Aug-07 23:48
sitebuilderLuc Pattyn9-Aug-07 23:48 
GeneralRe: Serial Int Question Pin
cp987611-Aug-07 18:41
cp987611-Aug-07 18:41 
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 # 4

char 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."

QuestionSelf-built vs. pre-built computers Pin
David Crow8-Aug-07 8:11
David Crow8-Aug-07 8:11 
AnswerRe: Self-built vs. pre-built computers Pin
Maximilien8-Aug-07 8:54
Maximilien8-Aug-07 8:54 
AnswerRe: Self-built vs. pre-built computers Pin
Dan Neely8-Aug-07 9:13
Dan Neely8-Aug-07 9:13 
AnswerRe: Self-built vs. pre-built computers Pin
dighn8-Aug-07 9:30
dighn8-Aug-07 9:30 
AnswerRe: Self-built vs. pre-built computers Pin
#realJSOP8-Aug-07 12:39
professional#realJSOP8-Aug-07 12:39 
QuestionUSB Drives Enable/Disable Pin
kulkarniquiet6-Aug-07 23:38
kulkarniquiet6-Aug-07 23:38 
AnswerRe: USB Drives Enable/Disable Pin
#realJSOP7-Aug-07 2:50
professional#realJSOP7-Aug-07 2:50 
GeneralRe: USB Drives Enable/Disable Pin
kulkarniquiet7-Aug-07 3:10
kulkarniquiet7-Aug-07 3:10 
GeneralRe: USB Drives Enable/Disable Pin
GuyThiebaut10-Aug-07 6:10
professionalGuyThiebaut10-Aug-07 6:10 
QuestionLaptop Battary Pin
scorp_scorp5-Aug-07 3:57
scorp_scorp5-Aug-07 3:57 
AnswerRe: Laptop Battary Pin
Johpoke5-Aug-07 8:04
Johpoke5-Aug-07 8:04 
AnswerRe: Laptop Battary Pin
#realJSOP7-Aug-07 2:59
professional#realJSOP7-Aug-07 2:59 
AnswerRe: Laptop Battary Pin
Craster9-Aug-07 3:19
Craster9-Aug-07 3:19 
QuestionHDD failure Pin
matjame2-Aug-07 21:07
matjame2-Aug-07 21:07 
AnswerRe: HDD failure Pin
Johpoke3-Aug-07 4:53
Johpoke3-Aug-07 4:53 
GeneralRe: HDD failure Pin
matjame5-Aug-07 21:20
matjame5-Aug-07 21:20 
GeneralRe: HDD failure Pin
Dan Neely6-Aug-07 2:33
Dan Neely6-Aug-07 2:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.