Xuecheng Xi | 1 Apr 2007 09:59
Picon

get channel number from real time thread function

Dear Developers,

I am writing a real time thread function in which I need to use the
channel number. Take pid.c as an example, the number of channel =
num_chan. For each channel, we have exported

calc_pid(void* arg, long period).

by using

 hal_export_funct(bu, calc_pid, &(pid_array[num]), 1, 0, comp_id).

My question is in the function of calc_pid(void* arg, long period),
how can I know for which channel I am doing the calculations. As from
the arguments (void* arg, long period), there is no information
regarding the number of channel.

regards
Xuecheng

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Alex Joni | 1 Apr 2007 10:25
Picon
Favicon

Re: get channel number from real time thread function

The idea is that you only pass the address of the current channel data 
structure:
    &(pid_array[num])

e.g. &(pid_array[0]) then &(pid_array[1]), etc

This way each function will only access it's own data.

If you need to access some other data then you need to pass 
&(pid_array), and handle the channel number in some other way.

Regards,
Alex

----- Original Message ----- 
From: "Xuecheng Xi" <xixuecheng@...>
To: "emc-developers" <emc-developers@...>
Sent: Sunday, April 01, 2007 10:59 AM
Subject: [Emc-developers] get channel number from real time thread 
function

> Dear Developers,
>
> I am writing a real time thread function in which I need to use the
> channel number. Take pid.c as an example, the number of channel =
> num_chan. For each channel, we have exported
>
> calc_pid(void* arg, long period).
>
> by using
(Continue reading)

John Kasunich | 1 Apr 2007 18:44

Re: get channel number from real time thread function

Xuecheng Xi wrote:
> Dear Developers,
> 
> I am writing a real time thread function in which I need to use the
> channel number. Take pid.c as an example, the number of channel =
> num_chan. For each channel, we have exported
> 
> calc_pid(void* arg, long period).
> 
> by using
> 
>  hal_export_funct(bu, calc_pid, &(pid_array[num]), 1, 0, comp_id).
> 
> My question is in the function of calc_pid(void* arg, long period),
> how can I know for which channel I am doing the calculations. As from
> the arguments (void* arg, long period), there is no information
> regarding the number of channel.
> 

pid_array is an array of structures, each with all the data needed for
a PID loop.  Each function gets a pointer to one structure with the
data it needs, and is unaware of the other structures.  If you are 
writing a HAL component, you are the one who defines that structure.
You can have any fields you want in that structure, not just HAL pins
and parameters.  (See stepgen for an example of a large struct with lots 
of data in it).  For your situation, you can add a "channel_num" field 
to the structure, and initialize it before you call export_funct during 
startup.

Regards,
(Continue reading)

Chris Morley | 3 Apr 2007 04:16
Picon
Favicon

Classicladder work


Greetings.

I have made some changes to classicladder that EMC2 may be interested in:

fixed the bug that crossed variable when entering compare/operate equations as well as allowing symbols to be entered for variable names.

I piggybacked HALs32-in pins on to 5 word variables - this could present a problem if previous programs used word variable- they would need to be edited to not use the 5 variable numbers But it does allow external s32 number into classicladder- such as tool numbers -greatly simplifing a tool changer.

I seperated the 5 lower variable edit boxes (in the VARS window) to another vars window ( for more room and the second window  shows 10 variables and the full symbol name can be read) and more importantly added a button to altenately hide/show the vars windows. The symbols button also now alternately shows/hides the symbols window. This aids in cleaning up the screen.

There are some other minor fixes.
 
I wonder what you think.
 
Oh I am Chris Morley. I am a machinist/millwright in B.C. Canada. I am interested in electronics and computers. I have been watching emc for about 2 years - very nice. I am just learning c programing- my last programing experience was a fairly sophisticated Dro in -don't laugh- Qbasic! using an ISA card I Put together from net instructions to count encoders. I am s l o w l y repairing/upgrading an CNC OKUMA shaft lathe with Twin hydraulic tools turrets to EMC. Thats my background. Cheers
 

Everyone Are Talking About!
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Emc-developers mailing list
Emc-developers@...
https://lists.sourceforge.net/lists/listinfo/emc-developers
Alex Joni | 3 Apr 2007 08:08
Picon
Favicon

Re: Classicladder work

Hi Chris,

how about sending a patch with the changes you made? Makes it easier to 
judge the code/ideas.
You can get one using (cvs diff -u > chris.patch), assuming you worked on a 
CVS checkout.

Best regards,
Alex

----- Original Message ----- 
From: Chris Morley
To: emc-developers@...
Sent: Tuesday, April 03, 2007 5:16 AM
Subject: [Emc-developers] Classicladder work

Greetings.
I have made some changes to classicladder that EMC2 may be interested in:
fixed the bug that crossed variable when entering compare/operate equations 
as well as allowing symbols to be entered for variable names.
I piggybacked HALs32-in pins on to 5 word variables - this could present a 
problem if previous programs used word variable- they would need to be 
edited to not use the 5 variable numbers But it does allow external s32 
number into classicladder- such as tool numbers -greatly simplifing a tool 
changer.
I seperated the 5 lower variable edit boxes (in the VARS window) to another 
vars window ( for more room and the second window  shows 10 variables and 
the full symbol name can be read) and more importantly added a button to 
altenately hide/show the vars windows. The symbols button also now 
alternately shows/hides the symbols window. This aids in cleaning up the 
screen.

There are some other minor fixes.

I wonder what you think.

Oh I am Chris Morley. I am a machinist/millwright in B.C. Canada. I am 
interested in electronics and computers. I have been watching emc for about 
2 years - very nice. I am just learning c programing- my last programing 
experience was a fairly sophisticated Dro in -don't laugh- Qbasic! using an 
ISA card I Put together from net instructions to count encoders. I am s l o 
w l y repairing/upgrading an CNC OKUMA shaft lathe with Twin hydraulic tools 
turrets to EMC. Thats my background. Cheers

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Chris Morley | 3 Apr 2007 11:08
Picon
Favicon

Classicladder patch

Hi Alex:

As you requested -a patch for my work on classicladder. Wished I knew how to 
do that before!
This patch also corrects the Vars display to toggle symbols/variable when 
the check box in the section display is changed.
You'll see lines uncommented so they will print- I wanted the info at the 
time of course I would change them back- actually my patch for 
compare/operate varsing prints alot of debug info still.
Hope it is close to your liking.

Chris 'Chester' Morley

_________________________________________________________________
Don’t waste time standing in line—try shopping online. Visit Sympatico / MSN 
Shopping today! http://shopping.sympatico.msn.ca
Attachment (chris.patch): text/x-patch, 27 KiB
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Emc-developers mailing list
Emc-developers@...
https://lists.sourceforge.net/lists/listinfo/emc-developers
Xuecheng Xi | 3 Apr 2007 17:30
Picon

Re: Emc-developers Digest, Vol 12, Issue 1

get channel number from real time thread  function

Dear Alex and John:

Many thanks for your suggestions. Finally, I came out with a solution.
As I only need the index of a channel, I don't want to change to data
structure. I made a few line in the function, I now can get the index
.

calc_pid(void* arg, long period){
pid=arg;
**********************
 for(i=0;i<num_chan;i++){
     if(pid == (pid_array+i)){
		chan = i;
		break;
	}
 }
***********************
}

regards
Xuecheng

> The idea is that you only pass the address of the current channel data
> structure:
>     &(pid_array[num])
>
> e.g. &(pid_array[0]) then &(pid_array[1]), etc
>
> This way each function will only access it's own data.
>
> If you need to access some other data then you need to pass
> &(pid_array), and handle the channel number in some other way.
>
> Regards,
> Alex
>

> pid_array is an array of structures, each with all the data needed for
> a PID loop.  Each function gets a pointer to one structure with the
> data it needs, and is unaware of the other structures.  If you are
> writing a HAL component, you are the one who defines that structure.
> You can have any fields you want in that structure, not just HAL pins
> and parameters.  (See stepgen for an example of a large struct with lots
> of data in it).  For your situation, you can add a "channel_num" field
> to the structure, and initialize it before you call export_funct during
> startup.
>
> Regards,
>
> John Kasunich
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
SourceForge.net | 4 Apr 2007 22:30
Picon
Favicon

[ emc-Bugs-1694548 ] Fix thread creation

Bugs item #1694548, was opened at 2007-04-04 22:30
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106744&aid=1694548&group_id=6744

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HAL
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Markus Elfring (elfring)
Assigned to: John Kasunich (jmkasunich)
Summary: Fix thread creation

Initial Comment:
I see the following source code in the file "socket_server.c" (lines 89-94).
"...
		Error =
		    pthread_create(&thread_socket_server, NULL,
		    (void *(*)(void *)) SocketServerTcpMainLoop,
		    (void *) NULL);
		if (Error == -1) {
		    printf("Failed to create thread socket server...\n");
..."

According to the POSIX specification, the check should be "if (Error)".
http://opengroup.org/onlinepubs/009695399/functions/pthread_create.html

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106744&aid=1694548&group_id=6744

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
SourceForge.net | 4 Apr 2007 22:37
Picon
Favicon

[ emc-Feature Requests-1694555 ] Complete build options for Pthread API

Feature Requests item #1694555, was opened at 2007-04-04 22:37
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=356744&aid=1694555&group_id=6744

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: EMC2 Build System
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Markus Elfring (elfring)
Assigned to: Nobody/Anonymous (nobody)
Summary: Complete build options for Pthread API

Initial Comment:
Would you like to improve your checks for this programming interface with the capabilities from the
configuration script "ACX_PTHREAD"?
http://ac-archive.sourceforge.net/ac-archive/acx_pthread.html

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=356744&aid=1694555&group_id=6744

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
张凤丽 | 5 Apr 2007 03:06
Picon

ask for the source code for axis GUI

hi,
i decide to make myslf GUI by refering to the axis GUI. so i am desired to obtain  the source code of it. where to download?
then i want to ask anther question, that is , how to simulate the motion path after interpolation? is it implemented using OpenGL?
any ideas? please let me know as soon as possible.
thank you in advance. 
 
Regards
fengli zhang
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Emc-developers mailing list
Emc-developers@...
https://lists.sourceforge.net/lists/listinfo/emc-developers

Gmane