[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Serial port programmering



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey

Jeg har begivet mig ud på ukendt territorie, da vi har fået noget nyt
hardware på arbejdet. Et møntindkast fra Money Controls.
Den har jeg fået æren af at kode op imod, men jeg kan ikke rigtigt få
hul igennem.

Jeg har læst hvad jeg kan finde om programmering af serial porten men
synes ikke, at jeg kan finde alle de defines, jeg skal bruge.

I dokumentationen står der, at jeg skal konfigurere porten til følgende:

9600 baud, 1 start bit, 8 data bits, ingen paritets bit, 1 stop bit.

Jeg åbner først en af /dev/ttyS* filerne således:
        fd = open(argv[1], O_RDWR | O_NOCTTY);

Jeg bruger så tcsetattr(3) med følgende:
struct termios tios;
tios.c_cflag = B9600 | CS8 | CREAD | CLOCAL;

Det burde sætte hastighed og de 8 databits, men hvad med resten ?
Og er der mere, man bør sætte ?

Jeg skriver derefter en kommando, som jeg burde få et svar på, med
write(2), og den returnerer ikke negativt.
Men read(2) står så og hænger, så ét eller andet gik galt.

Kan nogen få mig på rette kurs ?

Venlig hilsen og godt nytår
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0cnRoACgkQzDMeisFqGZadhgCcC49zM5xoDrc8wgzbjAQ7EWGA
RZAAnR7C0DI8RY7SANRTeJG4X1276PkA
=x/Ex
-----END PGP SIGNATURE-----



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2011-01-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *