EPP mode parallel port comms


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869

    Default EPP mode parallel port comms

    Anyone ever do any handshaking and comm stuff with an EPP mode parallel port? I am working up a card to talk to EMC2 in comm mode rather then bit-banging the port and looking for any other efforts in this area.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: EPP mode parallel port comms

    I did, the easy way is to use inpout32.dll lib with VB/C# or whatever else floats your boat

    http://www.codeproject.com/KB/cs/csppleds.aspx

    http://www.lvr.com/parport.htm (they also have a new wrapper for Win7 64 bits)

    http://logix4u.net/Legacy_Ports/Para...000/NT/XP.html

    http://logix4u.net/Legacy_Ports/Para...XP_64_bit.html

    should be enough
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: EPP mode parallel port comms

    cncmachineguy,
    Are you looking for ideas/pointers for the PC-side of things, PIC-side of things or both?

    Have you looked at Jon Elsons PPMC system? It uses the port in EPP-mode (I think), I don't know if he supplies the source code for the "EMC-driver" but it might be worth looking into.


    Steve
    , EMC2 runs on Linux with a real-time kernal applied (not easy to know if you're not into the "CNC-thing") so anything Windows specific probably won't work in this case.

    Also, in EPP mode the handshaking and transfers are done by the hardware itself, I'm not sure but I don't think INPOUT32 allows that type of control, I think it's more a brute force type of direct interface to the port register - but I might be wrong on that point.

    /Henrik.

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EPP mode parallel port comms

    Hi steve, thanks for the info, but Henrik is correct.

    Henrik, I haven't looked at that (maybe) but will do so. I never thought about getting tips for the Emc driver from here. Of course any help is always good. But I was actually fishing for info about the pic side. Doesn't look to be too hard, there are just a few handshakes and rules but I figured I will check with the vast knowledge here before jumping in to write it.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  5. #5
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EPP mode parallel port comms

    Ok, I went and looked at Jon's stuff. I have in fact looked at it before. It seems he has lots of EMC side stuff available there.

    For the PIC side I wanted to use the PSP hardware, but I don't think I can. PSP has 3 handshake lines, /CS /RD /WR. As I understand it, EPP port has 4, /WR /DataStrobe /AddressStrobe and Wait.
    /WR /DS /AS are inputs to the pic and Wait is output from the PIC. And of course the 8 data lines. /DS and /AS start a transmission as long as wait is low. So it seems to me it would make sense to have /DS & /AS as IOC then do the comm in an ISR. Now I am pretty sure at this point the uP won't be doing anything else while waiting for the PC to start a transfer, at which time data coming in can be sent directly to which ever port it needs to go to and data going out will just be ports reads and send.

    I guess this is going to start out as a large I/O card with no smarts to speak of. So maybe just pool the /DS and /AS.

    Hmmm... thoughts anyone?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  6. #6
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EPP mode parallel port comms

    I have the comm part pretty well worked out between both PC and PIC. But now I have 2 more questions. First is really a yes or no kind of thing, Anyone know of a bootloader to be used with a parallel port? Even better if linux based.

    Now to the harder, but much more conceptual question. I want to make my I/O card somewhat user configurable. At first I am just thinking about the user declaring pins as inputs or outputs. that leads me to the hardware side of how to have it be either. ie, I don't think I want a pull up on an output. Now on the software side I think that is not too hard, basically the user will be setting the TRIS using a GUI. then the correct variables get assigned and volia!

    But now lets say they want to have a PWM output on 1 or 2 or eveb 4 of the pins. Any ideas how to code for that? I am not looking for actual code here, I am just stuck as to how to approach this.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: EPP mode parallel port comms

    Maybe have the PC write to an EEPROM. Then at Pic boot time the EEPROM is read for a set of pre difined parameters ....
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EPP mode parallel port comms

    Thanks Dave, but thats where my brain gets foggy. For instance I can see how I would put a timer value in the EEPROM, then read it at boot time. But what if the user doesn't want to use the timer at all? Do I have an IF NoTimer then skip the timer section? And then would this get checked every time through the loop? that seems like the wrong way to implement it. But I can't think how to do it.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: EPP mode parallel port comms

    I think this is something like you want. It is quick and dirty with ON INT
    Code:
    '  18F6680  24FC1025
    '<FL_PIC18F6680>'
        DEFINE OSC 20
        @ __CONFIG    _CONFIG1H, _OSC_HS_1H
        @ __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
        @ __CONFIG    _CONFIG4L, _LVP_OFF_4L
        DEFINE LCD_DREG     PORTG
        DEFINE LCD_DBIT     0
        DEFINE LCD_RSREG    PORTE
        DEFINE LCD_RSBIT    0
        DEFINE LCD_EREG     PORTE
        DEFINE LCD_EBIT     1
        DEFINE LCD_BITS     4
        DEFINE LCD_LINES    4
        DEFINE LCD_COMMANDUS    3000
        DEFINE LCD_DATAUS   150
        PAUSE 1000
        DPIN    VAR PORTB.2    'I2C DATA PIN
        CPIN    VAR PORTB.1    'I2C CLOCK PIN
        ADDR    VAR WORD
        DATI    VAR BYTE[45]
        DATO    VAR WORD
    
        BOOT:
        LCDOUT $FE,1,"BOOTING"
        ADDR = 1
        'FOR TESTING DO A WRITE/READ TO THE EEPROM
        'CHANGE THE VALUE IN I2CWRITE TO TURN THE
        'TIMER ON OR OFF... THE SAME CAN BE DONE
        'FOR T0CON FOR DIFFERENT PWM
        I2CWRITE DPIN,CPIN,$A0,ADDR,[1]
        PAUSE 100
        I2CREAD DPIN,CPIN,$A0,ADDR,[INT_VAR]
        PAUSE 100
        INT_VAR VAR BYTE
        INTCON.5 = INT_VAR    'ENABLE/DISABLE TMR0
        T0CON = %10000000
        ON INTERRUPT GOTO TLOOP
    
        MAIN:
        LCDOUT $FE,1,"RUNNING"
        PAUSE 100
        GOTO MAIN
    
        DISABLE
        TLOOP:
        INTCON.2=0:TOGGLE PORTG.4
        RESUME: ENABLE
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EPP mode parallel port comms

    Thanks Dave, starting to have the fog clear a little now.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts