View Single Post
Old 01-03-16, 02:22 PM   #18
Acuario
Apprentice EcoRenovator
 
Join Date: May 2011
Location: Tortosa, Spain
Posts: 221
Thanks: 2
Thanked 81 Times in 46 Posts
Default

4. BAC1000.h - header file for BAC1000 thermometer

#pragma once
#ifndef _BAC1000_h
#define _BAC1000_h

//RS485 settings
#define RS485TxControl 10 //RS485 Direction control
#define RS485Transmit HIGH
#define RS485Receive LOW
#define RS485Serial Serial1


//Commands
#define READALL 0xa0 //Read all data from thermostat
#define TRANSMITALL 0xa1 //Send all data to thermostat
#define POWERONOFF 0xa2 //Power on/off
#define FANSPEED 0x03 //Control fan speed relays
#define MODESETTING 0xa4 //Mode setting
#define KEYLOCK 0xa5 //Lock/unlock keypad
#define TEMPSETTING 0xa6 //Set desired temperature
#define TEMPCALIB 0xa7 //Temperature calibration
#define SETTIME 0xa8 //Set thermostat clock
#define AUTOMANUAL 0xa9 //Manual/auto programmable
#define DATAACK 0x50 //Command accepted ok

//Masks for status
#define UNITONOFF 0x10 //Unit on - 1, off - 0
#define HEATCOOL 0x60 //Operation mode - 00 - Cooling, 01 - Heating, 10 - Ventilation
#define FANS 0x03 //Fan speed - 00 - Auto, 01 - High, 10 - Medium, 11 - Low
#define POWERON 0x10 //Power unit on, power off with 00

int bacRoomTemp;
int bacSetTemp;
bool powerStateBAC;
int operatingModeBAC;
const char* mode[] = { "Cool", "Heat", "Ventilate" };
bool BACRead = FALSE;
bool waitRead = FALSE;
bool sendBAC1000Command(int bacCmd, int idl, int idh, int data1, int data2, int data3, int data4);

#endif
Acuario is offline   Reply With Quote