00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00017
00018
00019
00020 #if !defined(AFX_SGTRAMAS_H__AD299BBA_1108_4944_A6AF_27D2C8D5D594__INCLUDED_)
00021 #define AFX_SGTRAMAS_H__AD299BBA_1108_4944_A6AF_27D2C8D5D594__INCLUDED_
00022
00023 #if _MSC_VER > 1000
00024 #pragma once
00025 #endif // _MSC_VER > 1000
00026
00027 #include "Serial.h"
00028
00029 #define TIMEOUT 100
00030
00031
00032 #define TRAMA_PING_IT 0x00
00033 #define TRAMA_PONG_IT 0x10
00034 #define TRAMA_ID_IT 0x01
00035 #define TRAMA_RID_IT 0x11
00036 #define TRAMA_LOAD_IT 0x02
00037 #define TRAMA_RLOAD_IT 0x12
00038 #define TRAMA_STORE_IT 0x03
00039 #define TRAMA_RSTORE_IT 0x13
00040 #define TRAMA_UNKNOW_IT 0xFF // Trama desconocida
00041
00042
00043 #define TRAMA_PING_CAB 'P'
00044 #define TRAMA_ID_CAB 'I'
00045 #define TRAMA_RID_CAB 'I'
00046 #define TRAMA_PONG_CAB 'O'
00047 #define TRAMA_LOAD_CAB 'L'
00048 #define TRAMA_RLOAD_CAB 'L'
00049 #define TRAMA_STORE_CAB 'S'
00050 #define TRAMA_RSTORE_CAB 'S'
00051
00052
00053 #define TRAMA_RD_CAB 'R'
00054 #define TRAMA_RRD_CAB 'R'
00055 #define TRAMA_INC_CAB 'A'
00056 #define TRAMA_RINC_CAB 'A'
00057 #define TRAMA_CONF_CAB 'C'
00058 #define TRAMA_RCONF_CAB 'C'
00059 #define TRAMA_PROG_CAB 'W'
00060 #define TRAMA_RPROG_CAB 'W'
00061 #define TRAMA_RST_CAB 'T'
00062 #define TRAMA_RRST_CAB 'T'
00063 #define TRAMA_DATA_CAB 'D'
00064 #define TRAMA_RDATA_CAB 'D'
00065 #define TRAMA_BEGIN_CAB 'B'
00066 #define TRAMA_RBEG_CAB 'B'
00067
00068 #define TRAMA_SBORRAR_CAB 'X'
00069 #define TRAMA_RBORRAR_CAB 'X'
00070 #define TRAMA_SENDP_CAB 'E'
00071 #define TRAMA_RENDP_CAB 'E'
00072 #define TRAMA_SPROG_BLOQUE 'K'
00073 #define TRAMA_RPROG_BLOQUE 'K'
00074
00075
00076 #define TRAMA_RDEE_CAB 'V'
00077 #define TRAMA_RRDEE_CAB 'V'
00078 #define TRAMA_LEE_CAB 'W'
00079 #define TRAMA_RLEE_CAB 'W'
00080
00081
00082
00083
00084 #define SG_NULL 0x10
00085 #define SG_GENERIC 0x20
00086 #define SG_SERVOS8 0x30
00087 #define SG_PICP 0x40
00088
00089
00090
00091
00092 #define SG_NULL_CAD "NULL"
00093 #define SG_GENERIC_CAD "GENERIC"
00094 #define SG_SERVOS8_CAD "SERVOS8"
00095 #define SG_PICP_CAD "PICP"
00096
00097
00098
00099
00100 #define MICRO_68HC11E2 0x10
00101 #define MICRO_68HC08 0x20
00102 #define MICRO_PIC16F876 0x30
00103 #define MICRO_PIC16F877A 0x40
00104 #define MICRO_PIC16F84A 0x50
00105
00106
00107
00108
00109 #define MICRO_68HC11E2_CAD "68HC11E2"
00110 #define MICRO_68HC08_CAD "68HC08"
00111 #define MICRO_PIC16F876_CAD "P16F876"
00112 #define MICRO_PIC16F877A_CAD "P16F877A"
00113
00114
00115
00116 #define PLACA_XPROGRAMMER 0x601
00117 #define PLACA_XPIC 0x501
00118 #define PLACA_CT6811 0x101
00119 #define PLACA_GPBOT 0x201
00120 #define PLACA_SKYPIC 0x301
00121
00122
00123
00124
00125 #define PLACA_XPIC_CAD "X-PIC"
00126 #define PLACA_XPROG_CAD "X-PROGRAMMER"
00127 #define PLACA_CT6811_CAD "CT6811"
00128 #define PLACA_GPBOT_CAD "GPBOT"
00129 #define PLACA_USER_CAD "USER"
00130 #define PLACA_SKYPIC_CAD "SKYPIC"
00131
00132 class CSGTramas : public CSerial
00133 {
00134 public:
00135 CSGTramas();
00136 virtual ~CSGTramas();
00137 int SGReset();
00138 int SGIncrementAddress();
00139 int SGReadData(int *);
00140 int SGLoadConfig();
00141 int SGProg(int );
00142 int SGLoadData(int );
00143 int SGBeginPEC();
00144 int SGEndp();
00145 int SGBorrarPic();
00146 int SGProgBloque(int *);
00147 int SGStore(int , int );
00148 int SGLoad(int , int *);
00149 int SGPing();
00150 int SGLoadDataEE(int);
00151 int SGReadDataEE(int *);
00152 int SGId(unsigned char *is, unsigned char *im, unsigned char *ipv);
00153 void SGTramasIPVtoString(unsigned char im, unsigned char ipv, char *);
00154 void SGTramasIMtoString(unsigned char im, char *);
00155 void SGTramasIStoString(unsigned char is, char *);
00156
00157 };
00158
00159 #endif // !defined(AFX_SGTRAMAS_H__AD299BBA_1108_4944_A6AF_27D2C8D5D594__INCLUDED_)