Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] passing an AVR port's bit pointer to to a function

2010-08-06 by Robert Adsett

On 8/6/2010 3:16 AM, Jeff Blaine wrote:
> I have an encoder service function that reads a couple of bits from an AVR and increments a counter if a turn was decoded.
>
> To make the function generic, I would like to pass the port bits as arguments to the function.
>
> Unfortunately, I cannot quite figure out how to pass the port bits to the function.  Appreciate advice as to what I'm overlooking...
>
> function prototype looks like this:
>
> char encoder_service(char *avr_port_bit_A, char *avr_port_bit_B) {
>
> }
>
> In the main program, I would have something like this to call the function
>
> x = char pointer to PORTA0
> y = char pointer to PORTA1
>
> encoder_service(   x   ,   y   );
>
> Using standard C.

Why not just pass the state of the pins?

Robert

-- 
http://www.aeolusdevelopment.com/

  From the Divided by a Common Language File (Edited to protect the guilty)
ME - "I'd like to get Price and delivery for connector Part # XXXXX"
Dist./Rep - "$X.XX Lead time 37 days"
ME - "Anything we can do about lead time?  37 days seems a bit high."
Dist./Rep - "that is the lead time given because our stock is live....
we currently have stock."

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.