Maybe this will help. It's a routine that reads all four directions
of the Joystick. Only set-up is writing 255 to the ports first.
;----------------<SNIP>----------------------------------------
OUT PORTB,FF
OUT PORTE,FF
;--------------------------------------------------------------;
; CRICKET: BOOT SENSORY LOOP: CHECK JOYSTICK & UART THEN SLEEP ;
;--------------------------------------------------------------;
STS TCCR1B,FIVE ;PRESCALE /1024
STS TCNT1L,ZERO ;START AT ZERO
STS TCNT1H,ZERO
BOOT_LOOP: CLR TMP
SBIS PINB,6 ;JOYSTICK UP
RJMP START_8MHZ
SBIS PINB,7 ;JOYSTICK DOWN
RJMP START_2MHZ
SBIS PINE,2 ;JOYSTICK LEFT
RJMP START_4MHZ
SBIS PINE,3 ;JOYSTICK RIGHT
RJMP START_1MHZ
LDS TMP,TCNT1L ;CHECK CLOCK
LDS TMP,TCNT1H
CPI TMP,255
BREQ GO_SLEEP
LDS TMP1,UCSR0A ;CHECK UART
SBRS TMP1,RXC
RJMP BOOT_LOOP ;NO UART THEN LOOP
;-------------------------------------------------------
--- In AVR-Chat@yahoogroups.com, "granz_consult" <granz_consult@...>
wrote:
>
> Mike,
>
> I am also having wierdness with the Butterfly's Port E. In trying
to
> use the onboard joystick, I am showing continuous action of both
left
> and right joystick (the two Port E pins). I have been sucessful in
> reading the Port B pins (up, Down and Center), but have not been
able
> to read the Port E pins at all.
>
> I've tried writing the DDRE pins, then activating the pull-up
resistor
> by writing to PortE pins and then reading from the PinE pins to
test
> for left/right action, but am always showing both being true.
>
> Have you had any answers or any sucess on your own in solving this?
>
> Thanks,
>
> Art
>
> --- In AVR-Chat@yahoogroups.com, Mike Murphree <mike@> wrote:
> >
> >
> > Ran into a weird problem this week while modifying the AVR
Butterfly
> > code for my own application.
> > On the Butterfly, the pins for Port B bits 4,6, and 7, plus Port
E bits
> > 2 and 3 are used for the joystick. I am using these pins for my
own
> > application and am only using the LCD driver code, the USART
code, and
> > the oscillator calibration code out of the original
application. The
> > weird part was that all of these pins were set to inputs and I
had
> > pullups enabled (confirmed in Studio), but both in my
application and
> > in Studio's I/O panel, these bits in Port E were being read as
zeroes.
> > I also confirmed with a DVM that these pins were at a high level.
> >
> > I got my project working by reassigning the pins in Port E to
Port B,
> > but I'm at a loss as to what was happening with the Port E
pins. I
> > checked with the original source and the board worked fine then.
> >
> > Any ideas?
> >
> > Mike
> >
>Message
Re: Weirdness on Butterfly Joystick
2006-04-13 by ufo2joe
Attachments
- No local attachments were found for this message.