GQ Electronics Technical Support Forum Active Users: / Visits Today:
Highest Active Users:
GQ Electronics Technical Support Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 GQ Electronics Forums
 3. GQ EMF EF Meter RF Spectrum Power Analyzer
 Code for Output of data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

moeknows164

USA
4 Posts

Posted - 06/22/2020 :  02:44:03  Show Profile  Reply with Quote
Is it possible to get a copy of the code how the data is sent to Excel

RAStaszak
Reply #1

EmfDev

2250 Posts

Posted - 06/22/2020 :  09:53:00  Show Profile  Reply with Quote
Hi moeknows164, is it for the history data? or for the graph data?
Go to Top of Page
Reply #2

moeknows164

USA
4 Posts

Posted - 06/22/2020 :  19:45:43  Show Profile  Reply with Quote
It is for the history data

RAStaszak
Go to Top of Page
Reply #3

EmfDev

2250 Posts

Posted - 06/23/2020 :  09:47:23  Show Profile  Reply with Quote
First you have to use the SPIR command to fetch the raw data from the unit. The end of the data can be regcognized by 0xFF 0xFF means no data in there.

after fetching the data you have to decode.

code is something like this

typedef union floatUnionT {
float f;
unsigned char uc[4];
}floatUnionT;
floatUnionT emf, ef, rf;
for(unsigned long i = 0; i < END_OF_DATA; )
{
unsigned char byte1 = DATA[i++];
unsigned char byte2 = DATA[i++];
if((byte1 == 0x55) && (byte2 == 0xAA)) // time
{
unsigned char time[6];
for(int j = 0; j < 6; j++) time[j] = DATA[i++];
}
else if((byte1 == 0xAA) && (byte2 == 0x55)) // data
{
unsigned char byte3 = DATA[i++];
unsigned char byte4 = DATA[i++];
unsigned int temp = ((unsigned int) byte3 << 8) | byte4;
unsigned int emf_int = (temp >> 4) & 0x0FFF;
unsigned char emf_dec = temp & 0x0F;
emf.f = (emf_int + emf_dec/10); // emf.f is emf float

ef.uc[0] = DATA[i++];
ef.uc[1] = DATA[i++];
ef.uc[2] = DATA[i++];
ef.uc[3] = DATA[i++];

rf.uc[0] = DATA[i++];
rf.uc[1] = DATA[i++];
rf.uc[2] = DATA[i++];
rf.uc[3] = DATA[i++];

float mwm2 = rf.f/100000;
float mwcm2 = rf.f/1000000000;

// Possible Source
char sbuf[16];
memset(sbuf,0,16);
if(DATA[i] == 0x5A)
{
unsigned char s = DATA[i+1];
i+=2;
if(s == 0) sprintf(sbuf, "---");
else if(s == 1) sprintf(sbuf, "Smart Meter");
else if(s == 2) sprintf(sbuf, "Cell Tower");
else if(s == 3) sprintf(sbuf, "Microwave");
else if(s == 4) sprintf(sbuf, "WiFi/Phone");
else if(s == 5) sprintf(sbuf, "Static");
else if(s == 6) sprintf(sbuf, "AC EF");
else if(s == 7) sprintf(sbuf, "Power Line");
else sprintf(sbuf, "Mixed");
}
Go to Top of Page
Reply #4

mserdag

Argentina
8 Posts

Posted - 01/18/2024 :  05:40:35  Show Profile  Reply with Quote
Hi, i copy this code and translate to python, the only thing is that the code

ef.uc[0] = DATA[i++];
ef.uc[1] = DATA[i++];
ef.uc[2] = DATA[i++];
ef.uc[3] = DATA[i++];

rf.uc[0] = DATA[i++];
rf.uc[1] = DATA[i++];
rf.uc[2] = DATA[i++];
rf.uc[3] = DATA[i++];

is not the same result that when i use your software, the rest of all, i read the same data, what i do wrong?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
GQ Electronics Technical Support Forum © Copyright since 2011 Go To Top Of Page
Generated in 0.12 sec. Snitz's Forums 2000