Parallel port: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
No edit summary |
m Bot: Replace deprecated source tag with syntaxhighlight |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1:
{{NoteBox|<b
[http://f.osdev.org/viewtopic.php?f=13&t=30279 <b>OSDev Forum:</b> Easy Parallel Port Programming Tests (Under Windows)]▼
Line 70 ⟶ 68:
In Standard (or Compatibility) mode, data is sent to the connected device by writing the byte to the data port, then pulsing the STROBE signal. This pulse informs the device that data is ready to be read. The device will respond by raising its BUSY signal and then reading the data and performing some processing on it. Once this processing is complete, the device will lower the Busy signal and may raise a brief ACK signal to indicate that it has finished.
<
// Sends a byte to the printer
void Parallel_SendByte( unsigned char pData )
Line 77 ⟶ 75:
// Wait for the printer to be receptive
while ( !
{
Timer_Delay( 10 );
Line 83 ⟶ 81:
// Now put the data onto the data lines
// Now pulse the strobe line to tell the printer to read the data
lControl = Ports_In8( 0x37A);
Timer_Delay( 10 );
// Now wait for the printer to finish processing
while ( !
{
Timer_Delay( 10 );
}
}
</syntaxhighlight>
<tt>Timer_Delay()</tt> pauses processing for the specified number of milliseconds. <tt>
Line 112 ⟶ 110:
[[File:Win32_lpthandler_exe_0000.jpg]]
<
/*
In short we only need:
*/
Line 134 ⟶ 132:
//their bits:
///
//Now send an value betwewen 0 and 255 to the data port:
///
</syntaxhighlight>
== See Also ==
=== Threads ===
▲* [
[[Category:Common Devices]]
[[Category:Hardware Interfaces]]
|