<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);
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.