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.

avr programming in AVR Studio and CodeVision

Status
Not open for further replies.

ghoola

Member level 2
Member level 2
Joined
Aug 7, 2013
Messages
43
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Location
india
Visit site
Activity points
352
how can I change this AVR studio code to Codevision code?
Code:
 SPCR = _BV(SPE)|_BV(MSTR)|_BV(SPR1)|_BV(SPR0)
 

The definition of _BV is

Code:
#define _BV(bit) (1 << (bit))

so basically your code is

Code:
SPCR = (1<<SPE) | (1<<MSTR) | (1<<SPR1) | (1<<SPR0);

If the SPE,MSTR,SPR1 and SPR0 bits are not defined in codevision then check the datasheet and either add the definitions or replace them with numbers.
 

The datasheet lists all the registers and the names of each bit of the register

The register you refer to is

Snap2.jpg

So if the definition don't exist in codevision you can either add them or replace the bit names with the bit number
 

I would expect the register names to be already defined.

You can try to compile your code, if any name if undefined you will get an error and then you can fix it.
You can also check the content of the header that codevision attaches in the project (the specific mcu model defines).
 
  • Like
Reactions: ghoola

    ghoola

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top