Solar panel
Loading...
Searching...
No Matches
main.c File Reference

Main is in two part. First for setup everything Second for loop on measure and set duty cycle for PWM. More...

#include "mcc_generated_files/mcc.h"
#include "lcd/lcd.h"
#include "measure.h"
#include "modbus.h"

Go to the source code of this file.

Macros

#define MAX_COL   16
 columns for lcd screen (and 2 rows)
 

Functions

void main (void)
 

Detailed Description

Main is in two part. First for setup everything Second for loop on measure and set duty cycle for PWM.

Authors
Simon Donnet-Monay & Remi Heredero
Date
14 march 2023

Definition in file main.c.

Macro Definition Documentation

◆ MAX_COL

#define MAX_COL   16

columns for lcd screen (and 2 rows)

Definition at line 16 of file main.c.

Function Documentation

◆ main()

void main ( void  )

SETUP FUNCTIONS:

Initialize the system with all mcc default configs

Initialize lcd screen

Initialize adc for measures

Initialize all specific modbus function

Enable the Global Interrupts

Enable the Peripheral Interrupts

Initialize offset current.

  1. disable load
  2. Measure current without load

The goal it's to remove the offset due to the electronics parts

create a char array for display on lcd (with space for '\0')

LOOP MAIN PROGRAM:

Get the measure and save it and the appropriate register

Print on the first row of the lcd the Voltage

Print on the second row of the lcd the current

Write the duty cycle for pwm from the appropriate register

Definition at line 18 of file main.c.