forked from whchoi/Modbus-Slave-for-PIC18F
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
51 lines (38 loc) · 1.64 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/******************************************************************************/
/* Files to Include */
/******************************************************************************/
#if defined(__XC)
#include <xc.h> /* XC8 General Include File */
#elif defined(HI_TECH_C)
#include <htc.h> /* HiTech General Include File */
#elif defined(__18CXX)
#include <p18cxxx.h> /* C18 General Include File */
#endif
#if defined(__XC) || defined(HI_TECH_C)
#include <stdint.h> /* For uint8_t definition */
#include <stdbool.h> /* For true/false definition */
#endif
#include "system.h" /* System funct/params, like osc/peripheral config */
#include "user.h" /* User funct/params, such as InitApp */
#include "modbus.h"
#include <usart.h>
/******************************************************************************/
/* Modbus Global Variable Declaration */
/******************************************************************************/
volatile unsigned int holdingReg[50] = {0};
volatile unsigned char coils[50]= {0};
extern volatile char modbusMessage;
/******************************************************************************/
/* Main Program */
/******************************************************************************/
//SAM NOT RECEIVING ANYTHING FROM TONYS GADGET..
void main(void)
{
OpnUSART();
ConfigInterrupts();
while(1){
if(modbusMessage){
decodeIt();}
//Start code here... below is just an example
}
}