AGGIORNAMENTO: Dopo aver verificato che i miei comandi, la configurazione seriale e il terminatore ('\ r') fossero corretti, ho risolto questo problema su 1 di 5 computers. Questo mi porta a credere che sia un problema con l'adattatore. Ho intenzione di chiamare la società per vedere di ordinare un adattatore USB/RJ11 (ero stato utilizzando un Keyspan USB-> DB9-> adattatore RJ11 sul mio Mac)Comandi seriali per BrainTree Scientific, Inc. Pompa a siringa (modello bs-8000) rs232
ho letto this ma sono ancora incapace di comunicare con questa pompa. Questo è lo script python ho modificato (source),
import time
import serial
# configure the serial connections (the parameters differs on the device you are connecting to)
ser = serial.Serial(
port='/dev/tty.USA19H142P1.1', # /dev/tty.KeySerial1 ?
baudrate=19200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS
)
if not ser.isOpen():
ser.open()
print ser
commands = ['dia26.59', 'phn01', 'funrat', 'rat15mm', 'vol0.7', 'dirinf',
'phn02', 'funrat', 'rat7.5mm', 'vol.5', 'dirinf', 'phn03',
'funrat', 'rat15mm', 'vol0.7', 'dirwdr', 'phn04', 'funstp',
'dia26.59', 'phn01', 'funrat', 'rat15mm', 'vol1.0', 'dirinf',
'phn02', 'funrat', 'rat7.5mm', 'vol.5', 'dirinf', 'phn03',
'funrat', 'rat15mm', 'vol1.0', 'dirwdr', 'phn04', 'funstp']
for cmd in commands:
print cmd
ser.write(cmd + '\r')
time.sleep(1)
out = ''
while ser.inWaiting() > 0:
out += ser.read(1)
if out != '':
print '>>' + out
porte TTY:
$ ls -lt /dev/tty* | head
crw--w---- 1 nathann tty 16, 0 Oct 13 14:13 /dev/ttys000
crw-rw-rw- 1 root wheel 31, 6 Oct 13 14:12 /dev/tty.KeySerial1
crw-rw-rw- 1 root wheel 31, 8 Oct 13 13:52 /dev/tty.USA19H142P1.1
crw-rw-rw- 1 root wheel 2, 0 Oct 13 10:00 /dev/tty
crw-rw-rw- 1 root wheel 31, 4 Oct 12 11:34 /dev/tty.Bluetooth-Incoming-Port
crw-rw-rw- 1 root wheel 4, 0 Oct 12 11:34 /dev/ttyp0
crw-rw-rw- 1 root wheel 4, 1 Oct 12 11:34 /dev/ttyp1
crw-rw-rw- 1 root wheel 4, 2 Oct 12 11:34 /dev/ttyp2
crw-rw-rw- 1 root wheel 4, 3 Oct 12 11:34 /dev/ttyp3
crw-rw-rw- 1 root wheel 4, 4 Oct 12 11:34 /dev/ttyp4
io non sono nemmeno sicuro se sta inviando i comandi. Non ricevendo errori o feedback. Nulla sta accadendo sulla pompa e non è sempre restituito (out
stringa è sempre vuoto)
Questa è la mia uscita:
(sweetcrave)[email protected] sweetcrave (master) $ python pumptest.py
Serial<id=0x1093af290, open=True>(port='/dev/tty.USA19H142P1.1', baudrate=19200, bytesize=7, parity='O', stopbits=2, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
dia26.59
>>
phn01
funrat
rat15mm
vol0.7
^CTraceback (most recent call last):
File "pumptest.py", line 28, in <module>
time.sleep(1)
KeyboardInterrupt
Il mio obiettivo finale:
- impostare pompe parametri
- ci sono tre fasi specificate:
- fase 1: spingere il liquido all'estremità del tubo
- Fase 2: erogare liquido in tasso specifico e del volume
- Fase 3: tirare liquido backup
- il liquido viene tirato indietro fino (fase 3) in modo che non gocciola dal collettore, e così il soggetto non posso succhiarlo Come tale, la fase 1 è necessaria per spingere il liquido
- nel punto di deflusso.
- volume e velocità di erogazione possono essere modificati. Utilizzare la seguente formula:
- rate = volume/sec * 60
- esempio: 0,5/4 x 60 (consegnare .5 ml in un periodo di 4 sec) = 7,5
NOTA: 00buz13, buz1, buz13 non sono segnali acustici o ronzio nulla sulla pompa. Il mio adattatore lampeggia quando invio comandi. – broinjc
Questi sono altri script in python che ho scritto per creare problemi alla pompa: https://github.com/natsn/sweetcrave/tree/master/util – broinjc