Pic16f877a Project

Thread Starter

immortall14

Joined Nov 8, 2020
5
Hello friends,
In the project in the picture, I want to measure the current with Pic over a 5 ohm resistor.(with RA1 pin) How can I do that?
For example: It says -4.55 mA in simulation. 0 is displayed in the display. (There is no problem in compiling the code.)

the code I wrote: (CCS C)
Code:
int16 adc2;
float sarj_akimi;
unsigned char sarj_akimi[];
set_adc_channel(1);
   delay_us(20);
   adc2=read_adc();
   sarj_akimi=(adc2*4.89)/(5.0);
   sprintf(akim_sarj, "Isarj= %f mA",sarj_akimi);
   glcd_text57(10,20,akim_sarj,1,ON);
   delay_ms(100);
 

Attachments

Top