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 13:33:13 -0000
--- In  "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