HGHK
Joined: 29 Jun 2010 Posts: 33
|
Debugging by ICD2 |
Posted: Tue Sep 28, 2010 1:15 am |
|
|
My circuit haven't any interface and must debug by icd2 debugger. But by MPLAB IDE I can't debug it. It not work.
My main code is
main.c:
Code: | #include "C:\Documents and Settings\HGhK\Desktop\CRP\temp project\main.h"
#include "C:\Documents and Settings\HGhK\Desktop\CRP\temp project\1wire.c"
#include "C:\Documents and Settings\HGhK\Desktop\CRP\temp project\DS1820.c"
#include "C:\Documents and Settings\HGhK\Desktop\CRP\temp project\PCF8583.c"
#ZERO_RAM
// #rom int8 0x1FFF={0x01,0x02,0x03}
#define Time_Period_defult 2
//---------------------------------------------------
// command set definition
#define Test_Temperature 0x00
#define Read_Temperature_Limits 0x01
#define Set_Temperature_Limits 0x03
#define Read_Time_And_Report 0x07
#define Set_Time_from_Recive 0x0F
#define Read_Sleep_Period 0x1F
#define Set_Sleep_Period 0x3F
#define Reset_Temp_counter 0x7F
#define Controler_Connected 0xFF
#define Report_Temp_counter 0xFE
// -------------------------------------------------
// EEPROM Data Address
#define Temperature_In_Reng_Count 0x01
#define Hi_Temperature_Limit 0x04
#define Lo_Temperature_Limit 0x06
#define Period_Time_reg 0x09
// -------------------------------------------------
date_time_t Time,*t;
PCF8563_Alarm AlarmTime,*ALT;
float Temprature;
int8 counter=0,command=0x00,Time_Period=Time_Period_defult;
signed int8 Lo_limit_Temp,Hi_limit_Temp;
//=============================================
// ********** Interrupts Functions ************
#int_SSP
void SSP_isr(void)
{
command = getc();
}
#int_RB
void RB_isr(void)
{
command = Controler_Connected;
}
#int_EXT
void EXT_isr(void)
{
command = Test_Temperature;
}
//**********************************************
#include "C:\Documents and Settings\HGhK\Desktop\CRP\temp project\functions.c"
//----------------------------------------------
void main()
{
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_INTERNAL);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_wdt(WDT_18MS);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RB);
enable_interrupts(INT_EXT);ext_int_edge(H_TO_L);
disable_interrupts(INT_AD);
disable_interrupts(INT_TBE);
disable_interrupts(INT_RDA);
enable_interrupts(INT_SSP);
disable_interrupts(INT_EEPROM);
enable_interrupts(GLOBAL);
config_CLKOUT(PCF8563_CLKOUT_32KHz);
config_PCF8563_Timer(PCF8563_Timer_off);
config_PCF8563_Interrupt(Alarm_Interrupt_Enable,Timer_INT_Pulse_off);
PCF8563_init();
onewire_reset();
Time=&t;
AlarmTime=&ALT;
while (1)
{
switch (command) {
case 0x00: // Test_Temperature
disable_interrupts(GLOBAL);
PCF8563_read_datetime( *t ) ;
Temprature = ds1820_read() ;
counter = read_eeprom(In_Temperature_Reng_Count);
Lo_limit_Temp = read_eeprom(Lo_Temperature_Limit) ;
Hi_limit_Temp = read_eeprom(Hi_Temperature_Limit) ;
if ((Temprature > Lo_limit_Temp)&(Temprature < Hi_limit_Temp)) {counter++;}
write_eeprom(In_Temperature_Reng_Count,counter);
enable_interrupts(GLOBAL);
calculate_Alarm_Time();
disable_interrupts(GLOBAL);
Set_Alarm(PCF8563_MHD_Mode,ALT);
config_PCF8563_Interrupt(Alarm_Interrupt_Enable,Timer_INT_Pulse_off);
enable_interrupts(GLOBAL);
command = 0x00;
break;
case 0x01: // Read_Temperature_Limits
report_Temp_Limits();
command = 0x00;
break;
case 0x03: // Set_Temperature_Limits
correct_Temp_Limits();
command = 0x00;
break;
case 0x07: // Read_Time_And_Report
Report_Present_DT();
command = 0x00;
break;
case 0x0F: // Set_Time_from_Recive
correct_Date_and_Time();
command = 0x00;
break;
case 0x1F: // Read_Sleep_Period
report_Time_Period();
command = 0x00;
break;
case 0x3F: // Set_Sleep_Period
correct_Time_Period();
command = 0x00;
break;
case 0x7F: // Reset_Temp_counter
//reset_Temp_Counter();
command = 0x00;
break;
case 0xFF: // Controler_Connected
//I_ready();
command = 0x00;
break;
case 0xFE: // Report_Temp_counter
Temp_count_report();
command = 0x00;
break;
}
test(10);
sleep();
}
}
|
and main.h: Code: | #include <16F876A.h>
#device *=16 ICD=TRUE
#device adc=10
#FUSES WDT //Watch Dog Timer
#FUSES LP //Low power osc < 200 khz
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES DEBUG //Debug mode for use with ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#use delay(clock=32768,RESTART_WDT)
#define I2C_SCL PIN_C3
#define I2C_SDA PIN_C4
#use rs232(baud=256,parity=O,xmit=PIN_C6,rcv=PIN_C7,bits=8,restart_wdt)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3,restart_wdt,force_hw)
| and self created driver PCF8563.c: Code: | // PCF8563.C
// Command Set:
// PCF8563_init(void)
// PCF8563_write_byte(int8 address, int8 data)
// PCF8563_read_byte(int8 address)
// bin2bcd(int8 value)
// bcd2bin(char bcd_value)
// PCF8563_set_datetime(date_time_t *dt)
// PCF8563_read_datetime(date_time_t *dt)
// Set_Alarm(int8 AMode,PCF8563_Alarm *AT)
// config_CLKOUT()
// config_PCF8563_Timer()
// config_PCF8563_Interrupt()
#ifndef PCF8563_SDA
#define PCF8563_SDA PIN_C4
#define PCF8563_SCL PIN_C3
#endif
#use i2c(master, sda=PCF8563_SDA, scl=PCF8563_SCL)
#ifndef PCF8563_WRITE_ADDRESS
#define PCF8563_WRITE_ADDRESS 0xA2
#define PCF8563_READ_ADDRESS 0xA3
#endif
// Register addresses
#define PCF8563_CTRL_STATUS_REG1 0x00
#define PCF8563_CTRL_STATUS_REG2 0x01
#define PCF8563_SECONDS_REG 0x02
#define PCF8563_MINUTES_REG 0x03
#define PCF8563_HOURS_REG 0x04
#define PCF8563_DAY_REG 0x05
#define PCF8563_WEEK_REG 0x06
#define PCF8563_MONTH_REG 0x07
#define PCF8563_YEAR_REG 0x08
#define PCF8563_ALARM_MINS_REG 0x09
#define PCF8563_ALARM_HOURS_REG 0x0A
#define PCF8563_ALARM_DAY_REG 0x0B
#define PCF8563_ALARM_WEEKDAY_REG 0x0C
#define PCF8563_CTRL_CLKOUT_REG 0x0D
#define PCF8563_CTRL_TIMER_REG 0x0E
#define PCF8563_TIMER_REG 0x0F
// Commands for the Control/Status register.
#define PCF8563_START_COUNTING 0x08
#define PCF8563_STOP_COUNTING 0x28
//************************************* for Set_Alarm()
#define PCF8563_Alarm_off 0x00
#define PCF8563_M_Mode 0x01
#define PCF8563_MH_Mode 0x04
#define PCF8563_MHW_Mode 0x07
#define PCF8563_MHD_Mode 0x0B
//************************************* for config_CLKOUT()
#define PCF8563_CLKOUT_off 0x00
#define PCF8563_CLKOUT_32KHz 0x80
#define PCF8563_CLKOUT_1KHz 0x81
#define PCF8563_CLKOUT_32Hz 0x82
#define PCF8563_CLKOUT_1Hz 0x83
//************************************* for config_PCF8563_Timer()
#define PCF8563_Timer_off 0x00
#define PCF8563_Timer_4KHz 0x80
#define PCF8563_Timer_64Hz 0x81
#define PCF8563_Timer_1Hz 0x82
#define PCF8563_Timer_1_60Hz 0x83
//************************************* for config_PCF8563_Interrupt()
#define Alarm_Interrupt_Enable 0x01
#define Timer_Interrupt_Enable 0x02
#define A_T_Interrupt_Enable 0x03
#define Timer_INT_Pulse_on 0x10
#define Timer_INT_Pulse_off 0x00
char const weekday_names[7][10] =
{
{"Sunday"},
{"Monday"},
{"Tuesday"},
{"Wednesday"},
{"Thursday"},
{"Friday"},
{"Saturday"}
};
// This structure defines the user's date and time data.
// The values are stored as unsigned integers. The user
// should declare a structure of this type in the application
// program. Then the address of the structure should be
// passed to the PCF8563 read/write functions in this
// driver, whenever you want to talk to the chip.
typedef struct
{
int8 seconds; // 0 to 59
int8 minutes; // 0 to 59
int8 hours; // 0 to 23 (24-hour time)
int8 day; // 1 to 31
int8 weekday; // 0 = Sunday, 1 = Monday, etc.
int8 month; // 1 to 12
int8 year; // 00 to 99
}date_time_t;
typedef struct
{
int8 minutes; // 0 to 59
int8 hours; // 0 to 23 (24-hour time)
int8 day; // 1 to 31
int8 weekday; // 0 = Sunday, 1 = Monday, etc.
}PCF8563_Alarm;
int8 LV_sec,C_Mon;
#bit LowVoltage = LV_sec.7
#bit Century = C_Mon.7
//----------------------------------------------
void PCF8563_write_byte(int8 address, int8 data)
{
disable_interrupts(GLOBAL);
i2c_start();
i2c_write(PCF8563_WRITE_ADDRESS);
i2c_write(address);
i2c_write(data);
i2c_stop();
enable_interrupts(GLOBAL);
}
//----------------------------------------------
int8 PCF8563_read_byte(int8 address)
{
int8 retval;
disable_interrupts(GLOBAL);
i2c_start();
i2c_write(PCF8563_WRITE_ADDRESS);
i2c_write(address);
i2c_start();
i2c_write(PCF8563_READ_ADDRESS);
retval = i2c_read(0);
i2c_stop();
enable_interrupts(GLOBAL);
return(retval);
}
//----------------------------------------------
// PCF8563 Initial //
void PCF8563_init(void)
{
PCF8563_write_byte(PCF8563_CTRL_STATUS_REG1,PCF8563_START_COUNTING);
}
//----------------------------------------------
// This function converts an 8 bit binary value
// to an 8 bit BCD value.
// The input range must be from 0 to 99.
int8 bin2bcd(int8 value)
{
char retval;
retval = 0;
while(1)
{
// Get the tens digit by doing multiple subtraction
// of 10 from the binary value.
if(value >= 10)
{
value -= 10;
retval += 0x10;
}
else // Get the ones digit by adding the remainder.
{
retval += value;
break;
}
}
return(retval);
}
//----------------------------------------------
// This function converts an 8 bit BCD value to
// an 8 bit binary value.
// The input range must be from 00 to 99.
char bcd2bin(char bcd_value)
{
char temp;
temp = bcd_value;
// Shifting the upper digit right by 1 is
// the same as multiplying it by 8.
temp >>= 1;
// Isolate the bits for the upper digit.
temp &= 0x78;
// Now return: (Tens * 8) + (Tens * 2) + Ones
return(temp + (temp >> 2) + (bcd_value & 0x0f));
}
//----------------------------------------------
//----------------------------------------------
void PCF8563_set_datetime(date_time_t *dt)
{
int8 bcd_sec;
int8 bcd_min;
int8 bcd_hrs;
int8 bcd_day;
int8 bcd_mon;
int8 bcd_yer;
int8 wek;
// Convert the input date/time into BCD values
// that are formatted for the PCF8563 registers.
bcd_sec = bin2bcd(dt->seconds);
bcd_min = bin2bcd(dt->minutes);
bcd_hrs = bin2bcd(dt->hours);
bcd_day = bin2bcd(dt->day) | (dt->year << 6);
bcd_mon = bin2bcd(dt->month) | (dt->weekday << 5);
bcd_yer = bin2bcd(dt->year);
wek = dt->weekday;
// Stop the RTC from counting, before we write to
// the date and time registers.
PCF8563_write_byte(PCF8563_CTRL_STATUS_REG1,PCF8563_STOP_COUNTING);
// Write to the date and time registers. Disable interrupts
// so they can't disrupt the i2c operations.
disable_interrupts(GLOBAL);
i2c_start();
i2c_write(PCF8563_WRITE_ADDRESS);
i2c_write(PCF8563_SECONDS_REG); // Start at seconds reg.
i2c_write(bcd_sec);
i2c_write(bcd_min);
i2c_write(bcd_hrs);
i2c_write(bcd_day);
i2c_write(wek);
i2c_write(bcd_mon);
i2c_write(bcd_yer);
i2c_stop();
enable_interrupts(GLOBAL);
// Now allow the PCF8563 to start counting again.
PCF8563_write_byte(PCF8563_CTRL_STATUS_REG1,PCF8563_START_COUNTING);
}
//----------------------------------------------
//----------------------------------------------
// Read the Date and Time from the hardware registers
// in the PCF8563. We don't have to disable counting
// during read operations, because according to the data
// sheet, if any of the lower registers (1 to 7) is read,
// all of them are loaded into "capture" registers.
// All further reading within that cycle is done from
// those registers.
void PCF8563_read_datetime(date_time_t *dt)
{
int8 bcd_sec;
int8 bcd_min;
int8 bcd_hrs;
int8 bcd_day;
int8 wek;
int8 bcd_mon;
int8 bcd_yer;
// LowVoltage = VL_sec.7
// Century = C_Mon.7
// Disable interrupts so the i2c process is not disrupted.
disable_interrupts(GLOBAL);
// Read the date/time registers inside the PCF8563.
i2c_start();
i2c_write(PCF8563_WRITE_ADDRESS);
i2c_write(PCF8563_SECONDS_REG); // Start at seconds reg.
i2c_start();
i2c_write(PCF8563_READ_ADDRESS);
LV_sec = i2c_read();
bcd_min = i2c_read();
bcd_hrs = i2c_read();
bcd_day = i2c_read();
wek = i2c_read();
C_Mon = i2c_read();
bcd_yer = i2c_read(0);
i2c_stop();
enable_interrupts(GLOBAL);
// Convert the date/time values from BCD to
// unsigned 8-bit integers. Unpack the bits
// in the PCF8563 registers where required.
bcd_sec = LV_sec & 0x7F;
bcd_mon = C_Mon & 0x7F;
dt->seconds = bcd2bin(bcd_sec);
dt->minutes = bcd2bin(bcd_min);
dt->hours = bcd2bin(bcd_hrs & 0x3F);
dt->day = bcd2bin(bcd_day & 0x3F);
dt->month = bcd2bin(bcd_mon & 0x1F);
dt->weekday = wek & 0x07;
dt->year = bcd2bin(bcd_yer);
}
//----------------------------------------------
void Set_Alarm(int8 AMode)
{
if (AMode == 0x00)
{
disable_interrupts(GLOBAL);
i2c_start();
i2c_write(PCF8563_WRITE_ADDRESS);
i2c_write(PCF8563_ALARM_MINS_REG); // Start at alarm min reg.
i2c_write(0x80);
i2c_write(0x80);
i2c_write(0x80);
i2c_write(0x80);
i2c_stop();
enable_interrupts(GLOBAL);
}
}
void Set_Alarm(int8 AMode,PCF8563_Alarm *AT)
{
int8 min = 0x80;
int8 hrs = 0x80;
int8 day = 0x80;
int8 wek = 0x80;
switch (AMode){
case 0x01: min = AT->minutes;
break;
case 0x04: min = AT->minutes;
hrs = AT->hours;
break;
case 0x07: min = AT->minutes;
hrs = AT->hours;
wek = AT->weekday;
break;
case 0x0B: min = AT->minutes;
hrs = AT->hours;
day = AT->day;
break;
}
disable_interrupts(GLOBAL);
i2c_start();
i2c_write(PCF8563_WRITE_ADDRESS);
i2c_write(PCF8563_ALARM_MINS_REG); // Start at alarm min reg.
i2c_write(min);
i2c_write(hrs);
i2c_write(day);
i2c_write(wek);
i2c_stop();
enable_interrupts(GLOBAL);
}
//----------------------------------------------
void config_CLKOUT(int8 mode)
{
PCF8563_write_byte(PCF8563_CTRL_CLKOUT_REG, mode);
}
//----------------------------------------------
void config_PCF8563_Timer(int8 mode)
{
PCF8563_write_byte(PCF8563_CTRL_TIMER_REG, mode);
}
//----------------------------------------------
void config_PCF8563_Interrupt(int8 mode,ti_tp)
{
mode = mode | ti_tp;
PCF8563_write_byte(PCF8563_CTRL_STATUS_REG2, mode);
}
//----------------------------------------------
| and 1wire.c is: Code: | // (C) copyright 2003 j.d.sandoz / jds-pic !at! losdos.dyndns.org
// released under the GNU GENERAL PUBLIC LICENSE (GPL)
// refer to http://www.gnu.org/licenses/gpl.txt
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/***********************1Wire Class***********************/
/*Description: This class handles all communication */
/* between the processor and the 1wire */
/* sensors.
/*********************************************************/
/*-------1-wire definitions-------*/
#define ONE_WIRE_PIN PIN_C5
/*******************1-wire communication functions********************/
/************onewire_reset*************************************************/
/*This function initiates the 1wire bus */
/* */
/*PARAMETERS: */
/*RETURNS: */
/*********************************************************************/
void onewire_reset() // OK if just using a single permanently connected device
{
output_low(ONE_WIRE_PIN);
delay_us( 500 ); // pull 1-wire low for reset pulse
output_float(ONE_WIRE_PIN); // float 1-wire high
delay_us( 500 ); // wait-out remaining initialisation window.
output_float(ONE_WIRE_PIN);
}
/*********************** onewire_write() ********************************/
/*This function writes a byte to the sensor.*/
/* */
/*Parameters: byte - the byte to be written to the 1-wire */
/*Returns: */
/*********************************************************************/
void onewire_write(int data)
{
int count;
for (count=0; count<8; ++count)
{
output_low(ONE_WIRE_PIN);
delay_us( 2 ); // pull 1-wire low to initiate write time-slot.
output_bit(ONE_WIRE_PIN, shift_right(&data,1,0)); // set output bit on 1-wire
delay_us( 60 ); // wait until end of write slot.
output_float(ONE_WIRE_PIN); // set 1-wire high again,
delay_us( 2 ); // for more than 1us minimum.
}
}
/*********************** read1wire() *********************************/
/*This function reads the 8 -bit data via the 1-wire sensor. */
/* */
/*Parameters: */
/*Returns: 8-bit (1-byte) data from sensor */
/*********************************************************************/
int onewire_read()
{
int count, data;
for (count=0; count<8; ++count)
{
output_low(ONE_WIRE_PIN);
delay_us( 2 ); // pull 1-wire low to initiate read time-slot.
output_float(ONE_WIRE_PIN); // now let 1-wire float high,
delay_us( 8 ); // let device state stabilise,
shift_right(&data,1,input(ONE_WIRE_PIN)); // and load result.
delay_us( 120 ); // wait until end of read slot.
}
return( data );
} |
and ds1820.c is : Code: |
float ds1820_read()
{
int8 busy=0, temp1, temp2;
signed int16 temp3;
float result;
disable_interrupts(GLOBAL);
onewire_reset();
onewire_write(0xCC);
onewire_write(0x44);
while (busy == 0)
busy = onewire_read();
onewire_reset();
onewire_write(0xCC);
onewire_write(0xBE);
temp1 = onewire_read();
temp2 = onewire_read();
temp3 = make16(temp2, temp1);
enable_interrupts(GLOBAL);
result = (float) temp3 / 2.0; //Calculation for DS18S20 with 0.5 deg C resolution
// result = (float) temp3 / 16.0; //Calculation for DS18B20 with 0.1 deg C resolution
delay_ms(200);
return(result);
} |
and functions.c is: Code: |
//---------------------------------------------------
// command_out set definition
#define Ready_To_recive 0x00
#define Ready_To_send 0xFF
#define I_Am_Ready 0x3C
// #define In_Temperature_Reng_Count 0x00
// #define Hi_Temperature_Limit 0x01
// #define Lo_Temperature_Limit 0x03
// #define Period_Time_reg 0x07
// -------------------------------------------------
void test(unsigned int8 cnt)
{
for(cnt=cnt;cnt=0;cnt--)
{
output_high(PIN_A4);
delay_ms( 500 );
output_low(PIN_A4);
delay_ms( 500 );
}
}
//--------------------------------------------------
void calculate_Alarm_Time(Void)
{
Time.minutes = Time.minutes + Time_Period;
for (Time.minutes = Time.minutes ; Time.minutes < 60 ; Time.minutes = Time.minutes - 60 ) {
Time.hours++;
}
for( Time.hours = Time.hours ; Time.hours<24 ;Time.hours = Time.hours - 24 ) {
Time.day++;
Time.weekday++;
}
for ( Time.weekday = Time.weekday ; Time.weekday < 6 ;Time.weekday = Time.weekday - 6 ) Time.weekday = Time.weekday - 6;
if (( !Century ) & ( Time.day > 30 )) Time.day = Time.day - 30 ;
If (( Century ) & ( Time.day > 31 )) Time.day = Time.day - 31 ;
AlarmTime.minutes = Time.minutes ;
Alarmtime.hours = Time.hours ;
Alarmtime.day = Time.day ;
Alarmtime.weekday = Time.weekday ;
}
//--------------------------------------------------
void correct_Date_and_Time(void)
{
disable_interrupts(GLOBAL);
putc(Ready_To_recive);
delay_us(50);
Time.seconds = getc();
Time.minutes = getc();
Time.hours = getc();
Time.day = getc();
Time.weekday = getc();
Time.month = getc();
Time.year = getc();
PCF8563_set_datetime(*t);
calculate_Alarm_Time();
Set_Alarm(PCF8563_MHD_Mode,ALT);
config_PCF8563_Interrupt(Alarm_Interrupt_Enable,Timer_INT_Pulse_off);
enable_interrupts(GLOBAL);
}
//--------------------------------------------------
void Report_Present_DT(void)
{
disable_interrupts(GLOBAL);
PCF8563_read_datetime( *t );
putc(Ready_To_send);
delay_us(50);
putc(Time.seconds);
putc(Time.minutes);
putc(Time.hours);
putc(Time.day);
putc(Time.weekday);
putc(Time.month);
putc(Time.year);
enable_interrupts(GLOBAL);
}
//--------------------------------------------------
void report_Temp_Limits(void)
{
disable_interrupts(GLOBAL);
Lo_limit_Temp = read_eeprom(Lo_Temperature_Limit);
Hi_limit_Temp = read_eeprom(Hi_Temperature_Limit);
putc(Ready_To_send);
delay_us(50);
putc(Lo_limit_Temp);
Putc(Hi_limit_Temp);
enable_interrupts(GLOBAL);
}
//--------------------------------------------------
void correct_Temp_Limits(Void)
{
disable_interrupts(GLOBAL);
putc(Ready_To_recive);
delay_us(50);
Lo_limit_Temp = getc();
Hi_limit_Temp = getc();
write_eeprom(Lo_Temperature_Limit,Lo_limit_Temp);
write_eeprom(Hi_Temperature_Limit,Hi_limit_Temp);
enable_interrupts(GLOBAL);
}
//--------------------------------------------------
void report_Time_Period(void)
{
disable_interrupts(GLOBAL);
Time_Period = read_eeprom(Period_Time_reg);
putc(Ready_To_send);
delay_us(50);
putc(Time_Period);
enable_interrupts(GLOBAL);
}
//--------------------------------------------------
void correct_Time_Period(void)
{
disable_interrupts(GLOBAL);
putc(Ready_To_recive);
delay_us(50);
Time_Period = getc();
write_eeprom(Period_Time_reg,Time_Period);
enable_interrupts(GLOBAL);
}
//--------------------------------------------------
void Temp_count_report(void)
{
disable_interrupts(GLOBAL);
counter = read_eeprom(Temperature_In_Reng_Count);
putc(Ready_To_send);
delay_us(50);
putc(counter);
enable_interrupts(GLOBAL);
}
//--------------------------------------------------
void I_ready(void)
{
disable_interrupts(GLOBAL);
putc( I_Am_Ready );
enable_interrupts(GLOBAL);
}
//--------------------------------------------------
void reset_Temperature_Counter(void)
{
disable_interrupts(GLOBAL);
write_eeprom(Temperature_In_Reng_Count,0x0000);
enable_interrupts(GLOBAL);
}
//--------------------------------------------------
|
Help me please to debug it.
Last edited by HGHK on Tue Oct 05, 2010 1:14 am; edited 1 time in total |
|