Learn something new every day. Thank you.
--- In ultimaserial_group@yahoogroups.com, xchen992000
<no_reply@...> wrote:
>
> BTW, you will find a Excel sample in the file section of this
group.
> It has digital I/O control
>
> --- In ultimaserial_group@yahoogroups.com, xchen992000 <no_reply@>
> wrote:
> >
> > See http://www.ultimaserial.com/standard.html#SetDIODir:
> >
> > It is plain binary format, bit 0 for DIO0, bit 1 for DIO1....
> >
> > In case you are not familiar with binary, here is the equation:
> >
> > diodir = 0
> > If DIO7isInput Then diodir = diodir + 128
> > If DIO6isInput Then diodir = diodir + 64
> > If DIO5isInput Then diodir = diodir + 32
> > If DIO4isInput Then diodir = diodir + 16
> > If DIO3isInput Then diodir = diodir + 8
> > If DIO2isInput Then diodir = diodir + 4
> > If DIO1isInput Then diodir = diodir + 2
> > If DIO0isInput Then diodir = diodir + 1
> >
> > UltimaSerial.SetDIODir diodir
> >
> > --- In ultimaserial_group@yahoogroups.com, "throrope" <throrope@>
> > wrote:
> > >
> > > I see posts for setting the direction of all digital IO to in
or
> > > out, but I can't find a post that explains how to set one to
out and
> > > one to in. Also, can that digital output be individually set
to
> > > high?
> > >
> > > My application runs within Excel's visual basic editor.
> > >
> > > I have the following instructions:
> > >
> > > UltimaSerial.SetDIODir 0 turns all DIO to outputs
> > > UltimaSerial.SetDIODir &HFF turns all DIO to inputs
> > >
> > > UltimaSerial.DigitalOutput &HFF turns all available outputs to
high
> > > UltimaSerial.DigitalOutput 0 turns all available outputs to low
> > >
> > > For DIO 2, would the &HFF be &H2F for each of the above? Do we
set
> > > all to outputs then set the inputs individually?
> > >
> > > ie:
> > >
> > > UltimaSerial.SetDIODir 0
> > > UltimaSerial.SetDIODir &H0F
> > > UltimaSerial.SetDIODir &H1F
> > > UltimaSerial.SetDIODir &H3F
> > > UltimaSerial.DigitalOutput &HFF
> > >
> > > I'm thinking the above sets all to out; then 0,1,3 to in; then
since
> > > only 2 is left as out, setting all to high indexes only 2 to
high.
> > > Will UltimaSerial.DigitalOutput &H2F set only 2 to high? Any
> > > thoughts?
> > >
> > > Paul
> > >
> >
>