Re: LPT square wave
- From: mrdarrett@xxxxxxxxx
- Date: 4 Oct 2006 15:37:51 -0700
Jonathan Kirwan wrote:
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.
Borland... sure is. Turbo C++ 1.01 for DOS was released to Borland's
museum:
http://bdn.borland.com/article/0,1410,21751,00.html
The download link is kinda "hidden" (took me awhile to find it, I
reproduce it here for others' convenience):
http://bdn.borland.com/article/images/21751/tcpp101.zip
The newer Borland C++ 5.5 command line tools don't support delay() and
outportb() anymore, from what I understand. (I could be wrong.)
Michael
.
- Follow-Ups:
- Re: LPT square wave
- From: Jonathan Kirwan
- Re: LPT square wave
- References:
- LPT square wave
- From: rpodraza
- Re: LPT square wave
- From: Leon
- Re: LPT square wave
- From: docent
- Re: LPT square wave
- From: GM
- Re: LPT square wave
- From: Jonathan Kirwan
- LPT square wave
- Prev by Date: Re: AN: Open Instrumentation Project Progress
- Next by Date: Re: terrifying
- Previous by thread: Re: LPT square wave
- Next by thread: Re: LPT square wave
- Index(es):