Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
<quote>Thinking about it, how are the two outputs (two DB9 com ports) represented on the one chip?</quote> It's an object, so it can keep the "previously selected output" in the internal state of the object. So, you do a OpenBySerial or OpenByIndex, and the calls to methods like SetBitMode operate on the port that was last opened. The docs for the perl module seem wrong with respect to SetBitMode. It wants a mask and mode. Within the source code are some constants for the mode:
# Get/Set BitMode use constant PFT_BITMODE_RESET => 0x00; use constant PFT_BITMODE_ASYNCBB => 0x01; use constant PFT_BITMODE_MPSSE => 0x02; use constant PFT_BITMODE_SYNCBB => 0x04; use constant PFT_BITMODE_MHBEM => 0x08; use constant PFT_BITMODE_FOISM => 0x10; use constant PFT_BITMODE_CBUSBB => 0x20;
The mask is telling it which pins are input and which are output. A 0 bit is an input, a 1 is an output. The lowest bit is D0 (TXD), next is D1 (RXD), and so forth. Google "FTDI2XX mask mode bitbang" and you'll find the whole mapping. So, to set all lines/outputs to output in async bitbang:
# # assuming you called OpenByIndex on this object already # $mode = $FTDIdev->SetBitMode(0xFF, 0x01);

In reply to Re^5: Problem Writing to FTDI COM Port using Win32::FTDI::FTD2XX by kschwab
in thread Problem Writing to FTDI COM Port using Win32::FTDI::FTD2XX by PrfrrdUsrNm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-25 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found