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.

pROGRAM IN MikroC TO mpLab

Status
Not open for further replies.

swethamenon

Member level 4
Member level 4
Joined
Sep 12, 2012
Messages
70
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,745
I have written pgm in mkroc for energy calculation..using PIC16f877a
can you convert it to mplab??
i dont knw mplab..its lcd&adc initializtion..
[HTMLunsigned float adcval,adcval1,V1,Is,I,I1,Is1,power,energy;
char val[7];
void main()
{
energy = 0;
TRISA=0XFF;
TRISD=0X00;
ADCON1=0X80;
lcd_init(&PORTD);
lcd_cmd(lcd_clear);
lcd_cmd(lcd_cursor_off);

lcd_out(1,1,"V=");

lcd_out(1,9,"I=");

lcd_out(2,1,"E=");
while(1)
{
adcval=Adc_Read(0)*.0048;
adcval1=Adc_Read(1)*.0048;
Is=adcval/100;
I=Is/2.5;
V1=I*5000;
floattostr(V1,val);
val[5]='\0';
lcd_out(1,3,val);
Is1=adcval1/100;
I1=Is1*1000;
floattostr(I1,val);
val[5]='\0';
lcd_out(1,11,val);
power = V1 * I1;
//floattostr(power,p_val);
//p_val[5]='\0';
//lcd_out(2,3,p_val);
energy =(energy + power)*(5/18);
floattostr(energy,val);
//val[5]='\0';
lcd_out(2,3,val);
delay_ms(1000);
}
}][/HTML]
 

or assembler?
I dont use mplab myself normally but isnt that assmbler oriented?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top