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
22
void
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
35
uint8_t
tmpStr
[30];
36
uint16_t
u
;
37
uint16_t
i
;
38
uint16_t
p
;
39
40
uint16_t
offset
;
41
uint16_t
pwm
= 512;
42
43
void
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
}
adc_init
void adc_init(void)
Definition:
measure.c:16
measure.h
Measuring current and voltage from the solar panel.
modbus_init
void modbus_init(uint8_t address)
Definition:
modbus.c:112
modbus.h
Modbus serial library.
p
uint16_t p
Power in microwatts.
Definition:
old_main.c:38
pwm
uint16_t pwm
Definition:
old_main.c:41
main
void main(void)
Definition:
old_main.c:43
i
uint16_t i
Current in microamperes.
Definition:
old_main.c:37
u
uint16_t u
Voltage in milliovolts.
Definition:
old_main.c:36
init_hw
void init_hw()
Definition:
old_main.c:22
offset
uint16_t offset
Definition:
old_main.c:40
tmpStr
uint8_t tmpStr[30]
Definition:
old_main.c:35
uart.h
old_main.c
Generated by
1.9.6