Yahoo Groups archive

AVR-Chat

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

Message

Re: Assembler directive equ

2005-11-02 by Dave VanHorn

--- In AVR-Chat@yahoogroups.com, John Samperi <samperi@a...> wrote:
>
> At 12:26 PM 2/11/2005, you wrote:
> >I was wondering if I could combine both equates to do something 
like this
> >.equ LCD_Enable = Portc, 0
> 
> No. You can make a macro that would substitute the instructions I 
guess

I've done this by equating the PORTC and the pin separately, 
something like 

.equ  LCD_PORT = PORTC
.equ  LCD_DDR  = DDRC
.equ  LCD_Epin = 3

Now in the init code I can say:

sbi LCD_DDR,LCD_Epin ; to make it an output.
cbi LCD_PORT,LCD_Epin ; to make it low

In the main code, I might

sbi LCD_PORT,LCD_Epin
cbi LCD_PORT_LCD_Epin

Which makes for very portable code.

Attachments

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.