Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Bit logic...

Bit logic...

2005-06-12 by Roy E. Burrage

I often have to toggle a bit and this is about as short and elegant as I've been able to do with the AVR.


Toggle_A1: ; Toggles PB0 (A1) output state
LDI T1,1 ; Set bit 0 in T1
IN T2,PORTB
EOR T2,T1 ; XOR T1 and Port B (T2) to toggle PB0
OUT PORTB,T2
RET

This routine is called from the main program and could be performed a couple of other ways, but not anything shorter that I can see.

With the 8x31/32 series we had the CPL operation. With the er, uh, those other guys...we have BTG.

Anyone know of a shorter means, code wise, of doing this? Am I missing something, like a single operation?


REB

Re: [AVR-Chat] Bit logic...

2005-06-12 by Mark Jordan

Another way of toggling a PORT bit:


tgl_bit:	sbis		PORTC, BIT
		rjmp		sbi_bit
		
clr_bit:	cbi		PORTC, BIT
		ret

set_bit:	sbi		PORTC, BIT
		ret


Mark
Show quoted textHide quoted text
On 12 Jun 2005 at 1:58, Roy E. Burrage wrote:

> 
> I often have to toggle a bit and this is about as short and elegant as I've been
> able to do with the AVR.
> 
> 
>  Toggle_A1:             ; Toggles PB0 (A1) output state
>      LDI  T1,1     ; Set bit 0 in T1
>       IN   T2,PORTB
>      EOR  T2,T1      ; XOR T1 and Port B (T2) to toggle PB0
>      OUT  PORTB,T2
>      RET
> 
> This routine is called from the main program and could be performed a couple of
> other ways, but not anything shorter that I can see.
> 
> With the 8x31/32 series we had the CPL operation. With the er, uh, those other
> guys...we have BTG.
> 
> Anyone know of a shorter means, code wise, of doing this? Am I missing 
> something, like a single operation?
> 
> 
> REB
> 
> 
> Yahoo! Groups Links
> *       To visit your group on the web, go to:
>         http://groups.yahoo.com/group/AVR-Chat/
> 
> *       To unsubscribe from this group, send an email to:
>         AVR-Chat-unsubscribe@yahoogroups.com
> 
> *       Your use of Yahoo! Groups is subject to the Yahoo! 
>         Terms of Service. 
>

Re: [AVR-Chat] Bit logic...

2005-06-12 by James Hatley

Hello,

You may be able to toggle a port bit by writing a 1 to the corresponding
PINx bit. I've not seen it documented anywhere except in the m2560 document.
You might want to try it to see if it works on all AVR processors.

For PORTn and BITx it would be, I think...

tgl_bit: sbi PINn,BITx
ret

Jim

----- Original Message ----- 
From: "Mark Jordan" <mark@cpovo.net>
To: <AVR-Chat@yahoogroups.com>
Sent: Sunday, June 12, 2005 5:55 AM
Subject: Re: [AVR-Chat] Bit logic...


>
> Another way of toggling a PORT bit:
>
>
> tgl_bit: sbis PORTC, BIT
> rjmp sbi_bit
>
> clr_bit: cbi PORTC, BIT
> ret
>
> set_bit: sbi PORTC, BIT
> ret
>
>
> Mark
> On 12 Jun 2005 at 1:58, Roy E. Burrage wrote:
>
> >
> > I often have to toggle a bit and this is about as short and elegant as
I've been
> > able to do with the AVR.
> >
> >
> >  Toggle_A1:             ; Toggles PB0 (A1) output state
> >      LDI  T1,1     ; Set bit 0 in T1
> >       IN   T2,PORTB
> >      EOR  T2,T1      ; XOR T1 and Port B (T2) to toggle PB0
> >      OUT  PORTB,T2
> >      RET
> >
> > This routine is called from the main program and could be performed a
couple of
> > other ways, but not anything shorter that I can see.
> >
> > With the 8x31/32 series we had the CPL operation. With the er, uh, those
other
Show quoted textHide quoted text
> > guys...we have BTG.
> >
> > Anyone know of a shorter means, code wise, of doing this? Am I missing
> > something, like a single operation?
> >
> >
> > REB
> >
> >
> > Yahoo! Groups Links
> > *       To visit your group on the web, go to:
> >         http://groups.yahoo.com/group/AVR-Chat/
> >
> > *       To unsubscribe from this group, send an email to:
> >         AVR-Chat-unsubscribe@yahoogroups.com
> >
> > *       Your use of Yahoo! Groups is subject to the Yahoo!
> >         Terms of Service.
> >
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>

Re: [AVR-Chat] Bit logic...

2005-06-13 by Henry Carl Ott

Toggling a pin by writing to the PIN register works on most of the NEWER 
processors, but not all of them.
  Does work on m48/88/168.
  It's a neat trick. It is documented, but you have to be looking for it.

-carl

At 12:33 PM 6/12/2005, you wrote:
Show quoted textHide quoted text
>Hello,
>
>You may be able to toggle a port bit by writing a 1 to the corresponding
>PINx bit. I've not seen it documented anywhere except in the m2560 document.
>You might want to try it to see if it works on all AVR processors.
>
>For PORTn and BITx it would be, I think...
>
>tgl_bit: sbi PINn,BITx
>ret
>
>Jim
>
>----- Original Message -----
>From: "Mark Jordan" <mark@cpovo.net>
>To: <AVR-Chat@yahoogroups.com>
>Sent: Sunday, June 12, 2005 5:55 AM
>Subject: Re: [AVR-Chat] Bit logic...
>
>
> >
> > Another way of toggling a PORT bit:
> >
> >
> > tgl_bit: sbis PORTC, BIT
> > rjmp sbi_bit
> >
> > clr_bit: cbi PORTC, BIT
> > ret
> >
> > set_bit: sbi PORTC, BIT
> > ret
> >
> >
> > Mark
> > On 12 Jun 2005 at 1:58, Roy E. Burrage wrote:
> >
> > >
> > > I often have to toggle a bit and this is about as short and elegant as
>I've been
> > > able to do with the AVR.
> > >
> > >
> > >  Toggle_A1:             ; Toggles PB0 (A1) output state
> > >      LDI  T1,1     ; Set bit 0 in T1
> > >       IN   T2,PORTB
> > >      EOR  T2,T1      ; XOR T1 and Port B (T2) to toggle PB0
> > >      OUT  PORTB,T2
> > >      RET
> > >
> > > This routine is called from the main program and could be performed a
>couple of
> > > other ways, but not anything shorter that I can see.
> > >
> > > With the 8x31/32 series we had the CPL operation. With the er, uh, those
>other
> > > guys...we have BTG.
> > >
> > > Anyone know of a shorter means, code wise, of doing this? Am I missing
> > > something, like a single operation?
> > >
> > >
> > > REB
> > >
> > >

Re: [AVR-Chat] Bit logic...

2005-06-13 by Brian Dean

On Sun, Jun 12, 2005 at 09:33:26AM -0700, James Hatley wrote:

> You may be able to toggle a port bit by writing a 1 to the
> corresponding PINx bit. I've not seen it documented anywhere except
> in the m2560 document.  You might want to try it to see if it works
> on all AVR processors.

Neat trick.  Doesn't work on ATmega128s, though.

-Brian
-- 
Brian Dean
http://www.bdmicro.com/

Re: [AVR-Chat] Bit logic...

2005-06-13 by Roy E. Burrage

Looks like the M164/324/644 also have this feature, as well as pin 
compatibility with the M16/32 series.  Maybe someone was listening...


REB


Henry Carl Ott wrote:
Show quoted textHide quoted text
>Toggling a pin by writing to the PIN register works on most of the NEWER 
>processors, but not all of them.
>  Does work on m48/88/168.
>  It's a neat trick. It is documented, but you have to be looking for it.
>
>-carl
>
>At 12:33 PM 6/12/2005, you wrote:
>  
>
>>Hello,
>>
>>You may be able to toggle a port bit by writing a 1 to the corresponding
>>PINx bit. I've not seen it documented anywhere except in the m2560 document.
>>You might want to try it to see if it works on all AVR processors.
>>
>>For PORTn and BITx it would be, I think...
>>
>>tgl_bit: sbi PINn,BITx
>>ret
>>
>>Jim
>>
>>----- Original Message -----
>>From: "Mark Jordan" <mark@cpovo.net>
>>To: <AVR-Chat@yahoogroups.com>
>>Sent: Sunday, June 12, 2005 5:55 AM
>>Subject: Re: [AVR-Chat] Bit logic...
>>
>>
>>    
>>
>>>Another way of toggling a PORT bit:
>>>
>>>
>>>tgl_bit: sbis PORTC, BIT
>>>rjmp sbi_bit
>>>
>>>clr_bit: cbi PORTC, BIT
>>>ret
>>>
>>>set_bit: sbi PORTC, BIT
>>>ret
>>>
>>>
>>>Mark
>>>On 12 Jun 2005 at 1:58, Roy E. Burrage wrote:
>>>
>>>      
>>>
>>>>I often have to toggle a bit and this is about as short and elegant as
>>>>        
>>>>
>>I've been
>>    
>>
>>>>able to do with the AVR.
>>>>
>>>>
>>>> Toggle_A1:             ; Toggles PB0 (A1) output state
>>>>     LDI  T1,1     ; Set bit 0 in T1
>>>>      IN   T2,PORTB
>>>>     EOR  T2,T1      ; XOR T1 and Port B (T2) to toggle PB0
>>>>     OUT  PORTB,T2
>>>>     RET
>>>>
>>>>This routine is called from the main program and could be performed a
>>>>        
>>>>
>>couple of
>>    
>>
>>>>other ways, but not anything shorter that I can see.
>>>>
>>>>With the 8x31/32 series we had the CPL operation. With the er, uh, those
>>>>        
>>>>
>>other
>>    
>>
>>>>guys...we have BTG.
>>>>
>>>>Anyone know of a shorter means, code wise, of doing this? Am I missing
>>>>something, like a single operation?
>>>>
>>>>
>>>>REB
>>>>
>>>>
>>>>        
>>>>
>
>
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>

Re: [AVR-Chat] Bit logic...

2005-06-13 by Dave VanHorn

At 11:33 AM 6/12/2005, James Hatley wrote:
>Hello,
>
>You may be able to toggle a port bit by writing a 1 to the corresponding
>PINx bit. I've not seen it documented anywhere except in the m2560 document.
>You might want to try it to see if it works on all AVR processors.

Hmm. It's only an improvement on toggling a bit that's in an unknown 
state though.
If you know, then sbi portx,y or cbi portx,y is just as fast.

It's also a tie on pulsing the bit, two instructions either way.

OT: Is there an easy way to convert expressPCB files to EAGLE files?

2005-06-24 by Pigeon

Hello, I have had a schematic done in expressPCB program.. and Now I want to show this file to someone else.. The issue is he only has eagle.
What is the easiest way t oconvert between the 2?

I have tried exporting from expresspcb to everything i can export to.. and that doesn't help:/
thanks
Lee Leathers

Re: OT: Is there an easy way to convert expressPCB files to EAGLE files?

2005-06-27 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, "Pigeon" <fredit@c...> wrote:
> Hello, I have had a schematic done in expressPCB program.. and 
> Now I want to show this file to someone else.. The issue is he only
> has eagle.
> 
> What is the easiest way t oconvert between the 2?

My understanding is that the ExpressPCB files are encrypted.  I have 
searched for a conversion utility and found one reference to a 
converter.  I sent a message to the original poster and have not 
gotten a response.

It sure would be nice, though, if someone came up with a tool to 
convert ExpressPCB files to Gerber format.

Lacking a converter, the simplest solution is for your compatriot to 
install ExpressPCB.

Re: [AVR-Chat] Re: OT: Is there an easy way to convert expressPCB files to EAGLE files?

2005-06-27 by Pigeon

Yeah.. that probably sounds right.
Well, I just talked my schematic over with him.. So I think we are all good there.
But.. now I am just concerned about board cost.
To have 2 56.40 square inch boards it will cost me $120.60
to have 4 56.40 square inch boards it will cost me $165.40
to have 6 56.40 square inch boards it will cost me $212.20
So ~$46.80 per additional 2 boards.
Does this sound about right?
thanks
Lee
Show quoted textHide quoted text
----- Original Message -----
From: Don Kinzer
Sent: Monday, June 27, 2005 12:29 AM
Subject: [AVR-Chat] Re: OT: Is there an easy way to convert expressPCB files to EAGLE files?

--- In AVR-Chat@yahoogroups.com, "Pigeon" <fredit@c...> wrote:
> Hello, I have had a schematic done in expressPCB program.. and
> Now I want to show this file to someone else.. The issue is he only
> has eagle.
>
> What is the easiest way t oconvert between the 2?

My understanding is that the ExpressPCB files are encrypted. I have
searched for a conversion utility and found one reference to a
converter. I sent a message to the original poster and have not
gotten a response.

It sure would be nice, though, if someone came up with a tool to
convert ExpressPCB files to Gerber format.

Lacking a converter, the simplest solution is for your compatriot to
install ExpressPCB.




Re: [AVR-Chat] Re: OT: Is there an easy way to convert expressPCB files to EAGLE files?

2005-06-27 by John Samperi

At 02:47 PM 27/06/2005, you wrote:
>So ~$46.80 per additional 2 boards.
>
>Does this sound about right?

The initial setup cost skews the cost calculations.
Once it is all set up then you can churn them out like
sausages and it gets cheaper.





Regards

John Samperi

******************************************************
                         Ampertronics Pty. Ltd.
   11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
          Tel. (02) 9674-6495       Fax (02) 9674-8745
                Email: samperi@ampertronics.com.au
                  Website  http://www.ampertronics.com.au
* Electronic Design   * Custom Products   * Contract Assembly
******************************************************

Re: [AVR-Chat] Re: OT: Is there an easy way to convert expressPCB files to EAGLE files?

2005-06-27 by Pigeon

hmm..
I went alll the way up to producing 300 boards... and the cost per board was still $23 per board. Is that fair for a 56.40 square inch board?
To me that just seems high (but.. I have only order a board or two.. so I could be way off)
thanks
Lee
Show quoted textHide quoted text
----- Original Message -----
Sent: Monday, June 27, 2005 1:52 AM
Subject: Re: [AVR-Chat] Re: OT: Is there an easy way to convert expressPCB files to EAGLE files?

At 02:47 PM 27/06/2005, you wrote:
>So ~$46.80 per additional 2 boards.
>
>Does this sound about right?

The initial setup cost skews the cost calculations.
Once it is all set up then you can churn them out like
sausages and it gets cheaper.





Regards

John Samperi

******************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495 Fax (02) 9674-8745
Email: samperi@ampertronics.com.au
Website http://www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
******************************************************


Re: [AVR-Chat] Re: OT: Is there an easy way to convert expressPCB files to EAGLE files?

2005-06-27 by Roy E. Burrage

You're looking for production pricing from a prototype house from the 
looks of things.  They're generally set up to do 10 to 25, or less, 
pieces, for which we need to be willing to pay a slight premium.  If 
you're looking for high quantity pricing you'll have to go to a volume 
house.

REB


Pigeon wrote:
Show quoted textHide quoted text
> hmm..
>  
> I went alll the way up to producing 300 boards... and the cost per 
> board was still $23 per board. Is that fair for a 56.40 square inch 
> board?
>  
> To me that just seems high (but.. I have only order a board or two.. 
> so I could be way off)
>  
> thanks
> Lee
>
>     ----- Original Message -----
>     From: John Samperi <mailto:samperi@ampertronics.com.au>
>     To: AVR-Chat@yahoogroups.com <mailto:AVR-Chat@yahoogroups.com>
>     Sent: Monday, June 27, 2005 1:52 AM
>     Subject: Re: [AVR-Chat] Re: OT: Is there an easy way to convert
>     expressPCB files to EAGLE files?
>
>     At 02:47 PM 27/06/2005, you wrote:
>     >So ~$46.80 per additional 2 boards.
>     >
>     >Does this sound about right?
>
>     The initial setup cost skews the cost calculations.
>     Once it is all set up then you can churn them out like
>     sausages and it gets cheaper.
>
>

Re: [AVR-Chat] Re: OT: Is there an easy way to convert expressPCB files to EAGLE files?

2005-06-27 by Brian Dean

On Mon, Jun 27, 2005 at 02:09:56AM -0400, Pigeon wrote:

> I went alll the way up to producing 300 boards... and the cost per
> board was still $23 per board. Is that fair for a 56.40 square inch
> board?

I don't know your other board specs but entering in a pretty standard
2-layer board of that size using the on-line quote system of
http://www.pcbnet.com gets this board at around $8 each with a 3-week
lead time for qty 300.  For $23 each you can get them with same day
turn-around.

For qty 10, the price is $19 each w/3-week lead time.  In all cases
you pay $100 tooling.

-Brian
-- 
Brian Dean
ATmega128 based MAVRIC controllers
http://www.bdmicro.com/

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.