Pyserial再次 [英] Pyserial again

查看:93
本文介绍了Pyserial再次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


我用pyserial解决了配置问题,但我有另外一个问题。

串口每次我读取并重新打开时关闭

i新写。

在我的脚本中没有写关闭,为什么关闭?


Thaks Luca

Hello

I have solve the problem of configuration with pyserial but i have
another question.
The serial port close every time i make the read and re-open when i do
i new write.
In my script there is not write close , why it close ?

Thaks Luca

推荐答案

2006-03-06,luca72< lu **** ***@libero.it>写道:
On 2006-03-06, luca72 <lu*******@libero.it> wrote:
我已经用pyserial解决了配置问题,但我还有另外一个问题。每当我进行读取时串口关闭,当我进行新写操作时重新打开。


我对此表示怀疑。

在我的脚本中没有写关闭,为什么关闭?
I have solve the problem of configuration with pyserial but i
have another question. The serial port close every time i make
the read and re-open when i do i new write.
I doubt it.
In my script there is not write close, why it close ?




我们怎么知道什么是错的,除非你发布一个小的

示例程序来展示问题?


如果你想要一个WAG,这里是一个:串口对象转到

超出范围并收集垃圾。


请阅读:

http://www.catb。 org /~esr / faqs / smart-questions.html

-

Grant Edwards grante哇!嗯,哦!我忘了

来提交给COMPULSORY

visi.com URINALYSIS!



How on earth would we know what''s wrong unless you post a small
example program that exhibits the problem?

If you want a WAG, here''s one: the serial port object going
out-of-scope and getting garbage collected.

Please read this:

http://www.catb.org/~esr/faqs/smart-questions.html

--
Grant Edwards grante Yow! Uh-oh!! I forgot
at to submit to COMPULSORY
visi.com URINALYSIS!


luca72写道:
我已经用pyserial解决了配置问题,但我有另一个问题。
每当我进行读取并重新打开时串口关闭
我是新的写。


请描述你观察到的东西让你说港口

正在关闭。

在我的剧本中没有写得很近,为什么关闭?
I have solve the problem of configuration with pyserial but i have
another question.
The serial port close every time i make the read and re-open when i do
i new write.
Please describe what you are observing that makes you say that the port
is closing.
In my script there is not write close , why it close ?




我们再猜一次吗?


-Peter



Shall we guess again?

-Peter


你好这里是代码的一部分,设置的值来自组合

框:


这里我把智能卡的ATR插入阅读器,然后我把这个读取数据存储在textctrl中。

用串口监视器嗅探数据我看到了答案好的

但是在接听到端口关闭之后,为什么?

另一点是textctrl:它只存储第一个字节而不是

其他为什么?,这个字节就像是22并且所有都被重读


Thaks


ser = serial.Serial(porta)

ser.baudrate =(atr)

ser.parity =(胎次)

ser.stopbits =(停止)

ser.bytesize =(siz e)

ser.setRTS(等级= 0)

ser.setDTR(等级= 0)

ser.timeout =(时间)

a = ser.readline()

a = self.textCtrl3.SetValue(a +''')

self.lettura()

ser.setBaudrate(波特)

Hello here is a part of code, the values for settings comes from combo
box:

here i take the ATR of the smartcard inserted in the reader, and than i
store the read data in a textctrl.
Sniffing the data with serial port monitor i see that the answer is ok
but after the answer the port close, why?
Another point is the textctrl: it store only the first byte and not the
other why?, the byte are like 22 and all are readed

Thaks

ser = serial.Serial(porta)
ser.baudrate = (atr)
ser.parity = (parity)
ser.stopbits = (stop)
ser.bytesize = (size)
ser.setRTS(level = 0)
ser.setDTR(level = 0)
ser.timeout = (time)
a = ser.readline()
a = self.textCtrl3.SetValue(a + '' '')
self.lettura()
ser.setBaudrate(baud)


这篇关于Pyserial再次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆