ts-7000
[Top] [All Lists]

[ts-7000] Re: explanation for DIO

To:
Subject: [ts-7000] Re: explanation for DIO
From: "PeterElliot" <>
Date: Sun, 15 Mar 2009 18:28:07 -0000
Hi Manu,

Yes PBDR=0x30 would turn on both 4&5.

I made a typo on the Hex Bit list. It should be:

 Bit 0: = 0x01 HEX
 Bit 1: = 0x02 HEX
 Bit 2: = 0x04 HEX
 Bit 3: = 0x08 HEX
 Bit 4: = 0x10 HEX
 Bit 5: = 0x20 HEX 
 Bit 6: = 0x40 HEX  <- Not 0x30
 Bit 7: = 0x80 HEX  <- Not 0x40 Oops!

PJE

--- In  "ejeffredo" <> wrote:
>
> Dear Peter,
> 
> thanks for your reply, that clear.
> So if I want output 4 and 5 on, I write PBDR=0x30
> 
> Manu
> 
> 
> 
> 
> --- In  "PeterElliot" <egroups@> wrote:
> >
> > --- In  "ejeffredo" <ejeffredo@> wrote:
> > >
> > > Hi all,
> > > 
> > > I need some explanation for dio register. For example : 
> > > 
> > > PBDDR = 0xf0 means dio 0 to 3 : input and dio 4 to 7 : output
> > > PBDR = 0x01 : all dio =0 except dio 0 = 1
> > > 
> > > Thanks,
> > > 
> > > Manu
> > >
> > 
> > 
> > Hi Manu,
> > 
> > You need to be a bit more specific about your question. Looking at what you 
> > wrote (and not referencing anything else).
> > 
> > The digital I/O port (PB) above consists of two registers, the data 
> > direction register (PBDDR) which tells the port which of the eight bits are 
> > inputs (0) or outputs (1). The data is then read/written to the data 
> > register (PBDR), where reads from the register will read the inputs, and 
> > writes to the register set the state of the outputs.
> > 
> > In your above example:
> > 
> > Bit 0: = 0x01 HEX
> > Bit 1: = 0x02 HEX
> > Bit 2: = 0x04 HEX
> > Bit 3: = 0x08 HEX
> > Bit 4: = 0x10 HEX
> > Bit 5: = 0x20 HEX
> > Bit 6: = 0x30 HEX
> > Bit 7: = 0x40 HEX
> > 
> > Thus to set the data direction register for bits 4 to 7 to be outputs you 
> > add them up 0x10 + 0x20 + 0x40 + 0x80 = 0xF0.
> > 
> > The PBDR=0x01 does not match with the PBDDR setting above as the PBDR 
> > instruction is trying to write an output to a pin set as an input. More 
> > likely would be PBDR=0x10 which would set output 4 on.
> > 
> > Hope this makes things clearer.
> > 
> > PJE
> >
>




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU