Changeset 11 in projects


Ignore:
Timestamp:
Sep 3, 2008, 6:35:35 PM (16 years ago)
Author:
sven
Message:

The Windows backend works right now.

-- Sven @ XP Workstation

Location:
puncher
Files:
2 added
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • puncher/FACIT-MANUAL.txt

    r10 r11  
    1717  it like this:
    1818 
    19 FACIT    direction   PC              PC Reg   
    20 4070                 pin             Bit       Function Notes
    21 -----                --              -------   --------------
    22   1 Ch1  <=====       2 Data0        D0        \                 
    23   2 Ch2  <=   =       3 Data1        D1        |
    24   3 Ch3  <= D =       4 Data2        D2        | 8 Data Out registers
    25   4 Ch4  <= A =       5 Data3        D3        | registers
    26   5 Ch5  <= T =       6 Data4        D4        |
    27   6 Ch6  <= A =       7 Data5        D5        |
    28   7 Ch7  <=   =       8 Data6        D6        |
    29   8 Ch8  <=====       9 Data7        D7        /
    30   9 Ch9  -------------------------+
    31  10 SD                            |            Stepping Direction signal, leave as is
    32  11 PI   <---------   1 -Strobe   | C0-       Strobe = -Punch Instruction
    33  12 PR   --------->  11 +Busy     |  S7-       Busy signal = Still punching
    34  13                               |
    35  14 -                             |
    36  15 -                             |
    37  16 -      +----------------------+
    38  17 -      |           
    39  18 -      |
    40  19 EXT    |                                   EXT: external data switch, leave as is
    41  20 ERR1   |      +- 20 Ground                 ERR1: Error signal, not important
    42  21 TL     |      |- 21 Ground                 TL: Tape Low Signal
    43  22 +24V --+      |- 22 Ground                 +24V from internal power supply
    44  23 -             |- 23 Ground                
    45  24 +6V (5V)      |- 24 Ground                 +6V from internal power supply
    46  25 0V -----------+- 25 Ground                 Signal ground, not connected to chassis ground
    47 
    48 
     19     FACIT    signal       PC pin    PC Reg    Function Notes
     20     4070     direction    and name  Bit       (for FACIT pins)
     21     -----    ----------   --------  -------   --------------------------------
     22       1 Ch1  <---------   2 Data0   D0        \                 
     23       2 Ch2  <---------   3 Data1   D1        |
     24       3 Ch3  <---------   4 Data2   D2        | 8 Data Out
     25       4 Ch4  <---------   5 Data3   D3        | registers, to be set
     26       5 Ch5  <---------   6 Data4   D4        | from the computer
     27       6 Ch6  <---------   7 Data5   D5        |
     28       7 Ch7  <---------   8 Data6   D6        |
     29       8 Ch8  <---------   9 Data7   D7        /
     30  +--- 9 Ch9                                   Feed hole channel (logic 1 => always feed hole)
     31  |^  10 SD                                    Stepping Direction signal, leave as is
     32  ||  11 PI   <---------   1 -Strobe C0-       Strobe = -Punch Instruction
     33  |c  12 PR   --------->  11 +Busy   S7-       Busy signal = Still punching
     34  |o  13 -                                     \                             
     35  |n  14 -                                     |
     36  |n  15 -                                     | not used at FACIT site
     37  |e  16 -                                     |
     38  |c  17 -                                     |
     39  |t  18 -                                     /
     40  ||  19 EXT                                   EXT: external data switch, leave as is
     41  |V  20 ERR1          +- 20 Ground            ERR1: Error signal, not important
     42  |   21 TL            |- 21 Ground            TL: Tape Low Signal, not important
     43  +-- 22 +24V          |- 22 Ground            +24V from internal power supply (log. 1)
     44      23 -             |- 23 Ground           
     45      24 +6V (5V)      |- 24 Ground            +6V from internal power supply
     46      25 0V -----------+- 25 Ground            Signal ground, not connected to chassis ground
     47     
     48     
    4949  Now I'll go into detail with the FACIT pins. I've got a block diagram
    5050  and electronic description. Here you get the light edition with the most
    5151  important things:
    52  
    53          0                                          13 milliseconds
    54   time --+------------------------------------------------+--->
    55          .                                                .
    56   DATA   ._________________                               .
    57    ______|         min 200 usec ... ______________________.
     52   
     53                  0                                          13 milliseconds
     54   time --+------------------------------------------------+--->
     55                  .                                                .
     56   DATA   ._________________                               .
     57        ______|         min 200 usec ... ______________________.
    5858                 .                                                .
    59   PI     .______________________________                  .
    60    ______| min 100us, max 10ms          |_________________.
    61          .                                                .
    62   PR __________                                           ._____
    63                |__________________________________________|
    64  
    65   Motor shaft motion
    66                                      ________________________
    67                                  ...
    68                              ...
    69                          ...
    70   ___________________...
    71  
    72  
     59   PI     .______________________________                  .
     60        ______| min 100us, max 10ms          |_________________.
     61                  .                                                .
     62   PR __________                                           ._____
     63                  .     |__________________________________________|
     64                  .                                                .
     65   Motor shaft motion                                      .
     66                  .                           ________________________
     67                  .                       ...                      .
     68                  .                   ...                          .
     69                  .               ...                              .
     70   ___________________...                                  .
     71                  .                                                .
     72                --+------------------------------------------------+--->
     73   
    7374  As you see, we need only 1 control pin, 1 signal input pin and
    7475  8 data pins for the workflow. Unfortunately, the strobe (PI)
     
    7677  we cannot simply use commands like "cat $file > /dev/lp0" at Linux
    7778  or "copy FILE.TXT LPT0:" in DOS/WINNT, but we need an own driver.
    78  
     79   
    7980  In this subproject, we have implemented the diagram above as
    8081  program logic. To keep it more simple, we didn't develop kernel
    8182  driver, but userspace / user mode drivers, using ppdev at linux and
    8283  the third party library "WinIo" at Windows NT.
    83   
    84   
     84 
     85 
    8586  Sven Köppel,
    8687  documentated at 02. September 2008
  • puncher/Makefile.win

    r10 r11  
    44#
    55
     6all: cli setoff-strobe
     7
    68cli: frontend.cli-simple.o backend.win.o
    79        g++ -o backend.win/cli.exe $^ -Lbackend.win/ -lWinIo
    810
     11setoff-strobe: setoff-strobe.win.o backend.win.o
     12        g++ -o backend.win/setoff-strobe.exe $^ -Lbackend.win/ -lWinIo
     13
     14setoff-strobe.win.o: setoff-strobe.win.c backend.h
     15        g++ -c setoff-strobe.win.c
     16       
    917frontend.cli-simple.o: frontend.cli-simple.c backend.h
    1018        g++ -c frontend.cli-simple.c
  • puncher/backend.dummy.c

    r9 r11  
    77 **/
    88
     9#include "backend.h"
     10 
    911#include <stdio.h>
    1012#include <stdlib.h>
    11 #include <unistd.h> /* usleep! Unix! Not cross platform! */
    12 #include "backend.h"
     13#ifdef __WIN32__
     14        #define usleep(x) Sleep((x) / 1000)
     15#else
     16        #include <unistd.h>
     17#endif
    1318
    1419PuncherBackend* puncher_backend_new(int debug_flag) {
    1520    PuncherBackend *c = malloc(sizeof(PuncherBackend));
    16     printf("[dummy backend] initialisation...\n");
     21    fprintf(stderr, "[dummy backend] initialisation...\n");
    1722    return c;
    1823}
    1924
    2025int puncher_backend_write_byte(PuncherBackend* c, unsigned char byte) {
    21     printf("[dummy backend] punching 0x%x\n", byte);
     26    fprintf(stderr, "[dummy backend] punching 0x%x\n", byte);
    2227    usleep (20*1000); // 20ms
    2328    return 0;
     
    2530
    2631int puncher_backend_destroy(PuncherBackend* c) {
    27     printf("[dummy backend] finishing backend...\n");
     32    fprintf(stderr, "[dummy backend] finishing backend...\n");
    2833    return 0;
    2934}
  • puncher/backend.h

    r10 r11  
    2424int puncher_backend_destroy(PuncherBackend* c);
    2525#define PUNCHER_BACKEND_DPRINTF(bla...) { if(c->debug_flag) fprintf(stderr,bla); }
     26
     27#ifdef __WIN32__
     28// G++ *braucht* dringend vollstaendige Header
     29void puncher_backend_stop(PuncherBackend *c);
     30#endif
  • puncher/backend.win.c

    r10 r11  
    113113       
    114114        // sleep the defined time
    115         Sleep(220 / 1000);
     115        Sleep(220 / 1000); // 220us
    116116       
    117117        // only for debugging, get status values:
     
    124124                return -5;
    125125        PUNCHER_BACKEND_DPRINTF("+ strobe... ");
    126         if( !SetPortVal(PARPORT_STATUS_REGISTER, PARPORT_CONTROL_STROBE, 1) )
     126        if( !SetPortVal(PARPORT_CONTROL_REGISTER, PARPORT_CONTROL_STROBE, 1) )
    127127                return -5;
    128128
     
    130130        wait_time = 40 - (GetTickCount() - time);
    131131        PUNCHER_BACKEND_DPRINTF("\nWaiting for Puncher Ready (%i msec)...\n", wait_time);
    132         Sleep(40/1000);
    133         //if(wait_time > 0)
    134         //      Sleep(wait_time / 1000);
     132        if(wait_time > 0)
     133                Sleep(wait_time); // ms!
     134        //Sleep(1000); // debugging: 4 sec
    135135
    136136        // Check status another time.
  • puncher/frontend.cli-simple.c

    r10 r11  
    4040        puncher = puncher_backend_new(1);
    4141
    42         for(int xy=0;xy<10;xy++) {
     42        for(int xy=0;;xy++) {
    4343                unsigned char buf; /* stdin 1 byte buffer */
    4444
Note: See TracChangeset for help on using the changeset viewer.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License