Liberty BASIC Community Forum
« Low speed output from parallel port »

Welcome Guest. Please Login or Register.
May 22nd, 2017, 10:40am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Low speed output from parallel port  (Read 93 times)
oi_io
New Member
Image


member is offline

Avatar




PM


Posts: 8
xx Low speed output from parallel port
« Thread started on: Feb 4th, 2017, 06:12am »

I experimented with parallel port. First to find out how fast it could do. I hooked frequency meter to databit#0 and LED + resistor to databit#1. There were 2 code versions. First version
CallDLL was put in subroutine and it yielded only 300Hz. I moved CallDLL into main and best I could get was 37kHz. I want at least 100kHz for I2C communication. My code may need
improvement. Please advise.

[code]

'----------------------------------------
'Ver. 1
'CallDLL in subroutine

dataport = 888
bit = 3

for i = 1 to 10000
call WriteLPT dataport, bit

' j=100, result =277Hz
' j=10, result = 304Hz
' no j, result = 307Hz
'for j = 1 to 10: next j

bit = bit xor 3
next i

end

sub WriteLPT port, value
open "inpout32.dll" for dll as #h
calldll #h, "Out32", _
port as short, _
value as short, _
result as void
close #h
end sub

'----------------------------------------

'Ver. 2
'CallDLL in main

dataport = 888
open "inpout32.dll" for dll as #h
bit = 3

for i = 1 to 500000
calldll #h, "Out32", _
dataport as short, _
bit as short, _
result as void
' j=100, result = 3.02kHz
' j=80, result = 3.71kHz
' j=50, result = 5.53kHz
' j=20, result = 11kHz
' no j, result = 37kHz
'for j = 1 to 100: next j
bit = bit xor 3
next i

close #h
end
« Last Edit: Feb 4th, 2017, 06:13am by oi_io » User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5281
xx Re: Low speed output from parallel port
« Reply #1 on: Feb 4th, 2017, 1:46pm »

old technology, explore interface boards. as it stands you can read the digital input at one pin of the parallel port at a fairly slow pace. input boards like the Arduino can read a hundred times faster and still have the time to talk to liberty BASIC.
User IP Logged

tenochtitlanuk
Moderator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1150
xx Re: Low speed output from parallel port
« Reply #2 on: Feb 4th, 2017, 2:42pm »

Example at USB to I2C
Like Rod I find such devices much more easy to use than re-inventing I2C by bit banging. And I've done plenty of that, from parallel serial ports onwards!
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls