Solar panel
Loading...
Searching...
No Matches
old_main.c
Go to the documentation of this file.
1/************************************************************************/
7#include <xc.h>
8#include <stdint.h>
9#include <stdbool.h>
10#include <stdio.h>
11
12#include "lcd/lcd.h"
13#include "pwm.h"
14#include "measure.h"
15#include "modbus.h"
16#include "uart.h"
17
18#define _XTAL_FREQ 64000000L
22void init_hw()
23{
24 OSCCON3 = 0; // runs at 64MHz
25 LCD_Init(LCD_2x16);
26 adc_init();
27 modbus_init(0x80);
28 pwm_init();
29 uart_init();
30 // Interrupts configuration
31 PEIE = 1;
32 GIE = 1;
33}
34
35uint8_t tmpStr[30];
36uint16_t u;
37uint16_t i;
38uint16_t p;
39
40uint16_t offset;
41uint16_t pwm = 512;
42
43void main(void)
44{
45 init_hw();
46
47 LCD_2x16_WriteMsg((unsigned char *)"Welcome ! ", 0); // display on line 0
48 LCD_2x16_WriteMsg((unsigned char *)"*-*-*-*-*-*-*-*-", 1); // display on line 1
49
50 // TODO -> complete measure of current offset
51
52 while (true) {
53 // TODO -> complete the main loop
54 }
55}
void adc_init(void)
Definition: measure.c:16
Measuring current and voltage from the solar panel.
void modbus_init(uint8_t address)
Definition: modbus.c:112
Modbus serial library.
uint16_t p
Power in microwatts.
Definition: old_main.c:38
uint16_t pwm
Definition: old_main.c:41
void main(void)
Definition: old_main.c:43
uint16_t i
Current in microamperes.
Definition: old_main.c:37
uint16_t u
Voltage in milliovolts.
Definition: old_main.c:36
void init_hw()
Definition: old_main.c:22
uint16_t offset
Definition: old_main.c:40
uint8_t tmpStr[30]
Definition: old_main.c:35