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.

Can I use a combination of assembly and C to program a PIC ?

Status
Not open for further replies.

extradeath

Member level 2
Joined
Nov 26, 2004
Messages
44
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Location
Alexandria, Egypt, Egypt
Activity points
390
Assembly + C

Dear Friends,

I've some kind of a stupid question,

Can I use a combination of assembly and C to program a PIC 16f877.


In other words, I've a function written in C that I can hardly do it on assembly FFT and I don't know hoe to use C in adjusting the registers. So I want to call the FFT function from an assembly rotine... CAN IT BE DONE....????? PLEASE REPLY AS SOON AS POSSIBLE.....
 

Assembly + C

you can call assembly inside of c and to do that you have to use the c complier that your code has been written...in which c complier it has been written???
 

Assembly + C

You could use the librarian. Make a library with your c function, then you can call it from ass.
PS.
It is very easy to use c to set the registers, as simple as PORTA = 1;
In the h file, all bits are defined, so you can do this, (Using mcc18 compiler)

//------ Read eeprom

unsigned char read_eeprom(unsigned char address)
{
EEADR = address;
EECON1bits.EEPGD = 0;
EECON1bits.RD = 1;
return EEDATA;
}

//------ Write eeprom

void write_eeprom(unsigned char address, unsigned char data)
{
EEADR = address;
EEDATA = data;
EECON1bits.EEPGD = 0;
EECON1bits.WREN = 1;
EECON2 = 0x55;
EECON2 = 0xaa;
EECON1bits.WR = 1;
while(EECON1bits.WR)
;
EECON1bits.WREN = 0;
}
 

Re: Assembly + C

You can embed assembly code inside your C code. Check out the free BoostC C compiler from **broken link removed**

Pavel
 

Re: Assembly + C

you can write an assembly code in ccs compiler as this
c code
#asm
.
.
.
assembly code
.
.
.
#endasm
 

Assembly + C

there is an ebook touched to this subject,
look this:
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top