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 / 8261
8260  |  8262
Subject: 
Re: Trouble working with PORTC
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Sat, 20 Jan 2001 23:25:01 GMT
Viewed: 
1132 times
  
Yes, I'm answering myself. I now notice that Port C is being used by the
LCD. Therefore, I'm guessing that this is part of the problem (the whole
problem, a really big problem?).

I'm still curious as to how Port C might be shared - is it still possible to
use it as an input port? What issues should I be concerned about for this?

What steps/considerations should I be aware of when thinking about sharing
Port C?


I'm having a little trouble working with Port C on my 68hc11.

A little background: the 68hc11 is part of a rug warrior pro. This board
brings Port C out to an expansion socket which I can access. I'm generally
using Interactive C 3.1 to work with the board.

What I'd like to do is to use a pin, let's say PC0, to drive an LED. So,
given what I've read in the 6811 Reference Manual, I should turn on bit 0 in
the DDRC register. Unfortunately, I'm having trouble doing that and I don't
quite know why.

With the board attached, here are the results of some peeks, pokes and
bit_clears:

With nothing attached to Port C:

peek(0x1003) = 3   (PORTC)
peek(0x1007) = 7   (DDRC)

Question 1: why is there any value on PORTC? Nothing is attached and the
voltages are low - is it just transient or is there a reason bits 0 and 1
are high, while bits 2 through 7 are low?

Question 2: why is there any value on DDRC? The result of 7 suggests that
bits 0, 1 and 2 are set for output. Why? My reading of the manual suggests
this should be initialized to 0 (input) on reset.

With a resistor between PC0 and ground (btw, if this is not a good thing to
do, please tell me!):

peek(0x1003) = 2
peek(0x1007) = 6

I can understand why PORTC went from 3 to 2. However, I can't understand why
this would cause the DDRC register to change value. Can anyone explain that
to me?

Lastly, I can't seem to affect the state of the DDRC register through
software. I would think that the following would change the value of DDRC:

poke(0x1007, 0)  /* turn off all DDRC bits */

yet a peek(0x1007) immediately after returns a 7 (assume no resistor to
ground on PC0).

Likewise, the following has no effect on DDRC:

bit_clear(0x1007, 0b00000001); /* turn off bit 0 */

I feel like I'm missing something basic. Does anyone have any suggestions on
what I'm doing wrong? Also, if it isn't too much trouble, suggestions on the
steps necessary to drive an LED from PC0 would be great.

Thanks again!





Message is in Reply To:
  Trouble working with PORTC
 
I'm having a little trouble working with Port C on my 68hc11. A little background: the 68hc11 is part of a rug warrior pro. This board brings Port C out to an expansion socket which I can access. I'm generally using Interactive C 3.1 to work with (...) (24 years ago, 20-Jan-01, 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