You are on page 1of 15

TECH_C_SampleADC();

char ADC0_ReadAsByte();
short ADC0_ReadAsInt();
float ADC0_ReadAsVoltage();
void ADC0_ReadAsString(char* RETVAL, char RETVAL_SIZE);
//Defines:
/**** Macro Substitutions ****
portc = RTS Port
trisc = RTS Data Direction
portc = CTS Port
trisc = CTS Data Direction
0 = RTS Pin
4 = CTS Pin
1 = UART Selection (0-SW / 1-UART1 / 2-UART2)
0 = Flow Control (0-Off / 1-On)
0 = Debug Enable (0-Off / 1-On)
0 = Echo Enable (0-Off / 1-On)
4 = UART TXSTA Value
129 = UART SPBRG Value
RS232_1508062 = Unique ID
Unused = Bitbanged Receive Port Register
Unused = Bitbanged Receive Data Direction Register
Unused = Bitbanged Receive Pin
Unused = Bitbanged Transmit Pin
120 = Bitbanged BAUD Rate Delay
0 = Timout Selection (0-Legacy / 1-MS Timeout)
0 = Data Size (0-8 bits / 1-9 bits / 2-7 bits & Only available on
BitBanged components)
0 = Parity Enable (0-No Parity / 1-Odd Parity / 2-Even Parity)
0 = Legacy Return (0-Legacy mode return 255 / 1-New mode return
MSB err flags)
Unused = Bitbanged Transmit Port Register
Unused = Bitbanged Transmit Data Direction Register
******************************/
#define RS232 RTS_PORT portc
#define RS232 RTS_TRIS trisc
#define RS232 CTS_PORT portc
#define RS232 CTS_TRIS trisc
#define RS232 RTS_PIN 0
#define RS232 CTS_PIN 4
#define RS232 UART 1
#define RS232 TOUT 0
#define RS232 DATASIZE 0
#define RS232 PARITY 0
#define RS232 LEGACY_RV 0
#if (0 == 1)
#define RS232 HARDWARE
#endif
#if (0 == 1)
#define RS232 DEBUG
#endif
#if (0 == 1)
#define RS232 ECHO
#endif
#if (RS232 UART == 0)
#define RS232 SW_BAUD 120
#else
#define RS232 TXSTA_VAL 4
#define RS232 SPBRG_VAL 129
#define RS232 SW_BAUD 0
#endif
#define RS232 STATUS_LOOP 0
#define RS232 STATUS_TIMEOUT 1
#define RS232 STATUS_RXBYTE 2
//RS2320: //Macro function declarations
void RS2320_SendRS232Char(short nChar);
void RS2320_SendRS232String(char* String, char MSZ_String);
short RS2320_ReceiveRS232Char(short nTimeout);
void RS2320_ReceiveRS232String(char* RETVAL, char RETVAL_SIZE, char
nTimeout, char NumBytes);
void RS2320_RS232_Delay(char mode);
//ADC0: //Macro implementations
void ADC0_SampleADC()
{
#define MX_ADC_CHANNEL 4
#define MX_ADC_SAMP_TIME 40
#define MX_ADC_CONV_SP 3
#define MX_ADC_VREF_OPT 0
//set up ADC conversion
char old_tris, cnt;
//find appropriate bit
#if (MX_ADC_CHANNEL == 0)
#define MX_ADC_TRIS_MSK 0x01
#define MX_ADC_TRIS_REG trisa
#if (MX_ADC_VREF_OPT == 0)
adcon1 = 0x0E;
#else
adcon1 = 0x05;
#endif
#endif
#if (MX_ADC_CHANNEL == 1)
#define MX_ADC_TRIS_MSK 0x02
#define MX_ADC_TRIS_REG trisa
#if (MX_ADC_VREF_OPT == 0)
adcon1 = 0x04;
#else
adcon1 = 0x05;
#endif
#endif
#if (MX_ADC_CHANNEL == 2)
#define MX_ADC_TRIS_MSK 0x04
#define MX_ADC_TRIS_REG trisa
#if (MX_ADC_VREF_OPT == 0)
adcon1 = 0x02;
#else
adcon1 = 0x03;
#endif
#endif
#if (MX_ADC_CHANNEL == 3)
#define MX_ADC_TRIS_MSK 0x08
#define MX_ADC_TRIS_REG trisa
#if (MX_ADC_VREF_OPT == 0)
adcon1 = 0x04;
#endif
#if (MX_ADC_CHANNEL == 4)
#define MX_ADC_TRIS_MSK 0x20
#define MX_ADC_TRIS_REG trisa
#if (MX_ADC_VREF_OPT == 0)
adcon1 = 0x02;
#else
adcon1 = 0x03;
#endif
#endif
#if (MX_ADC_CHANNEL == 5)
#define MX_ADC_TRIS_MSK 0x01
#define MX_ADC_TRIS_REG trise
#if (MX_ADC_VREF_OPT == 0)
adcon1 = 0x09;
#else
adcon1 = 0x01;
#endif
#endif
#if (MX_ADC_CHANNEL == 6)
#define MX_ADC_TRIS_MSK 0x02
#define MX_ADC_TRIS_REG trise
#if (MX_ADC_VREF_OPT == 0)
adcon1 = 0x00;
#else
adcon1 = 0x01;
#endif
#endif
#if (MX_ADC_CHANNEL == 7)
#define MX_ADC_TRIS_MSK 0x04
#define MX_ADC_TRIS_REG trise
#if (MX_ADC_VREF_OPT == 0)
adcon1 = 0x00;
#else
adcon1 = 0x01;
#endif
#endif
//assign conversion speed
#if (MX_ADC_CONV_SP > 3)
st_bit(adcon1, ADCS2);
#endif
//store old tris value, and set the i/o pin as an input
old_tris = MX_ADC_TRIS_REG;
MX_ADC_TRIS_REG = MX_ADC_TRIS_REG |
MX_ADC_TRIS_MSK;
//turn ADC on
adcon0 = (0x01 | (MX_ADC_CONV_SP << 6)) |
(MX_ADC_CHANNEL << 3);
//wait the acquisition time
cnt = 0;
while (cnt < MX_ADC_SAMP_TIME) cnt++;
//begin conversion and wait until it has finished
adcon0 = adcon0 | 0x04;
while (adcon0 & 0x04);
//restore old tris value, and reset adc registers
MX_ADC_TRIS_REG = old_tris;
adcon1 = 0x07;
adcon0 = 0x00;
#undef MX_ADC_CHANNEL
#undef MX_ADC_TRIS_REG
#undef MX_ADC_TRIS_MSK
#undef MX_ADC_SAMP_TIME
#undef MX_ADC_CONV_SP
#undef MX_ADC_VREF_OPT
}
char ADC0_ReadAsByte()
{
ADC0_SampleADC();
return adresh;
}
//RS2320: //Macro implementations
void RS2320_SendRS232Char(short nChar)
{
#if (RS232 UART == 0)
char dMask;
char idx;
char count = 8;
#ifdef RS232 HARDWARE
//wait until CTS is low
while (( RS232 CTS_PORT & (1 << RS232
CTS_PIN) ) != 0);
#endif
#if(RS232 DATASIZE == 1)
count = 9;
#endif
#if(RS232 DATASIZE == 2)
count = 7;
#endif
clear_bit( RS232 TX_PORT, RS232 SW_TX); //
Send Start bit
RS2320_RS232_Delay(0);
for (idx = 0; idx < count; idx++)
{
dMask = nChar & 0x01;
// Mask off data bit
if (dMask)
set_bit( RS232 TX_PORT, RS232 SW_TX);
else
clear_bit( RS232 TX_PORT, RS232 SW_TX);
RS2320_RS232_Delay(0);
nChar = nChar >> 1;
// Move to next data bit
}
set_bit( RS232 TX_PORT, RS232 SW_TX); //
Send Stop bit
RS2320_RS232_Delay(0);
#endif
}
void RS2320_SendRS232String(char* String, char MSZ_String)
{
char idx;
for(idx = 0; idx < MSZ_String; idx++)
{
#ifdef _BOOSTC
if (String[idx] == 0)
break;
else RS2320_SendRS232Char(String[idx]);
#endif
#ifdef HI_TECH_
if (*String == 0)
break;
else RS2320_SendRS232Char(*String);
String++;
#endif
}
}
short RS2320_ReceiveRS232Char(short nTimeout)
{
char delay1 = 0;
char delay2 = 0;
char regcheck = 0;
char dummy = 0;
short retVal = 512;
char bWaitForever = 0;
char rxStatus = RS232 STATUS_LOOP;
char idx;
char count = 8;
#if ( RS232 LEGACY_RV == 0)
retVal = 255;
#endif
#ifdef RS232 HARDWARE
//ready to accept data
clear_bit( RS232 RTS_PORT, RS232 RTS_PIN);
#endif
if (nTimeout == 255)
bWaitForever = 1;
while (rxStatus == RS232 STATUS_LOOP)
{
if (bWaitForever == 0)
{
//don't wait forever, so do timeout thing...
if (nTimeout == 0)
{
rxStatus = RS232 STATUS_TIMEOUT;
}
else
{
if ( RS232 TOUT)
{
delay_us(10);
delay1 = delay1 + 1;
if(delay1 == 100)
{
nTimeout = nTimeout - 1;
delay1 = 0;
}
}
else
{
//decrement timeout
delay1 = delay1 - 1;
if (delay1 == 0)
{
nTimeout = nTimeout - 1;
}
}
}
}
#if ( RS232 UART == 0)
regcheck = test_bit(RS232 RX_PORT, RS232
SW_RX); //Test for start bit
if (regcheck == 0)
rxStatus = RS232 STATUS_RXBYTE;
#endif
}
if (rxStatus == RS232 STATUS_RXBYTE)
{
#if ( RS232 UART > 0)
#if ( RS232 UART == 1)
regcheck = ts_bit(rcsta, FERR);
#endif
#if ( RS232 UART == 2)
regcheck = ts_bit(rcsta2, FERR);
#endif
if (regcheck != 0)
{
#if ( RS232 UART == 1)
dummy = rcreg; //need to read
the rcreg to clear FERR
#endif
#if ( RS232 UART == 2)
dummy = rcreg2; //need to read
the rcreg to clear FERR
#endif
#ifdef RS232 DEBUG
RS2320_SendRS232Char('<');
RS2320_SendRS232Char('F');
RS2320_SendRS232Char('E');
RS2320_SendRS232Char('R');
RS2320_SendRS232Char('R');
RS2320_SendRS232Char('>');
#endif
#if ( RS232 LEGACY_RV == 1)
retVal = 0x400;
//Framing Error Flag
#endif
}
else
{
#if ( RS232 UART == 1)
regcheck = ts_bit(rcsta, OERR);
#endif
#if ( RS232 UART == 2)
regcheck = ts_bit(rcsta2, OERR);
#endif
if (regcheck != 0)
{
//need to read the rcreg to clear
error
#if ( RS232 UART == 1)
cr_bit(rcsta, CREN);
st_bit(rcsta, CREN);
#endif
#if ( RS232 UART == 2)
cr_bit(rcsta2, CREN);
st_bit(rcsta2, CREN);
#endif
#ifdef RS232 DEBUG
RS2320_SendRS232Char('<');
RS2320_SendRS232Char('O');
RS2320_SendRS232Char('E');
RS2320_SendRS232Char('R');
RS2320_SendRS232Char('R');
RS2320_SendRS232Char('>');
#endif
#if ( RS232 LEGACY_RV == 1)
retVal = 0x800;
//Overrun Error Flag
#endif
}
else
{
#if ( RS232 UART == 1)
retVal = rcreg; //no error, so rx byte is valid
#if( RS232 DATASIZE == 1)
if(ts_bit(rcsta, RX9D));
retVal = retVal | 0x100;
#endif
#endif
#if ( RS232 UART == 2)
retVal = rcreg2; //no error, so rx byte is valid
#if( RS232 DATASIZE == 1)
if(ts_bit(rcsta2, RX9D));
retVal = retVal | 0x100;
#endif
#endif
#ifdef RS232 ECHO
S2320_SendRS232Char(retVal);
#endif
}
}
#else
#if( RS232 DATASIZE == 1)
count = 9;
#endif
RS2320_RS232_Delay(1);
for (idx = 0; idx < count; idx++)
{
retVal = retVal >> 1;
if(count == 9)
{
if (test_bit( RS232 RX_PORT, RS232 SW_RX))
retVal = retVal | 0x100;
}
else
{
if (test_bit( RS232 RX_PORT, RS232 SW_RX))
retVal = retVal | 0x80;
}
RS2320_RS232_Delay(1);
}
#ifdef RS232 ECHO
RS2320_SendRS232Char(retVal);
#endif
#endif
}
#ifdef RS232 HARDWARE
//not ready to accept data
set_bit( RS232 RTS_PORT, RS232 RTS_PIN);
#endif
return (retVal);
}
void RS2320_ReceiveRS232String(char* RETVAL, char RETVAL_SIZE, char
nTimeout, char NumBytes)
{
char idx;
short in;
#if ( RS232 LEGACY_RV == 0 )
#define RS232_TO 255
#else
#define RS232_TO 256
#endif
if (NumBytes > RETVAL_SIZE)
NumBytes = RETVAL_SIZE;
for (idx = 0; idx < NumBytes; idx++)
{
in = RS2320_ReceiveRS232Char(nTimeout);
if(in < RS232_TO)
RETVAL[idx] = in & 0xFF;
else
break;
}
if (idx < RETVAL_SIZE)
RETVAL[idx] = 0;
#undef RS232_TO
}
void RS2320_RS232_Delay(char mode)
{
unsigned int iterations;
unsigned int delay = RS232 SW_BAUD;
if (mode)
delay = delay + 1;
for (iterations = 0; iterations < delay; iterations++);
}
//Macro implementations
void main()
{
//Initialisation
adcon1 = 0x07;
#if (RS232 UART == 0)
set_bit(RS232 RX_TRIS, RS232 SW_RX); // Receive pin is a input
clear_bit(RS232 TX_TRIS, RS232 SW_TX); // Transmit pin is a output
set_bit(RS232 TX_PORT, RS232 SW_TX);// Transmit pin is default high
#endif
#if (RS232 UART == 1)
txsta = RS232 TXSTA_VAL; // 8-bit, async, low speed, off
spbrg = RS232 SPBRG_VAL; // set the baud rate
rcsta = 0; // 8-bit, disabled
if(RS232 DATASIZE == 1)
{
st_bit(txsta, TX9);
// 9-bit TX
st_bit(rcsta, RX9); // 9-bit RX
}
st_bit(rcsta, SPEN); //
turn on serial interface
#endif
#if (RS232 UART == 2)
txsta2 = RS232 TXSTA_VAL; // 8-bit, async, low speed, off
spbrg2 = RS232 SPBRG_VAL;// set the baud rate
rcsta2 = 0; // 8-bit, disabled
if(RS232 DATASIZE == 1)
{
st_bit(txsta2, TX9); // 9-bit TX
st_bit(rcsta2, RX9); // 9-bit RX
}
st_bit(rcsta2, SPEN); // turn on serial interface
#endif
#ifdef RS232 HARDWARE
set_bit( RS232 CTS_TRIS, RS232 CTS_PIN); //CTS is an input
clear_bit( RS232 RTS_TRIS, RS232 RTS_PIN); //RTS is an output
set_bit( RS232 RTS_PORT, RS232 RTS_PIN); //not ready to accept data
#endif
//Interrupt initialisation code
option_reg = 0xC0;
//Delay
//Delay: 760 ms
delay_ms(255);
delay_ms(255);
delay_ms(250);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232String("AT")
RS2320_SendRS232String("AT",2);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232String("ATE0")
RS2320_SendRS232String("ATE0",4);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232String("AT&W")
RS2320_SendRS232String("AT&W",4);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("AT+CMGF=1")
RS2320_SendRS232String("AT+CMGF=1",9);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("AT+CNMI=1,2,0,0,0")
RS2320_SendRS232String("AT+CNMI=1,2,0,0,0",17);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Delay
//Delay: 20 ms
delay_ms(20);
//Loop
//Loop: While 1
while (1)
{
//Call Component Macro
//Call Component Macro: temp=ADC(0)::ReadAsByte
TEMP = ADC0_ReadAsByte();
//Input
//Input: E0 -> bp
trise = trise | 0x01;
BP = ((porte & 0x01) == 0x01);
//Decision
//Decision: bp=1?
if (BP==1)
{
//Calculation
//Calculation:
// bp_count = bp_count+1
BP_COUNT = BP_COUNT+1;
//Loop
//Loop: Loop 10 times
for (_LOOP1=0; _LOOP1<10; _LOOP1++)
{
//Input
//Input: B0 -> bp
trisb = trisb | 0x01;
BP = ((portb & 0x01) == 0x01);
//Decision
//Decision: bp=1?
if (BP==1)
{
//Calculation
82
//Calculation:
// bp_count = bp_count+1
BP_COUNT = BP_COUNT+1;
}
}
//Calculation
//Calculation:
// bp_count = bp_count*6
BP_COUNT = BP_COUNT*6;
//Decision
//Decision: bp_count>80?
if (BP_COUNT>80)
{
//Decision
//Decision: count=0?
if (COUNT==0)
{
//Calculation
//Calculation:
// count = 1
COUNT = 1;
//Ca
ll Component Macro
//Call Component Macro: RS232(0)::SendRS232String("AT+CMGS=")
RS2320_SendRS232String("AT+CMGS=",8);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char("9342182423")
RS2320_SendRS232Char('9');
RS2320_SendRS232Char('3');
RS2320_SendRS232Char('4');
RS2320_SendRS232Char('2');
RS2320_SendRS232Char('1');
RS2320_SendRS232Char('8');
RS2320_SendRS232Char('2');
RS2320_SendRS232Char('4');
RS2320_SendRS232Char('2');
RS2320_SendRS232Char('3');
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Delay
//Delay: 20 ms
delay_ms(20);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("Increase in heartbeat")
RS2320_SendRS232String("Increase in heartbeat",21);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x1a)
RS2320_SendRS232Char(0x1a);
//Delay
//Delay: 2 s
delay_s(2);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232String("AT+CMGS=")
RS2320_SendRS232String("AT+CMGS=",8);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char("9535424613")
RS2320_SendRS232Char('9');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('3');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('4');
RS2320_SendRS232Char('2');
RS2320_SendRS232Char('4');
RS2320_SendRS232Char('6');
RS2320_SendRS232Char('1');
RS2320_SendRS232Char('3');
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Delay
//Delay: 20 ms
delay_ms(20);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("Increase in heartbeat")
RS2320_SendRS232String("Increase in heartbeat",21);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x1a)
RS2320_SendRS232Char(0x1a);
//Delay
//Delay: 2 s
delay_s(2);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("AT+CMGS=")
RS2320_SendRS232String("AT+CMGS=",8);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char("9538755508")
RS2320_SendRS232Char('9');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('3');
RS2320_SendRS232Char('8');
RS2320_SendRS232Char('7');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('0');
RS2320_SendRS232Char('8');
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Delay
//Delay: 20 ms
delay_ms(20);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("Increase in heartbeat")
RS2320_SendRS232String("Increase in heartbeat",21);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x1a)
RS2320_SendRS232Char(0x1a);
//Delay
//Delay: 2 s
delay_s(2);
}
} else {
//Calculation
//Calculation:
// count = 0
COUNT = 0;
}
}
//Decision
//Decision: temp>35?
if (TEMP>35)
{
//Decision
//Decision: count1=0?
if (COUNT1==0)
{
//Calculation
//Calculation:
// count1 = 1
COUNT1 = 1;
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("AT+CMGS=")
RS2320_SendRS232String("AT+CMGS=",8);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char("9342182423")
RS2320_SendRS232Char('9');
RS2320_SendRS232Char('3');
RS2320_SendRS232Char('4');
RS2320_SendRS232Char('2');
RS2320_SendRS232Char('1');
RS2320_SendRS232Char('8');
RS2320_SendRS232Char('2');
RS2320_SendRS232Char('4');
RS2320_SendRS232Char('2');
RS2320_SendRS232Char('3');
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Delay
//Delay: 20 ms
delay_ms(20);
//Call Component Macro
//Call Component Macro: RS232(0)::SendRS232String("Increase in Temperature")
RS2320_SendRS232String("Increase in Temperature",23);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x1a)
RS2320_SendRS232Char(0x1a);
//Delay
//Delay: 2 s
delay_s(2);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("AT+CMGS=")
RS2320_SendRS232String("AT+CMGS=",8);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char("9535424613")
RS2320_SendRS232Char('9');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('3');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('4');
RS2320_SendRS232Char('2');
RS2320_SendRS232Char('4');
RS2320_SendRS232Char('6');
RS2320_SendRS232Char('1');
RS2320_SendRS232Char('3');
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Delay
//Delay: 20 ms
delay_ms(20);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("Increase in Temperature")
RS2320_SendRS232String("Increase in
Temperature",23);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x1a)
RS2320_SendRS232Char(0x1a);
//Delay
//Delay: 2 s
delay_s(2);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("AT+CMGS=")
RS2320_SendRS232String("AT+CMGS=",8);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char("9538755508")
RS2320_SendRS232Char('9');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('3');
RS2320_SendRS232Char('8');
RS2320_SendRS232Char('7');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('5');
RS2320_SendRS232Char('0');
RS2320_SendRS232Char('8');
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x22)
RS2320_SendRS232Char(0x22);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x0d)
RS2320_SendRS232Char(0x0d);
//Delay
//Delay: 20 ms
delay_ms(20);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232String("Increase in Temperature")
RS2320_SendRS232String("Increase in
Temperature",23);
//Call Component Macro
//Call Component Macro:
RS232(0)::SendRS232Char(0x1a)
RS2320_SendRS232Char(0x1a);
//Delay
//Delay: 2 s
delay_s(2);
}
} else {
//Calculation
//Calculation:
// count1 = 0
COUNT1 = 0;
}
//Delay
//Delay: 500 ms
delay_ms(255);
delay_ms(245);
}
mainendloop: goto mainendloop;
}

You might also like