Re: LPT square wave



On Wed, 4 Oct 2006 11:27:41 +0300, "GM" <spamthis@xxxxxxxxxxxx> wrote:

<docent@xxxxxxxxx> wrote in message
news:1159949547.624798.43040@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Generating SPI with software using the PC printer port is quite easy,
just follow the timing diagram. The clock doesn't have to be a
conventional square wave, just drive it high and low at the correct
time with the data line held high or low. Connecting a 74HC595 with
LEDs on the outputs to the printer port can be useful when debugging
the software, the 74HC595 is SPI-compatible and makes it easy to see
when you have got it right. I have one mounted on a small PCB with the
LEDs.


Thanks for the answer. Can you tell me is it better to use some kind of
timer or just plain delays?


Plain delays (for example 'for' loops) will be depended on the system speed.
In other words, as an example, the same loop would be faster in a Pentium
than in a 486. In a Windows program that I've coded for programming AVR
chips, I used the High-Performance Timer instead of the plain old Timer that
gives no less than 10ms interval, thus achiving tolerant (from the user's
view) programming speeds
<snip>

Printer port I/O is handled via the legacy ISA bus transaction
mechanism. There is a precisely defined I/O cycle there, so on modern
computers which are way way faster the limiting time will be this
cycle time. For an 8MHz bus (I think the BIOS can allow this setting
on many systems), this is 6 cycles or 750ns per I/O. I don't think it
can be affected by read-around-writes, caches, etc. It's supposed to
operate like an ISA bus, even if there isn't a physical ISA bus
present (it's just internal to the chip set in those cases.)

My preference for things like this is to actually use DOS on an older
slow Pentium (one of the early ones running at 66MHz or so) or else to
use a 80486 or a system actually sporting a true ISA bus on-board. I
puchased a lot of copies of DOS 5.0 just for the purpose of legally
installing them, as needed. I also keep a bevy of old DOS compilers
that I own, from Microsoft C 4.0 up through their last 16-bit version,
that is VC++ 1.52C. Plus their QuickC 2.0, various QB's and VB-DOS
1.0, etc. Borland tools are also available, even today I think, for
free. But under DOS you don't have WinOldAP (Win95, Win98) or else
something works (WinXP) blocking all access to I/O addresses and
double-checking, with all the attendant delays to it. You do the I/O
and the I/O transactions happen. You can grab timers and the
interrupt vector will take you to your code right away, rather than
through some Windows mapping that eventually, someday, gets you there
after who knows how much internal hand-wringing.

Jon
.



Relevant Pages

  • Re: Dynamic configure max_cstate
    ... fio is a disk I/O workload ... are we actually taking ACPI Cx exit latency into account, ... I also thought it's related to timer. ...
    (Linux-Kernel)
  • I/O redirection in Prodos and Dos
    ... I/O Redirection in DOS and ProDOS ... This Technical Note discusses I/O redirection differences between DOS ... installed at $36-$39 and install your I/O addresses in the global page ...
    (comp.sys.apple2.programmer)
  • Re: [PATCH] Freeze bdevs when freezing processes.
    ... The issue I've seen in the past related not to threads but to timer ... used on I/O completion and that can, in some circumstances, ... this as the workqueues are flushed as part of quiescing the filesystem. ... Now at last I know what the problem actually is and why we need the freezing ...
    (Linux-Kernel)
  • Re: [PATCH] Freeze bdevs when freezing processes.
    ... The issue I've seen in the past related not to threads but to timer ... used on I/O completion and that can, in some circumstances, ... this as the workqueues are flushed as part of quiescing the filesystem. ... alternative is to teach XFS to sense that we are being frozen ...
    (Linux-Kernel)
  • Re: [PATCH] Freeze bdevs when freezing processes.
    ... The issue I've seen in the past related not to threads but to timer ... A stack trace ... used on I/O completion and that can, in some circumstances, ... this as the workqueues are flushed as part of quiescing the filesystem. ...
    (Linux-Kernel)