Atmel AVR Microcontroller discussion group.
[AVR club] ATtiny 2313 floating output? - bazzapromenade - Jul 27 8:26:56 2009
I have come across something that I do not quite understand. I am running a simple code
that uses 4 pins as inputs and the rest are outputs. I write in assembler code. The
program runs fine in simulation but i found a glitch when used in real life. In my code
there was a couple of dozen places where there would be most of portB on as output high
and maybe a single pin high on port A or D. To cut corners with the lone pins I used an
SBI PORTAx on the single pin. On the larger output port d I used the usual ldi to a temp
then an out to the port. Now here's the weird bit.. Any time I used sbi, the pin turned on
but only to about 3.5 volts. Using the normal ldi they would turn on to 5v. I went through
my whole program and tested the outputs and it was the same outcome every single time an
sbi was used. Changed the code to the usual LDI TEMP, 0Xxx OUT PORTA, TEMP and all
was well. I can not find any data on what causes this and do not understand how the chip
would know any difference. Once the code is converted to hex the chip would not know the
difference. Has anyone come across this and can shed some light on it.
Many thanks Bazza.
------------------------------------

(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )
Re: [AVR club] ATtiny 2313 floating output? - Elbest Engenharia - Jul 27 23:14:20 2009
Bazza
The "Data Port Direction" (DDRx) is?
Edson
----- Original Message -----
From: bazzapromenade
To: a...@yahoogroups.com
Sent: Monday, July 27, 2009 12:03 AM
Subject: [AVR club] ATtiny 2313 floating output?
I have come across something that I do not quite understand. I am running a simple
code that uses 4 pins as inputs and the rest are outputs. I write in assembler code. The
program runs fine in simulation but i found a glitch when used in real life. In my code
there was a couple of dozen places where there would be most of portB on as output high
and maybe a single pin high on port A or D. To cut corners with the lone pins I used an
SBI PORTAx on the single pin. On the larger output port d I used the usual ldi to a temp
then an out to the port. Now here's the weird bit.. Any time I used sbi, the pin turned on
but only to about 3.5 volts. Using the normal ldi they would turn on to 5v. I went through
my whole program and tested the outputs and it was the same outcome every single time an
sbi was used. Changed the code to the usual LDI TEMP, 0Xxx OUT PORTA, TEMP and all was
well. I can not find any data on what causes this and do not understand how the chip would
know any difference. Once the code is converted to hex the chip would not know the
difference. Has anyone come across this and can shed some light on it.
Many thanks Bazza.
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )
[AVR club] Re: ATtiny 2313 floating output? - "s.h...@btinternet.com" - Jul 28 12:42:52 2009
Sounds like you are trying to turn on a port set as an input (This would turn on the pull
up so depending on the impedance you are connected would in effect be a potential
divider).
You mention setting a bit in port a but port a is the reset and crystal connections, are
you using an internal oscillator , which bit in porta are you trying to use ? is it set by
fuses to a reset/osc pin ?
Regards
--- In a...@yahoogroups.com, "bazzapromenade"
wrote:
>
> I have come across something that I do not quite understand. I am running a simple code
that uses 4 pins as inputs and the rest are outputs. I write in assembler code. The
program runs fine in simulation but i found a glitch when used in real life. In my code
there was a couple of dozen places where there would be most of portB on as output high
and maybe a single pin high on port A or D. To cut corners with the lone pins I used an
SBI PORTAx on the single pin. On the larger output port d I used the usual ldi to a temp
then an out to the port. Now here's the weird bit.. Any time I used sbi, the pin turned on
but only to about 3.5 volts. Using the normal ldi they would turn on to 5v. I went through
my whole program and tested the outputs and it was the same outcome every single time an
sbi was used. Changed the code to the usual LDI TEMP, 0Xxx OUT PORTA, TEMP and all
was well. I can not find any data on what causes this and do not understand how the chip
would know any difference. Once the code is converted to hex the chip would not know the
difference. Has anyone come across this and can shed some light on it.
> Many thanks Bazza.
>
------------------------------------

(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )[AVR club] Re: ATtiny 2313 floating output? - bazzapromenade - Jul 28 12:46:19 2009
>The port is an output. 0xff
> Bazza
>
> The "Data Port Direction" (DDRx) is?
>
> Edson
> ----- Original Message -----
> From: bazzapromenade
> To: a...@yahoogroups.com
> Sent: Monday, July 27, 2009 12:03 AM
> Subject: [AVR club] ATtiny 2313 floating output?
> I have come across something that I do not quite understand. I am running a simple
code that uses 4 pins as inputs and the rest are outputs. I write in assembler code. The
program runs fine in simulation but i found a glitch when used in real life. In my code
there was a couple of dozen places where there would be most of portB on as output high
and maybe a single pin high on port A or D. To cut corners with the lone pins I used an
SBI PORTAx on the single pin. On the larger output port d I used the usual ldi to a temp
then an out to the port. Now here's the weird bit.. Any time I used sbi, the pin turned on
but only to about 3.5 volts. Using the normal ldi they would turn on to 5v. I went through
my whole program and tested the outputs and it was the same outcome every single time an
sbi was used. Changed the code to the usual LDI TEMP, 0Xxx OUT PORTA, TEMP and all was
well. I can not find any data on what causes this and do not understand how the chip would
know any difference. Once the code is converted to hex the chip would not know the
difference. Has anyone come across this and can shed some light on it.
> Many thanks Bazza.
>
>
>
> [Non-text portions of this message have been removed]
>
------------------------------------

(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )
[AVR club] Re: ATtiny 2313 floating output? - bazzapromenade - Jul 28 13:39:22 2009
Nope definitely an output, same problem on port d on the pins,on d that I am using as an
output.Using internal oscillator and not using the reset pin. As I said, wherever I used
for eg sbi portd 1 with nothing connected to any output pins, using a dvm I would get an
output of 3.5v..
Doing nothing other than changing that spot of code to read
ldi temp, 0x01
out portd, temp
this gives me 5v at the pin.
bazza.
>
> Sounds like you are trying to turn on a port set as an input (This would turn on the
pull up so depending on the impedance you are connected would in effect be a potential
divider).
>
> You mention setting a bit in port a but port a is the reset and crystal connections, are
you using an internal oscillator , which bit in porta are you trying to use ? is it set by
fuses to a reset/osc pin ?
>
> Regards
>
> --- In a...@yahoogroups.com, "bazzapromenade"
wrote:
> >
> > I have come across something that I do not quite understand. I am running a simple
code that uses 4 pins as inputs and the rest are outputs. I write in assembler code. The
program runs fine in simulation but i found a glitch when used in real life. In my code
there was a couple of dozen places where there would be most of portB on as output high
and maybe a single pin high on port A or D. To cut corners with the lone pins I used an
SBI PORTAx on the single pin. On the larger output port d I used the usual ldi to a temp
then an out to the port. Now here's the weird bit.. Any time I used sbi, the pin turned on
but only to about 3.5 volts. Using the normal ldi they would turn on to 5v. I went through
my whole program and tested the outputs and it was the same outcome every single time an
sbi was used. Changed the code to the usual LDI TEMP, 0Xxx OUT PORTA, TEMP and all
was well. I can not find any data on what causes this and do not understand how the chip
would know any difference. Once the code is converted to hex the chip would not know the
difference. Has anyone come across this and can shed some light on it.
> > Many thanks Bazza.
>
------------------------------------

(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )[AVR club] Re: ATtiny 2313 floating output? - "s.h...@btinternet.com" - Jul 29 11:10:22 2009
Bazza,
I am using an atmel attiny device, i wrote the program in c, i have a definition for
setting a port
#define bit_set_hi(Port,Bit) Port |= _BV(Bit)
and if i use it i.e bit_set_hi(PORTB,PB2); it works fine, when i analyse the asm code
generated by the c compiler i get
sbi 0x18,2 and this works fine.
The example below, sbi portd,1 is not the same as ldi temp 0x01 out portd, temp it's a
different bit (Bits are numbered 0 - 7 , look in the instruction set , you need to change
your bit command to sbi portd,0 to be the same command as ldi temp 0x001, out
portd,temp
So you are setting the wrong bit with the sbi command.
Regards
--- In a...@yahoogroups.com, "bazzapromenade"
wrote:
>
> Nope definitely an output, same problem on port d on the pins,on d that I am using as an
output.Using internal oscillator and not using the reset pin. As I said, wherever I used
for eg sbi portd 1 with nothing connected to any output pins, using a dvm I would get an
output of 3.5v..
> Doing nothing other than changing that spot of code to read
> ldi temp, 0x01
> out portd, temp
> this gives me 5v at the pin.
> bazza.
> >
> > Sounds like you are trying to turn on a port set as an input (This would turn on the
pull up so depending on the impedance you are connected would in effect be a potential
divider).
> >
> > You mention setting a bit in port a but port a is the reset and crystal connections,
are you using an internal oscillator , which bit in porta are you trying to use ? is it
set by fuses to a reset/osc pin ?
> >
> > Regards
> >
> > --- In a...@yahoogroups.com, "bazzapromenade" wrote:
> > >
> > > I have come across something that I do not quite understand. I am running a simple
code that uses 4 pins as inputs and the rest are outputs. I write in assembler code. The
program runs fine in simulation but i found a glitch when used in real life. In my code
there was a couple of dozen places where there would be most of portB on as output high
and maybe a single pin high on port A or D. To cut corners with the lone pins I used an
SBI PORTAx on the single pin. On the larger output port d I used the usual ldi to a temp
then an out to the port. Now here's the weird bit.. Any time I used sbi, the pin turned on
but only to about 3.5 volts. Using the normal ldi they would turn on to 5v. I went through
my whole program and tested the outputs and it was the same outcome every single time an
sbi was used. Changed the code to the usual LDI TEMP, 0Xxx OUT PORTA, TEMP and all
was well. I can not find any data on what causes this and do not understand how the chip
would know any difference. Once the code is converted to hex the chip would not know the
difference. Has anyone come across this and can shed some light on it.
> > > Many thanks Bazza.
> > >
>
------------------------------------

(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )