OpenCores
URL https://opencores.org/ocsvn/usb_dongle_fpga/usb_dongle_fpga/trunk

Subversion Repositories usb_dongle_fpga

[/] [usb_dongle_fpga/] [tags/] [version_1_4/] [sw/] [Uspp/] [uspp_es.htm] - Blame information for rev 53

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 nuubik
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>ibarona - USPP(Universal Serial Port Python Library)</title>
3
 
4
 
5
 
6
 
7
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
8
 
9
  <style type="text/css">
10
  #g_title p, #g_footer p, #g_description p {
11
    margin: 0;
12
  }
13
  /*
14
 
15
        -- -- -- -- -- -- --
16
        Browser Fixes
17
        -- -- -- -- -- -- --
18
 
19
        This file uses CSS filtering methods to fix various
20
        layout bugs.
21
 
22
        Each of the following three imported files is a
23
        separate, browser-specific CSS file that keeps all
24
        hacks out of the main style sheet.
25
 
26
        Over time, as supporting these browsers no longer
27
        remains a priority, cleaning up the hacks is as
28
        easy as deleting the @import statement below, or
29
        simply no longer linking this file from the HTML.
30
 
31
  */
32
 
33
  /*
34
    fix ie6 "peekaboo bug" using the "holly hack".
35
    Note, this style only gets applied to ie6
36
  */
37
  * html .wrapper {
38
    height: 0.1%;
39
  }
40
 
41
  /*
42
   * IE5 mac - overrides the IE/Win hack
43
   */
44
 
45
  /*\*//*/
46
 
47
  * html #threecolumn div {
48
        height: auto;
49
  }
50
 
51
  /**/
52
 
53
 
54
  /*
55
   * IE5/Win-specific CSS -ensures #container wraps all content on window resize
56
   */
57
 
58
  @media tty {
59
   i{content:"\";/*" "*/}} * html #container { height: 1%; } /*";}
60
  }/* */
61
  /* Styling for editable elements. Eventually, this will be part of the style. */
62
  .editable {
63
    border: 1px dashed blue;
64
  }
65
 
66
  #footer {
67
    clear: both;
68
  }
69
 
70
  /* Extra divs hidden by default. The custom CSS can override this though */
71
  #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {
72
    display: none;
73
  }
74
 
75
  /*
76
    -- -- -- -- -- -- --
77
    1 Column Layout
78
    -- -- -- -- -- -- --
79
  */
80
 
81
  /* Center #container, constrain to 718px width
82
  ----------------------------------------------- */
83
  body {
84
    text-align: center;
85
  }
86
  #container {
87
    width: 718px;
88
    text-align: left;
89
    margin: 0 auto;
90
  }
91
 
92
  #main-content {
93
    overflow: hidden;
94
  }
95
 
96
  /** BEGIN CUSTOM SKIN **/
97
  /*
98
 
99
        -- -- -- -- -- -- --
100
        Base CSS
101
        -- -- -- -- -- -- --
102
 
103
        This file simply removes default styling on most HTML elements in
104
        order to reduce the need to later override them.
105
 
106
  */
107
 
108
  h1,h2,h3,h4,h5,h6,pre,code,p {font-size: 1em;}
109
  dl,li,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input {margin: 0; padding: 0;}
110
  a img,:link img,:visited img {border: none;}
111
  address {font-style: normal;}/*
112
 
113
        -- -- -- -- -- -- --
114
        Type Scheme: Deco
115
        -- -- -- -- -- -- --
116
 
117
  */
118
 
119
  body {
120
        font: 76% Verdana, sans-serif;
121
  }
122
 
123
  h1, h2, h3, h4, h5, h6, p.description {
124
        font-family: "Trebuchet MS", Trebuchet, sans-serif;
125
  }
126
  h1 {
127
        font-size: 3em;
128
        font-weight: bold;
129
        letter-spacing: 2px;
130
  }
131
  h2 {
132
        font-size: 2em;
133
        font-weight: normal;
134
  }
135
  h3 {
136
        font-size: 1.5em;
137
  }
138
  h4 {
139
        font-size: 1.2em;
140
        letter-spacing: 0.2em;
141
  }
142
  h5 {
143
        font-size: 1.2em;
144
  }
145
  h6 {
146
        font-size: 1em;
147
        font-weight: bold;
148
  }
149
 
150
  p, td {
151
        line-height: 1.8em;
152
  }
153
  code, kbd {
154
        font-size: 1.25em;
155
  }/*
156
 
157
        -- -- -- -- -- -- --
158
        STYLE: Micro
159
        -- -- -- -- -- -- --
160
 
161
  */
162
 
163
 
164
 
165
 
166
  /* ie6win */
167
 
168
  /* IE/Win fixes for various layouts
169
  ----------------------------------------------- */
170
  * html #onecolumn #header {
171
        margin-right: -3px;
172
  }
173
  * html #onecolumn #header,
174
  * html #twocolumn-left #header, * html #twocolumn-right #header,
175
  * html #twocolumn-liquid-left #header, * html #twocolumn-liquid-right #header {
176
        padding-bottom: 1px;
177
  }
178
  * html #twocolumn-left #main-content, * html #twocolumn-right #main-content {
179
        width: 459px;
180
  }
181
  * html #threecolumn #main-content {
182
        width: 409px;
183
  }
184
 
185
  /* ie5mac */
186
 
187
  /*\*//*/
188
  /* Undoing IE/Win fixes
189
  ----------------------------------------------- */
190
  * html #onecolumn #header {
191
        margin-right: 0;
192
  }
193
  * html #twocolumn-left #header, * html #twocolumn-right #header,
194
  * html #twocolumn-liquid-left #header, * html #twocolumn-liquid-right #header {
195
        padding-bottom: 0;
196
  }
197
  * html #twocolumn-left #main-content, * html #twocolumn-right #main-content {
198
        width: 479px;
199
  }
200
  * html #threecolumn #main-content {
201
        width: 429px;
202
  }
203
  /**/
204
 
205
  @media tty {
206
   i{content:"\";/*" "*/}} td { font-size: 0.8em; } /*";}
207
  }/* */
208
 
209
 
210
 
211
  /* Basic HTML style
212
  ----------------------------------------------- */
213
  body {
214
        font: 76% "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
215
        color: #000;
216
        background: #fff;
217
        margin: 0;
218
        padding: 0;
219
  }
220
  blockquote {
221
        margin: 1em 2em;
222
        font-style: italic;
223
  }
224
  caption {
225
        font-weight: bold;
226
        color: #444;
227
        background: #ccc;
228
        border-bottom: 0;
229
        padding: 0.3em 1em;
230
  }
231
  dd {
232
        margin: 1em 2em;
233
  }
234
  dl {
235
        margin: 2em 0;
236
  }
237
  dt {
238
        font-weight: bold;
239
  }
240
  hr {
241
        margin: 2em 0;
242
        color: #C7C7C7;
243
        background: #C7C7C7;
244
        border-color: #C7C7C7;
245
        border-style: none;
246
        height: 1px;
247
  }
248
  li {
249
        margin: 1em 0;
250
  }
251
  table {
252
        border: solid 1px #ccc;
253
  }
254
  td {
255
        vertical-align: top;
256
        padding: 0.5em;
257
  }
258
  th {
259
        text-align: left;
260
        color: #fff;
261
        background: #777;
262
        padding: 0.5em;
263
  }
264
  ol, ul {
265
        margin: 2em 0;
266
        padding-left: 1em;
267
  }
268
 
269
 
270
 
271
  /* Nested HTML elements, and basic classes
272
  ----------------------------------------------- */
273
  ol li {
274
        list-style-type: decimal;
275
        margin-left: 2em;
276
  }
277
  ul li {
278
        margin-left: 2em;
279
        list-style-type: square;
280
  }
281
  td p {
282
        margin-top: 0;
283
  }
284
 
285
 
286
 
287
  /* Set the stage with main layout tweaks
288
  ----------------------------------------------- */
289
  #container {
290
        border: solid 7px #999;
291
        border-left: 0;
292
        border-right: 0;
293
        padding-top: 1px;
294
  }
295
  #header {
296
        color: #04172D;
297
        border-top: solid 3px #777;
298
        padding: 0;
299
        margin: 0 0 1.5em 0;
300
  }
301
  #main-content .wrapper {
302
        margin: 0;
303
  }
304
  .description {
305
        font: normal 1em "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
306
        color: #444;
307
        background: #C7C7C7;
308
        padding: 3px 25px 2.2em 25px;
309
        margin: 0;
310
        line-height: 1;
311
  }
312
  #footer {
313
        clear: both;
314
        color: #999;
315
        padding: 0 1em 1em 1em;
316
        border-bottom: solid 3px #777;
317
        margin-bottom: 1px;
318
  }
319
 
320
 
321
  /* Content area offset
322
  ----------------------------------------------- */
323
  #main-content .wrapper {
324
        padding: 0 25px;
325
  }
326
 
327
  #main-content td p {
328
        margin: 0 0 1em 0;
329
  }
330
 
331
 
332
 
333
  /* Custom font definitions
334
  ----------------------------------------------- */
335
  p {
336
        margin: 1em 0;
337
        line-height: 1.5;
338
  }
339
  h1,h2,h3,h4,h5,h6 {
340
        font-family: "Trebuchet MS", arial, sans-serif;
341
  }
342
  h1 {
343
        color: #B2B2B2;
344
        font-size: 2.4em;
345
        letter-spacing: 0.2em;
346
        font-weight: normal;
347
        padding: 1em 25px 0 25px;
348
  }
349
  h2 {
350
        margin: 0 0 0.5em 0;
351
        color: #777;
352
        font-size: 1.4em;
353
        font-weight: normal;
354
        border-bottom: double 3px #C7C7C7;
355
        padding: 0 0 0.4em 0;
356
  }
357
  h3 {
358
        font-size: 1.2em;
359
        background: #eee;
360
        border: dotted 1px #C7C7C7;
361
        padding: 0.2em;
362
  }
363
  h4 {
364
        font-size: 1.2em;
365
        padding: 0 0 0.2em 0;
366
        margin: 0.6em 0 0 0.4em;
367
        color: #777;
368
  }
369
  h5 {
370
        border-bottom: dotted 1px #C7C7C7;
371
  }
372
  h6 {
373
        color: #777;
374
        border-left: solid 1.2em #777;
375
        padding-left: 0.6em;
376
  }
377
 
378
  a:link {
379
        color: #9db2df;
380
  }
381
  a:hover {
382
        text-decoration: none;
383
        border-bottom: 1px dotted #bb242d;
384
        background-color: #e0e0e0;
385
   }
386
 
387
 
388
  /* Sidebar
389
  ----------------------------------------------- */
390
  #sidebar h3, #sidebar-alternate h3 {
391
        margin: 0;
392
        color: #777;
393
        background: none;
394
        font-size: 1.4em;
395
        font-weight: normal;
396
        border: none;
397
        padding: 0;
398
  }
399
 
400
  #sidebar blockquote, #sidebar blockquote p,
401
  #sidebar-alternate blockquote, #sidebar-alternate blockquote p {
402
        margin-left: 0;
403
        margin-right: 0;
404
  }
405
  #sidebar blockquote {
406
        margin: 1em 0;
407
        padding: 0;
408
  }
409
  #adsense {
410
        text-align: center;
411
  }
412
 
413
 
414
 
415
  .editable {
416
        border: dashed 1px #c33;
417
  }
418
 
419
 
420
 
421
 
422
  /* Tweaks for Two-column Right layout
423
  ----------------------------------------------- */
424
  #twocolumn-right #sidebar .wrapper {
425
        margin: 0 10px;
426
  }
427
 
428
 
429
 
430
  /* Tweaks for Two-column Left layout
431
  ----------------------------------------------- */
432
  #twocolumn-left #sidebar .wrapper {
433
        margin: 0 10px;
434
  }
435
 
436
 
437
  /* Tweaks for Three-column layout
438
  ----------------------------------------------- */
439
  #threecolumn #sidebar .wrapper {
440
        margin: 0 10px;
441
  }
442
  #threecolumn #sidebar-alternate .wrapper {
443
        margin: 0 10px;
444
  }
445
  /*
446
 
447
        -- -- -- -- -- -- --
448
        COLOR SCHEME: Blueprint
449
        -- -- -- -- -- -- --
450
 
451
  */
452
 
453
 
454
  /* Basic HTML style
455
  ----------------------------------------------- */
456
  a:link {
457
        color: #445AA9;
458
  }
459
  a:visited {
460
        color: #283D88;
461
  }
462
  body {
463
        color: #283769;
464
        background: #ECEEF6;
465
  }
466
  caption {
467
        color: inherit;
468
        background: #ECEEF6;
469
  }
470
  hr {
471
        color: #C7C7C7;
472
        background: #C7C7C7;
473
        border-color: #C7C7C7;
474
  }
475
  table {
476
        background: #fff;
477
        border-color: #B3BCDC;
478
  }
479
  th {
480
        color: #fff;
481
        background: #445AA9;
482
  }
483
 
484
 
485
 
486
  /* Set the stage with main layout tweaks
487
  ----------------------------------------------- */
488
  #container {
489
        background-color: #F6F7FB;
490
        border-color: #6678B8;
491
  }
492
  #header {
493
        color: #445AA9;
494
        border-top-color: #6678B8;
495
  }
496
  .description {
497
        color: #445AA9;
498
        background: #C9D0E6;
499
  }
500
  #footer {
501
        color: #5064AE;
502
        border-bottom-color: #6678B8;
503
  }
504
 
505
 
506
 
507
  /* Custom font definitions
508
  ----------------------------------------------- */
509
  h1 {
510
        color: #445AA9;
511
  }
512
  h2 {
513
        color: #5064AE;
514
        border-bottom-color: #B3BCDC;
515
  }
516
  h3 {
517
        background: #ECEEF6;
518
        border-color: #C9D0E6;
519
  }
520
  h4 {
521
        border-bottom-color: #B3BCDC;
522
        color: #1A4292;
523
  }
524
  h5 {
525
        border-bottom-color: #C7C7C7;
526
  }
527
  h6 {
528
        color: #5064AE;
529
        border-left-color: #B3BCDC;
530
  }
531
 
532
 
533
 
534
 
535
 
536
  /* Sidebar
537
  ----------------------------------------------- */
538
  #sidebar h3, #sidebar-alternate h3 {
539
        color: #5064AE;
540
        background: none;
541
  }
542
  /** END CUSTOM SKIN **/
543
  </style><!-- Hack to avoid flash of unstyled content in IE -->
544
 
545
 
546
  <script> </script></head><body id="onecolumn">
547
  <div id="container">
548
    <div class="wrapper">
549
      <div id="header">
550
        <div class="wrapper">
551
          <h1 id="page-title"><div id="g_title">USPP(Universal Serial Port Python Library)</div></h1>
552
          <div style="clear: both;"></div>
553
          <p class="description"></p><div id="g_description"><p>Isaac Barona (ibarona@gmail.com)  <br></p></div>
554
          <div style="clear: both;"></div>
555
        </div>
556
      </div>
557
 
558
      <div id="main-content">
559
        <div class="wrapper">
560
          <div class="content-item"><div id="g_body"><h2>Introduccion</h2><p>La
561
librería USPP es un módulo desarrollado en Python para el acceso
562
multiplataforma al puerto serie. En el momento, sólo funciona en Linux,
563
Windows y MacOS, pero como está escrita completamente en Python&nbsp;
564
(no es únicamente un recubrimiento en Python de una librería
565
desarrollada&nbsp; en C/C++) espero que pueda ser ampliada para que
566
soporte otras plataformas.<i><br><br></i></p><h2>Motivacion</h2><p>&nbsp;A
567
mí me gusta mucho hacer pequeños cacharros electrónicos con
568
microcontroladores, especialmente aquellos que pueden ser conectados a
569
un ordenador para enviar y recibir datos. Hace un par de meses descubrí
570
Python y realmente me encantó. Empezé a jugar con él y ví que podía
571
utilizarlo para hacer prototipos de protocolos de comunicación entre el
572
ordenador y los microcontroladores&nbsp; de manera mucho más fácil y
573
rápida que utilizando C (que era el lenguaje que solía utilizar). Al
574
mismo tiempo, estaba interesado en poder utilizar los desarrollos bajo
575
diferentes arquitecturas. Empezé a buscar en la red módulos de Python
576
que accedieran al puerto serie<br>y encontré los siguientes:<br><br>&nbsp;&nbsp; &nbsp;* win32comport_demo que viene junto a la extensión win32.<br>&nbsp;&nbsp; &nbsp;* Módulo win32comm de wheineman@uconect.net.<br>&nbsp;&nbsp; &nbsp;* Sio Module de Roger Rurnham (rburnham@cri-inc.com)<br>&nbsp;&nbsp; &nbsp;* pyxal (Python X10 Abstraction Layer) de Les Smithson <br>&nbsp;&nbsp; &nbsp;&nbsp; (lsmithson@open-networks.co.uk)<br><br>pero
577
no eran multiplataforma, eran únicamente un recubrimiento de una
578
librería propietaria o eran simples ejemplos de acceso al puerto serie
579
bajo una&nbsp; determinada plataforma.<br>Por estas razones, y también
580
por supuesto, por aprender más Python, decidí empezar este proyecto.
581
Por supuesto, he utilizado los módulos indicados anteriormente como
582
referencia para realizar mi librería y por tanto, me creo en la
583
obligación de felicitar a sus autores por su excelente trabajo y por
584
haberlo compartido con los demás.<br><br>Espero que disfrutes utilizándo el módulo uspp tanto como yo lo&nbsp; he hecho haciéndolo.</p><h2>Características&nbsp;</h2><p>Este módulo tiene las siguientes características destacadas:<br>&nbsp;</p><ul><li>&nbsp;acceso de alto nivel al puerto serie bajo diversas plataformas.</li><li>autodetecta la plataforma en la que se está ejecutando y carga las clases adecuadas para esa plataforma.</li><li>Orientado a objetos.</li><li>Las operaciones sobre el puerto serie tienen la misma semántica que las operaciones sobre objetos de tipo fichero.</li><li>&nbsp;permite utilizar el puerto serie con diferentes velocidades y características.</li><li>permite
585
la utilización del puerto bajo dos modos de funcionamiento: RS-232 y
586
RS-485 (de momento, sólo RS-232). En modo 485 la comunicación es
587
half-duplex y se utiliza la línea RTS para controlar la dirección de la
588
transferencia.</li><li>lecturas en modo bloqueante, no bloqueante o con timeout.</li></ul><h2>Prerequisitos</h2><p>Se necesita los siguiente para utilizar la librería:</p><ul><li>Python 2.1 o superior</li><li>En windows los módulos win32</li></ul><h2>Utilización y documentación<br></h2><p>Únicamente
589
tienes que importar en tu programa el módulo uspp y automáticamente él
590
se encarga de cargar las clases adecuadas para la plataforma en la que
591
se está ejecutando el programa.<br><br>Lo primero de todo, tendrás que
592
crear un objeto de tipo SerialPort con las características que desees.
593
Si no se genera ninguna excepción del tipo SerialPortException, puedes
594
utilizar los métodos de lectura y escritura<br>del objeto para leer y escribir en el puerto serie.<br><br>Ejemplo:</p><pre><tt><tt>&gt;&gt;&gt; from uspp import *<br>&gt;&gt;&gt; tty=SerialPort("COM2", 1000, 9600)  <br>&gt;&gt;&gt; # Opens COM2 at 9600 bps and with a read timeout of 1 second.<br>&gt;&gt;&gt; tty.write("a")  # Writes a character to the COM2 port<br>&gt;&gt;&gt; # Now suppose we receive the string "abc"<br>&gt;&gt;&gt; tty.inWaiting()<br>3<br>&gt;&gt;&gt; tty.read()<br>'a'<br>&gt;&gt;&gt; tty.inWaiting()<br>2<br>&gt;&gt;&gt; tty.read(2)<br>'bc'</tt></tt></pre><pre><tt><tt>&nbsp;</tt></tt></pre><pre><br></pre><p><font face="arial,sans-serif" size="2">La
595
documentación de las diferentes clases y métodos que componen el módulo
596
puede encontrarse en el string de documentación del módulo uspp.</font></p><h2>Donde funciona<br></h2><p>La
597
librería ha sido probada en una máquina con Windows 95, Windows XP y
598
Windows 2000 con Python 2.1+ y en un Linux (con el kernel 2.0.34) con
599
Python 2.1+.</p><h2>Portado a otras plataformas<br></h2><p></p><p>&nbsp;Si quieres portar la librería a otras plataformas sólo tienes que seguir los siguientes pasos:</p><ul><li>Crear
600
un nuevo fichero en python llamado SerialPort_XXX.py en el que
601
implementes las mismas clases y métodos públicos que aparecen en los
602
módulos SerialPort_win y SerialPort_linux.</li><li>Añadir la nueva plataforma en el fichero uspp.py.<br></li></ul><h2>&nbsp;Licencia&nbsp;</h2><p>Este
603
código se libera bajo la licencia "LGPL" que puedes encontrar en&nbsp;
604
http://www.gnu.org/copyleft/lesser.html o en el fichero lesser.txt que
605
acompaña a la librería. Si utilizas este software estaría muy
606
agradecido de saberlo.&nbsp;</p><h2>Autor</h2><p>Esta librería ha sido creada por Isaac Barona Martínez &lt;ibarona@gmail.com&gt;.</p><h2>Versiones</h2><h3>Versión 1.0 - 24/02/2006&nbsp;</h3><p>Mucho
607
tiempo después de la versión 0.1 he tenido el tiempo suficiente de
608
liberar la versión definitiva de la librería. Esta versión corrige los
609
errores encontrados en la versión anterior, funciona en MacOS y ha sido
610
ampliada.</p><p>La libería contiene más funciones en las versiones para Linux y MacOS que para Windows.&nbsp;</p><p>Tengo que agradecer a muchas personas su contribución a esta librería, especialmente a:</p><ul><li>Damien Geranton &lt;dgeranton at voila.fr&gt;&nbsp;</li><li>Douglas Jones &lt;dfj23 at drexel.edu&gt;</li><li>J.Grauheding &lt;juergen.grauheding at a-city.de&gt;</li></ul><p>Puedes descargar los ficheros desde aqui:</p><ul><li>Zip file:  uspp-0_1.zip</li><li>tar.gz file:  uspp-0_1.tar.gz</li></ul><h3>&nbsp;Version 0.1 - 01/09/2001 (Septiembre 2001)</h3><p>&nbsp;</p><p>&nbsp;</p></div></div>
611
          <div style="clear: both;"></div>
612
        </div>
613
      </div>
614
 
615
      <div id="footer"><div class="wrapper">
616
        <hr>
617
        <p></p><div id="g_footer">&nbsp;</div>
618
        <div style="clear: both;"></div>
619
      </div></div>
620
 
621
    </div>
622
  </div>
623
 
624
 
625
<div id="extraDiv1"><span></span></div><div id="extraDiv2"><span></span></div>
626
<div id="extraDiv3"><span></span></div><div id="extraDiv4"><span></span></div>
627
<div id="extraDiv5"><span></span></div><div id="extraDiv6"><span></span></div>
628
 
629
</body></html>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.