|
-
February 22nd, 2005, 09:39 AM
#5
Re: when using multithread function - error
That could be a problem with my class...
When I get the routine inside the function I am calling (send_1000long_pulse) from the ThreadFunc and put it direct inside the ThreadFunc it works well...??
I will send a peace of this class to see if someone finds something wrong...
[QUOTE]
...
using namespace std;
class Sb_Actel
{
public:
Sb_Actel(); //constructor
~Sb_Actel(); //destructor
bool send_25ns_pulse(int node_id, int i2c_ch, BYTE DAC_value);
bool send_long_pulse(int node_id);
bool send_1000long_pulse(int node_id);
bool send_40M_clk(int node_id);
bool send_clk(int node_id, int i2c_ch, int counter_nr, int *value);
bool select_swpulse_mode(int node_id);
bool select_sw_start_stop_mode(int node_id);
bool set_tmis_time_ms(int node_id, int time);
bool write_ADDR_PULSE(int node_id);
private:
BYTE data[4];
int index_actel;
BYTE can_msg_cnf[4];
};
Sb_Actel::Sb_Actel() //constructor
{
//initialize variables
index_actel = 0x4700;
data[0] = 0;
data[1] = 0;
data[2] = 0;
data[3] = 0;
}
Sb_Actel::~Sb_Actel() //destructor
{
}
bool Sb_Actel::send_1000long_pulse(int node_id)
{
int i;
data[0]=SW_PULSE;
if(!COP_WriteSDO (CanInterface, node_id, 1, index_actel, ADDR_INT_PULSE_SEL, 1, data,can_msg_cnf)) return FALSE;
data[0]=REG_PULSE;
if(!COP_WriteSDO (CanInterface, node_id, 1, index_actel, ADDR_TEST_PULSE_SEL, 1, data,can_msg_cnf)) return FALSE;
data[0]=0x0;
if(!COP_WriteSDO (CanInterface, node_id, 1, index_actel, ADDR_PULSE, 1, data,can_msg_cnf)) return FALSE;
for(i=0; i<=99;i++) //here is where I have the problem...
{
data[0]=0x1;
if(!COP_WriteSDO (CanInterface, node_id, 1, index_actel, ADDR_PULSE, 1, data,can_msg_cnf)) return FALSE;
data[0]=0x0;
if(!COP_WriteSDO (CanInterface, node_id, 1, index_actel, ADDR_PULSE, 1, data,can_msg_cnf)) return FALSE;
}
return TRUE;
}
...
[QUOTE]
Last edited by rafraf; February 22nd, 2005 at 09:41 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|