Oh no not again, Butterfly input problems

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good day All,
I am having trouble with input on PORTD of my butterfly whilst using Deans LCD driver (and being careful to use only three digits and PD0..5)

as a rough example:

...
...
void main(void){
 for (;;) {
   PORTD &= ~(0x01);
   DDRD &= ~(0x01);
   LCD_puts(itoa(((PIND) & (1<<PIND0)),TempDisp,10));
}
}

The LCD always shows 0. The last lcd segments jump around as I attach 5v to the pin, as expected.

The LCD_puts is there as I am also checking other values of things along the way... tis my crude debugging.

Joe suggests that in and out should be possible on PORTD if you dont use the segments attached to the pins.

Any ideas
( I will also want to use PD4 and PD5 as output is this a problem)

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

According to the schematic at the end of the BF user guide PD0 is "LCD16". I wouldn't have thought you could use it without interference with the operation of the LCD. Joe has an article/PDF somewhere which tells you which BF I/O can be used and what side effects that might have I think.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Clawson.
According to Joe:

Quote:
So, as a rule of thumb, either use the LCD or Port D, but not both. You might write special code to use on the leftmost several LCD characters while using Port D pins for
I/O.

I thought that I had effectively only used the left three segments such that PD0..PD5 would never be written to. (i.e special code 8) )
Is this a case of if the LCD is initialised, then all lcd pins are set as output and cannot be selectively made input?
i.e

LCDCRA  = (1<<LCDEN) | (1<<LCDIE);

Does anyone have any experience using the LCD and some of PORTD for i/o?

cheers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This issue has been raised in the last 2 or 3 weeks. Use the forum search and you should get a couple of positive hits.

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did search first (of course) but didnt find anything.
I abandoned port D and used the USI and ISP instead.

If anyone does know how to use Port D AND 3 segments of the LCD it wold be good to know.

Also, is there any reason that anyone can think of, why reading the ADC on PF7 (for example) doesnt work unless I initialise the internal butterfly temperature sensor, and do an adc read? The butterfly has so many weirdnesses...
Still its an amazing little board, and the project is DONE! wohoo!

cheers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Butterfly Alternate Pin Use
http://smileymicros.com/download...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nice one Joe... What do you do for a day job? :) :) :)

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!