hello people.
i've been trying to send an 8 byte string to my parallel port under
freebsd. the purpose is it to control a relay board.
the board simply responds to the output byte coming from the port. eg.
00000001 will set pin 1 high and flick the relay open.
todate i've attempted this with merely open() on /dev/ppi0 and numpy for
the byte array, but i just can't seem to get it working.
i know the parallel port works and i know the relay board works (tested
it with it's own windows ultility) so it's just my crappy programming
keeping me from success. 11 5231
On 2006-07-28, Timothy Smith <ti*****@open-networks.netwrote:
i've been trying to send an 8 byte string to my parallel port
under freebsd. the purpose is it to control a relay board. the
board simply responds to the output byte coming from the port.
eg. 00000001 will set pin 1 high and flick the relay open.
todate i've attempted this with merely open() on /dev/ppi0 and
numpy for the byte array, but i just can't seem to get it
working. i know the parallel port works and i know the relay
board works (tested it with it's own windows ultility) so it's
just my crappy programming keeping me from success.
I'm guessing there's an implied request for help there
somewhere. This would be a good start: http://www.google.com/search?q=python+parallel+port
I'd particularly recommend taking a look at the pyparallel
module found here: http://pyserial.sourceforge.net/
I've not used pyparallel, but based on my experience with
pyserial and some of Chris Liechti's other work, I'd bet
dollars to doughnuts it's your best option.
--
Grant Edwards grante Yow! It's so OBVIOUS!!
at
visi.com
On 2006-07-29, Grant Edwards <gr****@visi.comwrote:
I'd particularly recommend taking a look at the pyparallel
module found here:
http://pyserial.sourceforge.net/
Oops, there isn't actually a link to pyparallel from that page
(I swear there used to be). Here's the pyparallel page: http://pyserial.sourceforge.net/pyparallel.html
--
Grant Edwards grante Yow! Here we are in
at America... when do we
visi.com collect unemployment?
Grant Edwards wrote:
On 2006-07-28, Timothy Smith <ti*****@open-networks.netwrote:
>i've been trying to send an 8 byte string to my parallel port under freebsd. the purpose is it to control a relay board. the board simply responds to the output byte coming from the port. eg. 00000001 will set pin 1 high and flick the relay open. todate i've attempted this with merely open() on /dev/ppi0 and numpy for the byte array, but i just can't seem to get it working. i know the parallel port works and i know the relay board works (tested it with it's own windows ultility) so it's just my crappy programming keeping me from success.
I'm guessing there's an implied request for help there
somewhere. This would be a good start:
http://www.google.com/search?q=python+parallel+port
I'd particularly recommend taking a look at the pyparallel
module found here:
http://pyserial.sourceforge.net/
I've not used pyparallel, but based on my experience with
pyserial and some of Chris Liechti's other work, I'd bet
dollars to doughnuts it's your best option.
yes, i did try pyparallel however it will not install on freebsd,
setup.py errors.
and yes i've done quite a bit of googling, i never expected it to be
this difficult. i've done work with serial ports before. never parallel but.
Grant Edwards wrote:
On 2006-07-29, Grant Edwards <gr****@visi.comwrote:
>I'd particularly recommend taking a look at the pyparallel module found here:
http://pyserial.sourceforge.net/
Oops, there isn't actually a link to pyparallel from that page
(I swear there used to be). Here's the pyparallel page:
http://pyserial.sourceforge.net/pyparallel.html
i've had people suggest using fcntl to set the pins status, i'm looking
to that if anyone has any suggestions
Dennis Lee Bieber wrote:
On Sat, 29 Jul 2006 13:59:02 +1000, Timothy Smith
<ti*****@open-networks.netdeclaimed the following in comp.lang.python:
>and yes i've done quite a bit of googling, i never expected it to be this difficult. i've done work with serial ports before. never parallel but.
Parallel gets ugly -- there are something like three different types
of parallel port hardware, and they behave slightly differently (status
bits, bidirectionality, etc.).
http://www.amazon.com/gp/product/096...lance&n=283155
is MS-DOS/Windows biased, but may give hints...
(a few years ago I had to program a W98 laptop to write 6 data pins --
representing three rs-422 style balanced signals -- in response to a
1KHz clock signal coming in on another pin... I had it working, but
couldn't get rid of every last W98 OS interrupt, such that I had a 1-3
clock length skip about every 700 clocks)
i think fcntl is what i'm after, although i've never done any system
level stuff like this before so it's a learning curve for me.
right now i'm attempting to use it like so and getting the following error.
>>fd = open('/dev/ppi0','w') fcntl.ioctl(fd.fileno(),'PPISCTRL',10000000)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: an integer is required
i guess i'm failing to properly define the int i need for the 8byte
value ineed to send the port to set pins high /low
>
>>fd = open('/dev/ppi0','w')
>>fcntl.ioctl(fd.fileno(),'PPISCTRL',10000000)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: an integer is required
i guess i'm failing to properly define the int i need for the 8byte
value ineed to send the port to set pins high /low
Python doesn't know about PPISCTRL - it has no way of knowing all
"secret", OS-specific constants for ioctl-calls.
So, you need to figure out the numeric value of that constant .- look it
up in the appropriate header-file.
Then, you do have the next problem with passing that 10000000 value of
yours. ioctl expects strings or buffers as parameters which contain a
byte-representation of the value you want to set. This is an snippet I
use to read the event device capabilities under linnux:
buf = array.array('c', [' ' for i in xrange(EV_MAX / 8 + 1)])
fcntl.ioctl(self._fd, EVIOCGBIT(0, len(buf)), buf, True)
caps = struct.unpack("I", buf)[0]
HTH,
Diez
Diez B. Roggisch wrote:
> >>fd = open('/dev/ppi0','w') fcntl.ioctl(fd.fileno(),'PPISCTRL',10000000)
Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: an integer is required
i guess i'm failing to properly define the int i need for the 8byte value ineed to send the port to set pins high /low
Python doesn't know about PPISCTRL - it has no way of knowing all
"secret", OS-specific constants for ioctl-calls.
So, you need to figure out the numeric value of that constant .- look it
up in the appropriate header-file.
Then, you do have the next problem with passing that 10000000 value of
yours. ioctl expects strings or buffers as parameters which contain a
byte-representation of the value you want to set. This is an snippet I
use to read the event device capabilities under linnux:
buf = array.array('c', [' ' for i in xrange(EV_MAX / 8 + 1)])
fcntl.ioctl(self._fd, EVIOCGBIT(0, len(buf)), buf, True)
caps = struct.unpack("I", buf)[0]
HTH,
Diez
*sigh*
if only pyparallel would install
*sigh*
if only pyparallel would install
*sigh* If only you said _what_ failed we could maybe help you make it
work... :)
Diez
Diez B. Roggisch wrote:
>*sigh* if only pyparallel would install
*sigh* If only you said _what_ failed we could maybe help you make it
work... :)
Diez
titan# python setup.py install
running install
running build
running build_py
Traceback (most recent call last):
File "setup.py", line 19, in ?
package_data = data_files
File "/usr/local/lib/python2.4/distutils/core.py", line 149, in setup
dist.run_commands()
File "/usr/local/lib/python2.4/distutils/dist.py", line 946, in
run_commands
self.run_command(cmd)
File "/usr/local/lib/python2.4/distutils/dist.py", line 966, in
run_command
cmd_obj.run()
File "/usr/local/lib/python2.4/distutils/command/install.py", line
506, in run
self.run_command('build')
File "/usr/local/lib/python2.4/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python2.4/distutils/dist.py", line 966, in
run_command
cmd_obj.run()
File "/usr/local/lib/python2.4/distutils/command/build.py", line 112,
in run
self.run_command(cmd_name)
File "/usr/local/lib/python2.4/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python2.4/distutils/dist.py", line 965, in
run_command
cmd_obj.ensure_finalized()
File "/usr/local/lib/python2.4/distutils/cmd.py", line 117, in
ensure_finalized
self.finalize_options()
File "/usr/local/lib/python2.4/distutils/command/build_py.py", line
60, in finalize_options
self.data_files = self.get_data_files()
File "/usr/local/lib/python2.4/distutils/command/build_py.py", line
120, in get_data_files
filenames = [
File "/usr/local/lib/python2.4/distutils/command/build_py.py", line
128, in find_data_files
globs = (self.package_data.get('', [])
AttributeError: 'NoneType' object has no attribute 'get'
titan#
"Timothy Smith" <ti*****@open-networks.netwrote:
| Grant Edwards wrote:
| On 2006-07-28, Timothy Smith <ti*****@open-networks.netwrote:
| >
| >
| >i've been trying to send an 8 byte string to my parallel port
| >under freebsd. the purpose is it to control a relay board. the
| >board simply responds to the output byte coming from the port.
| >eg. 00000001 will set pin 1 high and flick the relay open.
| >todate i've attempted this with merely open() on /dev/ppi0 and
| >numpy for the byte array, but i just can't seem to get it
| >working. i know the parallel port works and i know the relay
| >board works (tested it with it's own windows ultility) so it's
| >just my crappy programming keeping me from success.
| >>
| >
| I'm guessing there's an implied request for help there
| somewhere. This would be a good start:
| >
| http://www.google.com/search?q=python+parallel+port
| >
| I'd particularly recommend taking a look at the pyparallel
| module found here:
| >
| http://pyserial.sourceforge.net/
| >
| I've not used pyparallel, but based on my experience with
| pyserial and some of Chris Liechti's other work, I'd bet
| dollars to doughnuts it's your best option.
| >
| >
| yes, i did try pyparallel however it will not install on freebsd,
| setup.py errors.
|
| and yes i've done quite a bit of googling, i never expected it to be
| this difficult. i've done work with serial ports before. never parallel but.
What is on the other side of the link? - if its a small 8 bit micro - you may
simply be going too fast...
- Hendrik
|
On 2006-07-29, Timothy Smith <ti*****@open-networks.netwrote:
>I'd particularly recommend taking a look at the pyparallel module found here:
yes, i did try pyparallel however it will not install on
freebsd, setup.py errors.
Ah. I guess freebsd wasn't one of the systems listed on the
pyparallel page -- I should have paid closer attention.
and yes i've done quite a bit of googling, i never expected it
to be this difficult. i've done work with serial ports before.
never parallel but.
Serial ports on PCs are pretty standardized as 16550 UARTs, and
The Unix serial port API was mostly nailed down years ago.
There are at least three different schemes for parallel ports,
and not everybody implements those identically even if they do
claim to be one of the three. Many motherboard chipsets claim
to do do all three. On top of that, there doesn't seem to be a
common Unix prallel port API.
--
Grant Edwards grante Yow! Is this ANYWHERE,
at USA?
visi.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: coder_1024 |
last post by:
I'm trying to send a packet of binary data to a UDP server. If I send
a text string, it works fine. If I attempt to send binary data, it
sends a UDP packet with 0 bytes of data (just the...
|
by: Chuck Rittersdorf |
last post by:
Hi There
I am having a problem using the win32 API from VB6.
I am trying to send a command string to a printer(zebra TLP 2742) on
LPT1
using the folowing API functions
CreateFile and...
|
by: David |
last post by:
I'm wondering if python is capable of fairly precise timing and also sending
data out the parallel port.
For example ; making a 7.5 KHz square wave come out of one of the data pins
on the...
|
by: MNQ |
last post by:
Hi All
I want to use my parallel port of my PC to control some external devices. I
am writing a program in ANSI C using the PacificC compiler. What I need to
know is how to access the parallel...
|
by: david.brown.0 |
last post by:
I'm trying to make a Java program access a parallel port. Java's comm
API does not provide me with the control I need. I need to be able to
write to the data and control pins and read the status...
|
by: D. Patrick |
last post by:
I need to duplicate the functionality of a java applet, and how it connects
to a remote server. But, I don't have the protocol information or the java
source code which was written years ago. ...
|
by: Hector M Banda |
last post by:
Hi all,
How can I send chr(7) thru VB2005 using the parallel port?
BTW This is for a POS system.
Thanks,
-hb
|
by: hari |
last post by:
Hi all,
I need to automate printer command testing, prinetr supports
parallel/
serial/USB.How can i send the commands from python to printer.
I have got pyparallel, as am new to python, no...
|
by: Soren |
last post by:
Hi,
I want to control some motors using the parallel port.. however, my
laptop does not have any parallel ports (very few do). What I do have
is a USB->Parallel converter... I thought about...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |