Yahoo Groups archive

AVR-Chat

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

Thread

convert port to binary number

convert port to binary number

2004-09-28 by jim_rinaudo

OK,  I surrender.  I tried all the searches I can think of and I need 
to find the command that takes all the input states of a port and 
makes it a single binary number.  I looked in my codevision help 
section and no help there either.

The input is 12 bits arranged in groups of three so I plan on using 6 
inputs in port a and 6 in port b and convert each six into one big 12 
bit number.   then I use the 12 bit number to compare to a value in 
an array and output an equivalent decimal.  

Can anyone give me a clue.

thanks

Jim

Re: convert port to binary number

2004-09-28 by upand_at_them

Huh?  Each port IS a binary number.  Just read the port.

Mike


--- In AVR-Chat@yahoogroups.com, "jim_rinaudo" <jravionics@w...> 
wrote:
> OK,  I surrender.  I tried all the searches I can think of and I 
need 
> to find the command that takes all the input states of a port and 
> makes it a single binary number.  I looked in my codevision help 
> section and no help there either.
> 
> The input is 12 bits arranged in groups of three so I plan on using 
6 
> inputs in port a and 6 in port b and convert each six into one big 
12 
Show quoted textHide quoted text
> bit number.   then I use the 12 bit number to compare to a value in 
> an array and output an equivalent decimal.  
> 
> Can anyone give me a clue.
> 
> thanks
> 
> Jim

RE: [AVR-Chat] convert port to binary number

2004-09-28 by Daniel Boyer

I don't know of any specific commands because each port is stored as a
binary number so there really is no need to convert it.  So if you use
two ports you will have a low byte and a high byte, one will be port a
and the other port b.
Ie: 
Mov R20, PINA
Mov R21, PINB

Daniel
Show quoted textHide quoted text
> -----Original Message-----
> From: jim_rinaudo [mailto:jravionics@webworkz.com] 
> Sent: Monday, September 27, 2004 10:05 PM
> To: AVR-Chat@yahoogroups.com
> Subject: [AVR-Chat] convert port to binary number
> 
> 
> OK,  I surrender.  I tried all the searches I can think of and I need 
> to find the command that takes all the input states of a port and 
> makes it a single binary number.  I looked in my codevision help 
> section and no help there either.
> 
> The input is 12 bits arranged in groups of three so I plan on using 6 
> inputs in port a and 6 in port b and convert each six into one big 12 
> bit number.   then I use the 12 bit number to compare to a value in 
> an array and output an equivalent decimal.  
> 
> Can anyone give me a clue.
> 
> thanks
> 
> Jim

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.