signals

signal generation model in Simulink from matlab

不想你离开。 提交于 2019-12-13 09:17:45
问题 How do I generate following signal in simulink: t=(0:1000)/1000*10*pi; I want to build the model of the following matlab code: t=(0:1000)/1000*10*pi; x = (t).*sin(t); y = (t).*cos(t); z = t; 回答1: This is fairly basic stuff. Have you gone through any Simulink tutorial, introduction videos/webinars or even the getting started guide of the documentation? Here are a few suggestions to help you answer your question: Set the stop time of your model to 1000s and use a fixed-step solver with a step

Qt: Connecting signals and slots

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 08:37:45
问题 I have a MainWindow that contains a custom widget with a QTextEdit in it. I would like to create a signal/slot between the MainWindow and the QTextEdit . In MainWindow I have: QObject::connect(ui->Header, SIGNAL(ui->Header->getTextWidget()->textChanged()), this, // this : MainWindow SLOT(headerUpdated())); // Function of MainWindow But this does not work. Is it even possible to create such signal/slot combination? 回答1: why bother - let Qt do all the magic :) Just name your slot (in the

SIGSTOP not working in c program

微笑、不失礼 提交于 2019-12-13 07:08:48
问题 I am trying to write a C program in which the parent process suspends the child process and after a few seconds continues executing it. #include <stdio.h> #include <signal.h> #include <stdlib.h> #include <unistd.h> void sigstop(); void sigcont(); void sigquit(); int main() { int pid; if ((pid = fork()) < 0) { perror("fork"); exit(1); } if (pid == 0) { /* child */ signal(SIGSTOP,sigstop); signal(SIGCONT,sigcont); signal(SIGQUIT, sigquit); for(;;); /* loop for ever */ } else { printf("\nPARENT:

How to set signal checking in loop?

狂风中的少年 提交于 2019-12-13 04:47:54
问题 In createProcess(pid_t pidArray[]) function i create new process and if it's child i print it. But in while loop i everytime check killFlag, and my program no efficiant. How can i fix this issue.? Thank you for any help. In my program you can add process by pressing + or delete it by pressing - or just quit by pressing q. This is my code: #include <ncurses.h> #include <unistd.h> #include <sys/wait.h> #include <signal.h> #include <string.h> #include <stdlib.h> bool printAllowed = false; bool

CGI from Apache, broken pipe

半腔热情 提交于 2019-12-13 04:28:07
问题 What does happen with Apache (or Nginx) running a CGI script when the client (I mean a browser or a TCP gateway) disconnects in the middle? Does Apache/Nginx log an error? (If yes, which one and where?) Is the CGI script sent SIGPIPE to? 回答1: There is no SIGPIPE when Apache CGI script is interrupted. Tested with the following code: #!/usr/bin/perl use strict; use warnings; $| = 1; #$SIG{PIPE} = "IGNORE"; $SIG{PIPE} = sub { open my $f, '>', 'log.txt'; print $f "PIPE: $ENV{SERVER_NAME}\n";

vhdl quartus : left bound of range must be a constant

微笑、不失礼 提交于 2019-12-13 04:21:35
问题 Is there any way to use a variable(signal) inside the std_logic_vector instead of using a constant, e.g : dout((8*index + 7) downto 8*index) <= "00000001"; in this example the signal is index thanks in advance 回答1: Assuming the signal or variable index is of type integer, that should work fine. If index is a signal or variable of type std_logic_vector, you'll need to convert it to an integer. See the following simple example (which just now compiled happily in my simulator): library ieee; use

Correct way to shutdown C application to ensure CRITICAL sections completed?

╄→гoц情女王★ 提交于 2019-12-13 04:05:08
问题 I have a shutdown hook handler defined in a SINGLE threaded C application. int main(int argc, char * argv[]){ //Shutdown hook for CTRL-C (void) signal(SIGINT, shutdownHook); ... ... } So when the user hits CTRL-C the shutdown hook is initiated... void shutdownHook(int sig){ rc = wmq_sender_stop(errorStr); if (rc != 0){ printf("\n%s\n", errorStr); } while(transactionRunning == TRUE){ sleep(1); printf("Transaction still running\n"); } .... .... } You can see above that I call a "wmq_sender_stop

How is a “handshake” generally implemented with regards to Named Pipes

坚强是说给别人听的谎言 提交于 2019-12-13 03:45:58
问题 I need to implement a handshake type protocol in to a small Linux program that uses named pipes to communicate with other processes. I've searched for a general implementation pattern for a handshake type protocol when using named pipes but I've not been able to turn anything up... I simply can't believe that there isn't patterns to do this. Can someone point me to a possible resource? In full disclosure this is for homework but implementing this pattern isn't the homework. We need to solve a

How to suspend the main-loop in a signal-driven demon?

心不动则不痛 提交于 2019-12-13 03:45:26
问题 I'm working on an electronic phone-line emulation for a raspberry pi. For this, I’m in need of a function, which is called each 20 ms (=50Hz, half of the ringing voltage-frequency), checks the electrical current and updates the duty-cycle of a HW PWM. To get there, I set up a signal-handler on an according timer (as I’d hang it into the scheduler in a pure embedded environment) and let it do its work. Note, that the code below is shortened just in order to kfocus on the issue. This already

Why timer_create throw error for SIGEV_THREAD in solaris 10?

妖精的绣舞 提交于 2019-12-13 03:37:56
问题 I wrote a piece of by using timer_create for sets the timer to invoke a thread in which i set sigev_notify as SIGEV_THREAD, it is giving me error EINVAL(Invalid argument) but when i am setting sigev_notify as SIGEV_SIGNAL code is working fine. my this piece of code is working in all OS even in solaris 11 but for solaris 10 giving me error. code given below: { int status =0; struct itimerspec ts; struct sigevent se; se.sigev_notify = SIGEV_THREAD; se.sigev_value.sival_int = val; se.sigev