To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 4947
4946  |  4948
Subject: 
Re: How to get digital outputs from the handyboard?????????????
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 11 Dec 1998 18:00:23 GMT
Original-From: 
Will <willbain@cs.umtSTOPSPAM.edu>
Reply-To: 
willbain@cs.umt.edu&NoMoreSpam&
Viewed: 
1286 times
  
Michael Toh wrote:
hi everyone, i have been trying for the past few days to get digital outputs
from the board but with no success. i have been trying to get digitals
outputs from the  SPI's pins (J6). i have poke to make the port as output
port. but the problem now is how to config the 4 bits. what is the location
and the mask bit to do a bit_set/clear.

First, to enable the four SPI pins D2 through D5 as digital outputs,
make sure you do a bit_set( 0x1009, 0x3C ).  (In the sonar.c program,
for example, bit_set( 0x1009, 0x30 ) seems to only enable two of the
pins--not all four).  I think poke would work OK here, too, even though
it actually clears bits in addition to setting bits.

The middle 4 bits of byte 0x1008 map to ports D2 through D5.  To send
the pins high, do the following:
                                          Bit mask
Port           Send high                  7654 3210
---------      -----------------------    ---- ----
D2 (MISO)      bit_set( 0x1008, 0x04 )    0000 0100
D3 (MOSI)      bit_set( 0x1008, 0x08 )    0000 1000
D4 (SCK)       bit_set( 0x1008, 0x10 )    0001 0000
D5 (SS)        bit_set( 0x1008, 0x20 )    0010 0000

Of course, to send 'em low again, just do the corresponding bit_clear.
You can set or clear multiple bits in one statement; you just need to
figure out what the bit mask equates to in hexadecimal.  You could even
set *and* clear bits simultaneously by using poke (instead of bit_set or
bit_clear) with the appropriate mask.  Good luck!

-- Will
                                          , ,
        __@_/             \_@__           |/
          |                /__,           o             @_/
          )\              )              ( \            (\/\\,
~~~~~~~~~ ' ` ~~~~~~~~~~~ ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wendy Parson,                                            I can't take a
Will Bain,                                well-tanned person seriously.
& Tatoosh                                             --Cleveland Amory



Message is in Reply To:
  How to get digital outputs from the handyboard???...???
 
hi everyone, i have been trying for the past few days to get digital outputs from the board but with no success. i have been trying to get digitals outputs from the SPI's pins (J6). i have poke to make the port as output port. but the problem now is (...) (26 years ago, 10-Dec-98, to lugnet.robotics.handyboard)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR