Aguijón Software Libraries  1.0
Documentation for the included Libraries
 All Files Functions Variables Typedefs Enumerations Enumerator Macros
tester.c
Go to the documentation of this file.
1 /********************************************************************
2  FileName: tester.c
3  Dependencies: See INCLUDES section
4  Hardware: Aguijón rev3.0
5  Complier: Microchip XC16(for PIC24), C30(for PIC24)
6  Company: Vinagrón Digital
7 
8  Software License Agreement:
9 
10  blah blah blah
11 
12 ********************************************************************
13  File Description:
14  Includes tester functions.
15 
16 
17  Change History:
18  Rev Description
19  ---- -----------------------------------------
20  1.0 Initial release
21 ********************************************************************/
22 
23 #include <p24FJ128GB106.h>
24 #include <uart.h>
25 #include "definitions.h"
26 #include "serial.h"
27 #include "tester.h"
28 #include "outputs.h"
29 #include "inputs.h"
30 #include "outcompare.h"
31 
32 extern unsigned char cmdBuffer[3];
33 
45 void RLY_serial(void)
46 {
47  switch(cmdBuffer[1]){
48  case 0xA1:
49  if(cmdBuffer[2]){ RLYport(1,ON); }
50  else{ RLYport(1,OFF); }
51  break;
52  case 0xA2:
53  if(cmdBuffer[2]){ RLYport(2,ON); }
54  else{ RLYport(2,OFF); }
55  break;
56  case 0xA3:
57  if(cmdBuffer[2]){ RLYport(3,ON); }
58  else{ RLYport(3,OFF); }
59  break;
60  case 0xA4:
61  if(cmdBuffer[2]){ RLYport(4,ON); }
62  else{ RLYport(4,OFF); }
63  break;
64  }
65  RS232_put(0xFF);
66 }
67 
79 void OC_serial(void)
80 {
81  switch(cmdBuffer[1]){
82  case 0xB1:
83  if(cmdBuffer[2]){ OCport(1,ON); }
84  else{ OCport(1,OFF); }
85  break;
86  case 0xB2:
87  if(cmdBuffer[2]){ OCport(2,ON); }
88  else{ OCport(2,OFF); }
89  break;
90  case 0xB3:
91  if(cmdBuffer[2]){ OCport(3,ON); }
92  else{ OCport(3,OFF); }
93  break;
94  case 0xB4:
95  if(cmdBuffer[2]){ OCport(4,ON); }
96  else{ OCport(4,OFF); }
97  break;
98  }
99  RS232_put(0xFF);
100 }
101 
113 void LEDPort_serial(void)
114 {
115  switch(cmdBuffer[1]){
116  case 0xC1:
117  if(cmdBuffer[2]){ LEDport(1,ON); }
118  else{ LEDport(1,OFF); }
119  break;
120  case 0xC2:
121  if(cmdBuffer[2]){ LEDport(2,ON); }
122  else{ LEDport(2,OFF); }
123  break;
124  case 0xC3:
125  if(cmdBuffer[2]){ LEDport(3,ON); }
126  else{ LEDport(3,OFF); }
127  break;
128  case 0xC4:
129  if(cmdBuffer[2]){ LEDport(4,ON); }
130  else{ LEDport(4,OFF); }
131  break;
132  case 0xC5:
133  if(cmdBuffer[2]){ LEDport(5,ON); }
134  else{ LEDport(5,OFF); }
135  break;
136  case 0xC6:
137  if(cmdBuffer[2]){ LEDport(6,ON); }
138  else{ LEDport(6,OFF); }
139  break;
140  case 0xC7:
141  if(cmdBuffer[2]){ LEDport(7,ON); }
142  else{ LEDport(7,OFF); }
143  break;
144  case 0xC8:
145  if(cmdBuffer[2]){ LEDport(8,ON); }
146  else{ LEDport(8,OFF); }
147  break;
148  }
149  RS232_put(0xFF);
150 }