Mail Archives: djgpp/1997/12/20/09:31:46
From: | Adam Young <ayoung AT ksu DOT edu>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Parallel Port and printf
|
Date: | Fri, 19 Dec 1997 23:16:07 -0600
|
Organization: | Kansas State University
|
Lines: | 62
|
Message-ID: | <Pine.SOL.3.96L.971219231050.8853A-200000@nbc.ksu.ksu.edu>
|
NNTP-Posting-Host: | nbc.ksu.ksu.edu
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime AT docserver DOT cac DOT washington DOT edu for more info.
---559023410-851401618-882594967=:8853
Content-Type: TEXT/PLAIN; charset=US-ASCII
Hello,
I am developing a program that uses the parallel
port to read a 4-bit BCD number and return the
decimal value. I am accomplishing this by constantly
scanning the port and checking for the strobe (DV)
to go high. Once it goes high, the 4-bit word is
sent to "conv" to be converted to the corresponding
decimal value and printed to the screen. This is the
problem. The "printf" marked with the ???? is needed
for the numbers to be printed out "real time". If
I do not have the "printf ("\n");" statement, the
program only writes to the screen AFTER I hit control-c
to stop the program. I am using DJGPP and RHIDE to
develop this program.
What I want is to print the data to the screen (and,
later to be logged in a file) in a row (ie. "123456")
instead of on a new line each time. I am sure this
is not a problem with DJGPP or RHIDE but a simple
"error" that I am making. Any help is appreciated.
Thanks in advance!
Adam (ayoung AT ksu DOT edu)
attachment
---559023410-851401618-882594967=:8853
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="port.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine DOT SOL DOT 3 DOT 96L DOT 971219231607 DOT 8853B AT nbc DOT ksu DOT ksu DOT edu>
Content-Description:
bWFpbigpDQp7DQogIGludCBzdGF0dXMsc3Ryb2JlPTE7DQogIGZvciggOyA7
ICkgLy9OZXZlciBlbmRpbmcgbG9vcA0KICB7DQogICAgICBwcmludGYoIlxu
Iik7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