Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Binary notation on IAR Compiler

Status
Not open for further replies.

gigionerospo

Newbie level 6
Joined
Jul 21, 2001
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Somewhere in Italy
Activity points
31
iar binary

There is a way to write a number in binary notation on IAR compiler (AVR 4.10) ?

Thanks
 

binary in iar

Hi,

You can try this, not sure it will work, dont have the time to re-install the IAR on my computer.
ver= 0b01001000;

Good luck.
 

iar 0b binary

In IAR Assembler ist is: 00000000b

regards
 

iar binary number

There were an application note in IAR website. unfortunally I don't see it anymore.
Basically, you can write a binary number using this trick

#define BIN8(s7,s6,s5,s4,s3,s2,s1,s0) (unsigned char)\
( s0 * 0x01 + s1 * 0x02 + s2 * 0x04 + s3 * 0x08 + \
s4 * 0x10 + s5 * 0x20 + s6 * 0x40 + s7 * 0x80 )

PORTA_DATA = BIN8(0,0,0,1,0,1,0,0); // set D4 & D2 to "1"

Hope it is useful for you
 

formato binário no iar

Hi,

You are correct. This option works only in the "MCC-430 C Compiler" and not in the IAR.
I did find this example in ASM to convert BIN to DEC.
This code is from the NiftyClockDVMSample from TI.

Code:
;------------------------------------------------------------------------------ 
bin2bcd;     subroutine for converting 16bit binary to BCD
       ;     input DIGIT 16bit binary, output DIGIT 16bit BCD
;------------------------------------------------------------------------------ 
             mov #16,r9                     ; 16-bits to be converted
             clr r8                         ; clear working register r8
             clr r7                         ; clear working register r9
L$1          rla DIGITS                     
             dadd r7,r7                     ; decimal add result
             dadd r8,r8
             dec r9                         ; check if 16-bits done
             jnz L$1
             mov r7,DIGITS                  ; result to DIGITS
             ret
Hope it helps...
Good luck.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top