Processing250kBaud: Unterschied zwischen den Versionen

Aus Hackerspace Ffm
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „== Non-standard baud rates under Linux / Processing == Several USB-to-serial converter chips are capable of using non-standard baud rates. The chips from FTDI are…“)
 
 
Zeile 2: Zeile 2:
 
Several USB-to-serial converter chips are capable of using non-standard baud rates. The chips from FTDI are just one example. However, using those baud rates especially under Linux is often cumbersome. Fortunately, most modern Linux distributions have already kernel support for those chips and baud rates. But accessing those rates from other applications especially Processing (here 1.5.1) doesn't gave the correct results. We found that the modern language Python makes things more easy - here custom baud rates worked out of the box. But this is not the end of the story: Once set a custom baud rate using a small Python script, this baud rate could also used afterwards under Processing. To work with 250kBaud under Processing, we first executed the following script once (called it set250k.py):
 
Several USB-to-serial converter chips are capable of using non-standard baud rates. The chips from FTDI are just one example. However, using those baud rates especially under Linux is often cumbersome. Fortunately, most modern Linux distributions have already kernel support for those chips and baud rates. But accessing those rates from other applications especially Processing (here 1.5.1) doesn't gave the correct results. We found that the modern language Python makes things more easy - here custom baud rates worked out of the box. But this is not the end of the story: Once set a custom baud rate using a small Python script, this baud rate could also used afterwards under Processing. To work with 250kBaud under Processing, we first executed the following script once (called it set250k.py):
  
<code>
+
<pre>
 
#!/usr/bin/python
 
#!/usr/bin/python
 
import serial
 
import serial
Zeile 13: Zeile 13:
  
 
ser.close() # close port
 
ser.close() # close port
</code>
+
</pre>
  
 
Then we could use it also under Processing using code like this:
 
Then we could use it also under Processing using code like this:
  
<code>
+
<pre>
 
import processing.serial.*;
 
import processing.serial.*;
 
Serial SerialPort;
 
Serial SerialPort;
 
SerialPort = new Serial(parent, "/dev/ttyUSB0", 250000);
 
SerialPort = new Serial(parent, "/dev/ttyUSB0", 250000);
</code>
+
</pre>

Aktuelle Version vom 14. Januar 2014, 20:04 Uhr

Non-standard baud rates under Linux / Processing

Several USB-to-serial converter chips are capable of using non-standard baud rates. The chips from FTDI are just one example. However, using those baud rates especially under Linux is often cumbersome. Fortunately, most modern Linux distributions have already kernel support for those chips and baud rates. But accessing those rates from other applications especially Processing (here 1.5.1) doesn't gave the correct results. We found that the modern language Python makes things more easy - here custom baud rates worked out of the box. But this is not the end of the story: Once set a custom baud rate using a small Python script, this baud rate could also used afterwards under Processing. To work with 250kBaud under Processing, we first executed the following script once (called it set250k.py):

#!/usr/bin/python
import serial

# grab serial port data from FTDI chip
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=250000, rtscts=True)
ser.open()
#c=ser.read(5)
#print c

ser.close() # close port

Then we could use it also under Processing using code like this:

import processing.serial.*;
Serial SerialPort;
SerialPort = new Serial(parent, "/dev/ttyUSB0", 250000);