Solar panel
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1
12#include "lcd/lcd.h"
13#include "measure.h"
14#include "modbus.h"
15
16#define MAX_COL 16
17
18void main(void) {
19
26
27 Lcd_Init();
28 adc_init();
29 modbus_init(0x80);
30
33
36
45 const uint16_t offsetCurrent = measure_current(offsetCurrent);
46
48 char msg[MAX_COL+1];
49
54 while (1) {
55
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
70 }
71}
void EPWM1_LoadDutyValue(uint16_t dutyValue)
Definition: epwm1.c:85
#define INTERRUPT_PeripheralInterruptEnable()
#define INTERRUPT_GlobalInterruptEnable()
int8_t Lcd_Init(void)
Definition: lcd.c:17
void LCD_2x16_WriteMsg(unsigned char *msg, uint8_t line)
Definition: lcd.c:74
void main(void)
Definition: main.c:18
#define MAX_COL
columns for lcd screen (and 2 rows)
Definition: main.c:16
void SYSTEM_Initialize(void)
Definition: mcc.c:50
uint16_t measure_voltage()
Definition: measure.c:37
void adc_init(void)
Definition: measure.c:16
uint16_t measure_current(uint16_t offset)
Definition: measure.c:49
Measuring current and voltage from the solar panel.
uint16_t holding_registers[2]
Definition: modbus.c:14
void modbus_init(uint8_t address)
Definition: modbus.c:108
uint16_t input_registers[2]
Definition: modbus.c:13
Modbus serial library.