Results 1 to 3 of 3
  1. #1
    EmuTalk Member emil_nol's Avatar
    Join Date
    Nov 2001
    Location
    Sweden
    Posts
    9

    Generate pulses in delphi

    I need to generate a 12us wide puls that should be sent out to the parallelport every 16ms in delphi 4.0. But how?
    I know how to communicate with the printerport, i just dont know how to create those high speed pulses.



    I'm experimenting with snespads, so those who knows about this please help.



    |<------------16.67ms------------>|

    12us
    -->| |<--

    --- ---
    | | | |
    Data Latch --- -----------------/ /---------- --------...


    Data Clock ---------- - - - -/ /---------------- - ...
    | | | | | | | | | | | |
    - - - - - -
    1 2 3 4 1 2

    Serial Data ---- --- ----/ / ---
    | | | | | |
    (Buttons B --- --- --- ----------
    & Select norm B SEL norm
    pressed). low low
    12us
    -->| |<--



    /Emil


    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2
    EmuTalk Member
    Join Date
    Feb 2002
    Location
    Germany, NRW
    Posts
    22
    You have a great timing problem. You could try to write a Thread in Delphi witch does nothing else than waiting for the end of the 16.6666... ms. To create a 12 us Pulse is another Story since no timer in your PC will be that precise. You could try to code a For-Loop that does nothing else than executing some NOP's. How much depends on your CPU, meaning you've got to try.
    But I'm not actualy sure if Delphi 4 supports Multithreading (I use V5). But with Threads your PC wouldn't freeze and you could shutdown the prog normaly.
    Hope it helps.
    Specs:
    PIII-900
    nvidia GeForce2 MX
    256 MB SDRAM @ 100MHz
    2 HDD's (40, 48 GB)
    Hauppauge Win/TV PCI

  3. #3
    Moderator Cyberman's Avatar
    Join Date
    Nov 2001
    Posts
    1,824

    Re: Generate pulses in delphi

    Originally posted by emil_nol
    I need to generate a 12us wide puls that should be sent out to the parallelport every 16ms in delphi 4.0. But how?
    I know how to communicate with the printerport, i just dont know how to create those high speed pulses.

    I'm experimenting with snespads, so those who knows about this please help.



    |<------------16.67ms------------>|

    12us
    -->| |<--

    --- ---
    | | | |
    Data Latch --- -----------------/ /---------- --------...


    Data Clock ---------- - - - -/ /---------------- - ...
    | | | | | | | | | | | |
    - - - - - -
    1 2 3 4 1 2

    Serial Data ---- --- ----/ / ---
    | | | | | |
    (Buttons B --- --- --- ----------
    & Select norm B SEL norm
    pressed). low low
    12us
    -->| |<--



    /Emil
    Well there are a few ways to do this.

    The simplest method is to NOT use the printer port driver. This is a bad thing to do in this case.

    The printer port is an IO port to the x86 process Printer port 1 is generally 0x378 so... what do you do?

    I think the function is port($378,<data>).

    If you want a active low pulse you should initialize the port with 0xff or 255.
    To generate the pulse you write 0xFE (D0 is turned off momentarily) and then write 0xFF again. I suggest experimenting with it tell it's close to 12us. IE write 0xFE several times in a row then 0xFF to the port. This should get you close to the right timing. You might think that with a 1GHZ processor you can execute 100's instructions while you write to that port. In reality the ports are a fixed speed so .. you'll always have a fixed delay time between writes to the IO port. So this might work well on ALL computers

    if port doesn't work.. try outp(0x378, 0xFF) etc. I can't remember Delphi's IO port command.

    An active High pulse is the oposite initialize the port to 0x00 and write 0x01 for the pulse to be on D0.

    The parallel port is VERY DELICATE. Do NOT I repeat Do NOT directly drive ANYTHING with it. BEcause you'll blow it's integrated drivers out. stuff a 74HC245 onto a bread board between. Most of the parallel ports these days can't take more then a few ma source or sink current on them. don't short them or they will be toast. That's why you need the buffer between.
    Here is the data sheet for the 74hc245
    Be sure to read it carefully

    Cyb
    Progress (n.):
    The process through which the Internet has evolved from smart people in front of dumb terminals to dumb people in front of smart terminals.
    -------------------------------------------------------------------
    Recursive (adj):
    see Recursive

Posting Permissions

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