[Debian] Communicatie via /dev/ttyUSB0

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

  • Atlas
  • Registratie: Mei 2002
  • Niet online

Atlas

Ik flits niet meer terug!

Topicstarter
Mogguh :)

Ik zit met een vraag waar ik te weinig kennis voor heb om op te lossen en alle Google tips helpen ook niet. Dus ik hoopte dat jullie me een zetje in de goeie richting willen geven :)

Ik heb een eigengebouwd elektronica-printje waar ik door middel van een USB <> FT232R en een Atmega Microcontroller de temperatuur kan opvragen (dat was het makkelijke gedeelte :P ). Het OS wat ik daarvoor wilde gebruiken is een virtuele Debian installatie op een Mac OSX installatie (dit was het wat moeilijkere gedeelte :P ).

Als ik een 'cat /dev/ttyUSB0' doe en in een andere sessie 'screen /dev/ttyUSB0 19200 8n1' dan zie ik inderdaad op het 1e scherm netjes de temperatuur voorbij komen. Dus dat werkt.
Mijn grote vraag is nu, hoe krijg ik Debian nu zo ver om de temperatuur op te vragen via de seriele poort en dat weg te schrijven in een bestandje?

Ik zie door de bomen het bos niet meer dus een trap in de goeie richting zou al een hele hoop helpen :)

Join the dark side, we have cookies :)
You need only two tools. WD-40 and duct tape. If it doesn't move and it should, use WD-40. If it moves and shouldn't, use the tape.


Acties:
  • 0 Henk 'm!

  • Kees
  • Registratie: Juni 1999
  • Laatst online: 11:57

Kees

Serveradmin / BOFH / DoC
Je gebruikt de screen als setserial?
code:
1
2
3
4
5
Package: setserial
Description: controls configuration of serial ports
 Set and/or report the configuration information associated with
 a serial port. This information includes what I/O port and which IRQ
 a particular serial port is using.

Voor het uitlezen, tja, ik denk dat je dan zelf iets moet programeren, of gewoon wat dingen uit de 'apt-cache search serial' lijst moet uitproberen, bijvoorbeeld:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Package: snooper
Description: Captures communication between two external serial devices
 Snooper passes data transparently between two serial (RS232C)
 devices, capturing and logging the data and occasional comments you
 want to insert into the logs.
 .
 It is useful for debugging or analyzing the communications protocol
 between two devices that would normally be connected directly to each
 other, e.g. a digital camera and a personal computer.  By sitting
 "in the middle" (after you connect the two devices to serial ports
 on your Linux machine) snooper is able to capture data traveling in
 either direction while also passing it unmodified to the other device.
 .
 It is also possible to operate with a single serial device, using
 your console and keyboard as the second device.

[ Voor 48% gewijzigd door Kees op 13-02-2010 16:06 ]

"Een serveradmin, voluit een serveradministrator, is dan weer een slavenbeheerder oftewel een slavendrijver" - Rataplan


Acties:
  • 0 Henk 'm!

  • Wolfboy
  • Registratie: Januari 2001
  • Niet online

Wolfboy

ubi dubium ibi libertas

Wat dacht je van iets als dit:
stty -F /dev/ttyUSB0 19200 -crtscts cs8 -parenb -cstopb
cat /dev/ttyUSB0 > bestand

Blog [Stackoverflow] [LinkedIn]