avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-chat] STK500 LEDs


From: Marge Coahran
Subject: [avr-chat] STK500 LEDs
Date: Tue, 16 Oct 2007 17:49:53 -0500 (CDT)

I am confused by the response of the LEDs on the STK500. It appears to me that sending a logical high turns off the LED, and sending a logical low turns it on. Is this how they are meant to work? (I know that pressing the switches drives the input pin low, so I suppose this is conceivable.)

Altnatively, there must be something else I not be understanding.

I believe the code below should send logical low to all LEDs (since I have physically connected the port b header to the LEDs, I am telling the port it will be used for output, and I am sending $00 to the output port register). Yet the result from this code is that all LEDs are on.

Note that several similar experiments give the same result (LEDs show opposite pattern than I expect). If I send $ff to PORTB, all lights are off. If I send $aa to PORTB, the output pattern is '0101 0101'.

Any suggestions?

---------------------------------------------------
.include "m8515def.inc"

loop:
  LDI r17, $ff
  OUT DDRB, r17                 ; set all pins to output

  LDI r16, $00
  OUT PORTB, r16                ; output pattern should be '0000 0000'?

  RJMP loop
; END





reply via email to

[Prev in Thread] Current Thread [Next in Thread]