Solar panel
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1
11
#include "
mcc_generated_files/mcc.h
"
12
#include "
lcd/lcd.h
"
13
#include "
measure.h
"
14
#include "
modbus.h
"
15
16
#define MAX_COL 16
17
18
void
main
(
void
) {
19
25
SYSTEM_Initialize
();
26
27
Lcd_Init
();
28
adc_init
();
29
modbus_init
(0x80);
30
32
INTERRUPT_GlobalInterruptEnable
();
33
35
INTERRUPT_PeripheralInterruptEnable
();
36
44
EPWM1_LoadDutyValue
(0);
45
const
uint16_t offsetCurrent =
measure_current
(offsetCurrent);
46
48
char
msg[
MAX_COL
+1];
49
54
while
(1) {
55
57
input_registers
[0] =
measure_voltage
();
58
input_registers
[1] =
measure_current
(offsetCurrent);
59
61
sprintf(msg,
"U = %04d [mV] "
,
input_registers
[0]);
62
LCD_2x16_WriteMsg
(msg,0);
63
65
sprintf(msg,
"I = %04d [uA] "
,
input_registers
[1]);
66
LCD_2x16_WriteMsg
(msg,1);
67
69
EPWM1_LoadDutyValue
(
holding_registers
[0]);
70
}
71
}
EPWM1_LoadDutyValue
void EPWM1_LoadDutyValue(uint16_t dutyValue)
Definition:
epwm1.c:85
INTERRUPT_PeripheralInterruptEnable
#define INTERRUPT_PeripheralInterruptEnable()
Definition:
interrupt_manager.h:86
INTERRUPT_GlobalInterruptEnable
#define INTERRUPT_GlobalInterruptEnable()
Definition:
interrupt_manager.h:63
Lcd_Init
int8_t Lcd_Init(void)
Definition:
lcd.c:17
LCD_2x16_WriteMsg
void LCD_2x16_WriteMsg(unsigned char *msg, uint8_t line)
Definition:
lcd.c:74
lcd.h
main
void main(void)
Definition:
main.c:18
MAX_COL
#define MAX_COL
columns for lcd screen (and 2 rows)
Definition:
main.c:16
SYSTEM_Initialize
void SYSTEM_Initialize(void)
Definition:
mcc.c:50
mcc.h
measure_voltage
uint16_t measure_voltage()
Definition:
measure.c:37
adc_init
void adc_init(void)
Definition:
measure.c:16
measure_current
uint16_t measure_current(uint16_t offset)
Definition:
measure.c:49
measure.h
Measuring current and voltage from the solar panel.
holding_registers
uint16_t holding_registers[2]
Definition:
modbus.c:14
modbus_init
void modbus_init(uint8_t address)
Definition:
modbus.c:108
input_registers
uint16_t input_registers[2]
Definition:
modbus.c:13
modbus.h
Modbus serial library.
main.c
Generated by
1.9.6