attiny12 not behaving

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

Hi,

probably something completely stupid, but I seem to be unable to get an attiny12 to behave properly:

I wrote this crude test program:

.org $000
LDI R16,$1F
OUT PORTB,R16
LDI R16,$1F
OUT DDRB,R16

wait:
clr r1
com r1
mov r2, r1
loop0:
dec r1
brne loop0
dec r2
brne loop0

in r16, portb
dec r16
out portb, r16
rjmp wait

Fuse Bits: Mode 1, int. RC / 67ms, SPI & Reset enabled, BOD disabled.

The circuit is just a pull-up on Reset, and a few LEDs with series resistors on PB0-PB4...

Programming all works fine, but the LEDs all indicate High on all pins, no change...

Also tested with LEDs going to VCC or GND, and with a driver transistor in between...

Programming the chip workes fine each time.

What did I miss?

Thanks,
Richard

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

Hi,

can you check the voltage on reset?

Are the Portpins really high or *Pulledup or *highimpedance?

Klaus
********************************
Look at: www.megausb.de (German)
********************************

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

Vcc is +5V (78LS05) with a 2,2 uF cap to gnd next to the attiny12.

Since a LED is driven directly over a 0,82 kOhm series resistor (to gnd), i don't think it's pulled up, or High-Z; in another test, i tried to disable the pullup resistors.

With my old AT2343 i never had a similar expirience...

I'll check tomorrow with a 10k vs. gnd / vcc and an oszi, if i see anything on pb0...

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

I see no ".include tn12def.inc" statement. I wonder if the PORTB instructions are using the right address?

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

thats the very fist line, escaped being copied and pasted. w/o the assembler would complain about unknown symbols...

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

Hi,

You said, that "all indicate High on all pins", that mean that they are lightning.
And during programming/reset they are off. is this correct?

Klaus
********************************
Look at: www.megausb.de (German)
********************************

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

Check out the line "in r16, portb". If you are reading the value on the input pin then the line should be: "in r16, PINB". Reading Portb reads any value that has been previously written to the port b register, not the logic value on the pin itself.

This gets me in trouble often, also. That is how I noticed it in the code sample.

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

I seem to remember i had to pullup (10k) /reset on my tiny12

But i think Simonetta caught "the bug"

/Bingo

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

ok, i fixed the problem! Thanks to all for the many appreciable inputs.

Turned out that the PSU of my bread-board wss the culprit, after supplying the circuit a stable supply, it was running as expected. (Found this one with the Osci when looking at Vcc...).

Thanks,
Richard