Commit 04d8efa2 authored by Julio Tambara's avatar Julio Tambara
Browse files

Mudando a forma das estrutura de dados

Adicionado a classe graficos.
parent a5258ef3
import numpy as np
import Tkinter as tk
class Graficos:
limupdtx=True
limupdty=True
limupdt=True
limctrl=False
x0=0
y0=0
x1=512
y1=0
pressx=0.
pressy=0.
limtrans=False
dx=0.
dy=0.
Nmr_serial= None
def __init__(self, Nmr):
self.Nmr_serial= Nmr
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
# **************************************************************** # ****************************************************************
# Lines starting with # (first column) are comments # Lines starting with # (first column) are comments
#
# The board number
BOARD_NUM 1
# path to the executable file of gnuplot # path to the executable file of gnuplot
GNUPLOT_PATH "" GNUPLOT_PATH ""
...@@ -14,9 +11,6 @@ GNUPLOT_PATH "" ...@@ -14,9 +11,6 @@ GNUPLOT_PATH ""
# Save readout data into the Output File (0=don't save) # Save readout data into the Output File (0=don't save)
LOG_TO_FILE 1 LOG_TO_FILE 1
#
# Readout data Output Filename ( meaningful only for LOG_TO_FILE!= 0)
#LOG_FILENAME "data.log"
# #
# Maximum number of samples to acquire (-1 means no limit) # Maximum number of samples to acquire (-1 means no limit)
...@@ -38,13 +32,6 @@ ACQ_MODE 1 ...@@ -38,13 +32,6 @@ ACQ_MODE 1
# LLD Threshold value [00..99] # LLD Threshold value [00..99]
LLD_THR_VAL 30 LLD_THR_VAL 30
#
# Gnu plot refresh rate (msec)
#GNU_PLOT_REFRESH 2000
#
# Gnu plot X scale factor
#GNU_PLOT_X_SCALE 0.3
...@@ -53,4 +40,3 @@ LLD_THR_VAL 30 ...@@ -53,4 +40,3 @@ LLD_THR_VAL 30
...@@ -36,6 +36,8 @@ const char* HISTO_FILENAME= "histo.dat"; ...@@ -36,6 +36,8 @@ const char* HISTO_FILENAME= "histo.dat";
// Global visible variables declaration // Global visible variables declaration
//////////////////////////////////////////// ////////////////////////////////////////////
//////////////////////////////////////////// ////////////////////////////////////////////
// File local methods declaration // File local methods declaration
//////////////////////////////////////////// ////////////////////////////////////////////
...@@ -58,8 +60,11 @@ const char* HISTO_FILENAME= "histo.dat"; ...@@ -58,8 +60,11 @@ const char* HISTO_FILENAME= "histo.dat";
************************************************************************************************/ ************************************************************************************************/
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int w; int w;
unsigned int histograma[8192]; unsigned int histograma[8192];
unsigned int temp = 0, lldt=10; unsigned int temp = 0, lldt=10;
...@@ -69,7 +74,9 @@ int main(int argc, char **argv) ...@@ -69,7 +74,9 @@ int main(int argc, char **argv)
FILE* log; FILE* log;
short int fator = 1; short int fator = 1;
N957_UINT32 data32; N957_UINT32 data32;
int ret_val= 0; // procedure exit value int ret_val= 0;
N957_ConfigROM ROM;
// procedure exit value
user_setting_data user_setting; // user settings user_setting_data user_setting; // user settings
N957_UINT16 *data_buff= NULL; // read data buffer N957_UINT16 *data_buff= NULL; // read data buffer
unsigned long *histo_buff= NULL; // Histogram data buffer unsigned long *histo_buff= NULL; // Histogram data buffer
...@@ -81,6 +88,8 @@ int main(int argc, char **argv) ...@@ -81,6 +88,8 @@ int main(int argc, char **argv)
BOOL start=FALSE; BOOL start=FALSE;
BOOL erro_9=FALSE; BOOL erro_9=FALSE;
for(w=0; w<8192; w++) for(w=0; w<8192; w++)
histograma[w] = 0; histograma[w] = 0;
...@@ -89,6 +98,11 @@ int main(int argc, char **argv) ...@@ -89,6 +98,11 @@ int main(int argc, char **argv)
///////////////////////////////////////// /////////////////////////////////////////
memset( &user_setting, 0, sizeof( user_setting)); memset( &user_setting, 0, sizeof( user_setting));
if((argc+'0')>= 2)
user_setting.m_bd_num= atoi(argv[1]);
else
user_setting.m_bd_num=0; // tem problemas "falha de segmentação", mas eu n to usando.
// init user setting module // init user setting module
...@@ -157,6 +171,9 @@ int main(int argc, char **argv) ...@@ -157,6 +171,9 @@ int main(int argc, char **argv)
} }
if( kbhit()) { if( kbhit()) {
switch( getch()) { switch( getch()) {
case 'q':
case 'Q':
goto exit_point;
case 's': case 's':
case 'S': case 'S':
/// input parameter check /// input parameter check
...@@ -353,9 +370,11 @@ int main(int argc, char **argv) ...@@ -353,9 +370,11 @@ int main(int argc, char **argv)
fclose(log); fclose(log);
break; break;
case 'k': case 'k':
TRACE("OK\n");
N957_GetConfigROM( user_setting.m_N957_handle, &ROM);
//N957_ConfigROM.m_board_id=1; TRACE1("%u \n" ,ROM.m_serial);
TRACE1("%u \n",'N957_ConfigROM.m_board_id');
break; break;
} }
......
This diff is collapsed.
...@@ -70,7 +70,7 @@ BOOL user_settings_open( user_setting_data* p_data) ...@@ -70,7 +70,7 @@ BOOL user_settings_open( user_setting_data* p_data)
p_data->m_mode= DEF_MODE; p_data->m_mode= DEF_MODE;
p_data->m_N957_handle= N957_INVALID_HANDLE_VALUE; p_data->m_N957_handle= N957_INVALID_HANDLE_VALUE;
p_data->m_log_to_file= N957_FALSE; p_data->m_log_to_file= N957_FALSE;
p_data->m_bd_num= 0; //p_data->m_bd_num;
return TRUE; return TRUE;
...@@ -146,7 +146,12 @@ BOOL parse_config_file( user_setting_data* p_data) { ...@@ -146,7 +146,12 @@ BOOL parse_config_file( user_setting_data* p_data) {
TRACE1("Can't open configuration file %s\n", p_data->m_config_filename); TRACE1("Can't open configuration file %s\n", p_data->m_config_filename);
return FALSE; return FALSE;
} }
//TRACE1("Reading Configuration File %s\n", p_data->m_config_filename); if( (N957_Init( (short)p_data->m_bd_num, &p_data->m_N957_handle)))
{
ret_val= FALSE;
goto exit_point;
}
while(!feof( p_conf_file)) { while(!feof( p_conf_file)) {
fscanf( p_conf_file, "%s", line); // read one string from the file fscanf( p_conf_file, "%s", line); // read one string from the file
str= trim( trim_space_charset, sizeof( trim_space_charset), line); str= trim( trim_space_charset, sizeof( trim_space_charset), line);
...@@ -154,20 +159,7 @@ BOOL parse_config_file( user_setting_data* p_data) { ...@@ -154,20 +159,7 @@ BOOL parse_config_file( user_setting_data* p_data) {
fgets( line, sizeof( line), p_conf_file); // skip the whole line (comment) fgets( line, sizeof( line), p_conf_file); // skip the whole line (comment)
continue; continue;
} }
// Open module
if (strstr(str, "BOARD_NUM")!=NULL) {
fscanf(p_conf_file, "%d", &p_data->m_bd_num);
//
// init caen N957 lib
if( (N957_Init( (short)p_data->m_bd_num, &p_data->m_N957_handle)))
{
ret_val= FALSE;
goto exit_point;
}
continue;
}
// Number of samples to acquire
if (strstr(str, "MAX_NUM_SAMPLES")!=NULL) { if (strstr(str, "MAX_NUM_SAMPLES")!=NULL) {
fscanf(p_conf_file, "%ld", &p_data->m_max_num_samples); fscanf(p_conf_file, "%ld", &p_data->m_max_num_samples);
continue; continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment