#### jpanhalt

Joined Jan 18, 2008
11,088
Let's see, photocell, relay, LCD, 12V battery ...

What is it supposed to do? Better yet, post the code you have written to do it.

#### immortall14

Joined Nov 8, 2020
5
[QUOTE = "jpanhalt, gönderi: 1567357, üye: 17113"]
Let's see, photocell, relay, LCD, 12V battery ...

What is it supposed to do? Better yet, post the code you have written to do it.
[/QUOTE]

Port pins RA0, RA1 and RA2 receive inputs to monitor battery voltage, charge current and solar panel voltage, respectively, to control the overall process and display information on the LCD module. When port pin RA3 goes high, transistor T1 becomes saturated and relay RL1 energises to connect the solar panel to the battery.

Regulator 7805 provides regulated 5V to the microcontroller and the LCD module.

The following parameters are cyclically displayed on the LCD module:
1. Battery voltage in millivolts
2. Battery current in milliamperes
3. Energy in watt-seconds
4. Power in watts
5. Solar panel voltage in millivolts

The work of the project is explained in the link I gave.

I have an average PIC knowledge. Therefore I couldn't write code and I need C code for this project written in CCS C or MPLAB.
If you can help me I would really appreciate you.

Last edited:

#### djsfantasi

Joined Apr 11, 2010
7,620
Since this is a final project (considered homework), forum protocol forbids anyone writing code for you. It’s your project, not ours.

One question arises. If this is your final project and you can’t write code... why did you pick it?

#### jpanhalt

Joined Jan 18, 2008
11,088
Basically, it seems you need to convert code in Basic to C. Is that it?

#### immortall14

Joined Nov 8, 2020
5
Basically, it seems you need to convert code in Basic to C. Is that it?
Yes, basically this.
Also, I am trying to read voltage through adc. But despite my research, I could not reach the correct result. I need to read 12V dc voltage on adc. I used a 10k potentiometer. But the lcd shows the wrong value.
CCS C code is as follows;
Code:
#include <stdio.h>
#define LCD_ENABLE_PIN PIN_B2
#define LCD_RS_PIN PIN_B0
#define LCD_RW_PIN PIN_B1
#define LCD_DATA0 PIN_D0
#define LCD_DATA1 PIN_D1
#define LCD_DATA2 PIN_D2
#define LCD_DATA3 PIN_D3
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7

#include <lcd.c>

void main()
{
;
float voltaj=0;
lcd_init();
set_tris_d(0x00);

while(TRUE)
{
delay_ms(10);
printf(lcd_putc, "\f voltaj= %f V",voltaj);
delay_ms(2000);
}

}

#### Attachments

• 108.7 KB Views: 5
Last edited:

#### jpanhalt

Joined Jan 18, 2008
11,088
Do you has access to Google or another search engine? Lots of Basic to C translators. Many are free. Or, is your post the result of doing that?

#### immortall14

Joined Nov 8, 2020
5
Do you has access to Google or another search engine? Lots of Basic to C translators. Many are free. Or, is your post the result of doing that?
I haven't tried it before. I found the program called BCX translator. I am researching how to translate (how to use the program). Thank you.

#### djsfantasi

Joined Apr 11, 2010
7,620
Where are you going to school?

Just curious as to what educational institution accepts a published project as a final project? You have the project description, the parts list, the PCB, the PCB art and the code. And you don’t know how to translate the code into the language you need to ask for help/translation online.

I wonder what you’re doing to deserve credit for your “final project”?

I’ll be quiet now