I have to communicate between two laptops using USB-to-Serial adapter. I have written 2 programs one for sending and another for receiving. Programs were written in both C and C# programming languages.
Using C language: I am able to successfully communicate using C-Programs mentioned below. But the problem is speed. It takes around 1 hour(60min) for just to pass 150MB. improving the performance of this programs...I also mention some comments along with programs for self understanding.Sender File on laptop with serial port :
The above 4 programs behaves as, sender send a character and receives an ack for every character. I have followed this approach, bcoz other approaches were not working fine (in the sense the complete data is not sent, the amount of data sent is not judgeable, bcoz it will different every tym). when i used this approach it worked fine.
I wrote a class pedal that allows to search for the serial port on which the pedal is connected. Therefore I send a request to the pedal and set up a timer event of 20 ms. If no reply, I search for the next serial port.
When found I send configuration to the pedal and set another timer event of 200 ms that requests for pedal state. It runs fine.
Now if the pedal is disconnected then connected again I would like it to run again.
Therefore I set another timer event every 2s that launches all what I described above.
The trouble comes because the 20 ms timer event doesn't run and I do not understand why.
I sent 1preample and 4bytes in transmitting side , preample contains only 1 and 0 with 4milliseconds delay, each byte contains 8bits with 2milliseconds delay , if a bit contains 1 it will send 1millisecond high and 1millisecond low signal ,and if a bit contains 0 it will send 2millisecond continuous delay, I have a problem at receiving side how to capture and store the preample and 4byte values in a buffer , i am using ARM processor it will update every 5microsecond ..
I want to send data from a laptop (windows 7, processor 2.60GHz) to a desktop (windows xp, processor 3.10GHz) using serial communication (using a USB to RS232 convertor). The WriteFile function is able to send the data from the laptop (NumberOfBytesWritten is correct). But on the desktop side, ClearCommError detects no data in the read buffer.
This is the relevant code in my desktop:
while(1) { ClearCommError(hPort,&dwErrors,&commStatus); if (commStatus.cbInQue != 0) ReadFile(hPort,&data,1,&dwBytesRead,NULL); Sleep(10); }
The if condition is never satisfied. The baudrate and other parameters in the DCB struct are the same on both sides.
The same code works when I write and read in the same system by shorting the RX and TX pins in the RS232 connector.
The project is about reading data from PIC and display the data on the dialogue created by the MFC GUI of Visual studio 2010. There are 4 data need to be displayed (2 weight and 2 angle). the data will be display on the edit control box on the dialogue.
I have try to solve the COMPort and Readdata issues many times, but I'm fail. I have read many sources and implement the source codes... They are never work....
The detail about the issues that I need to solve is clearly mentioned on the main dialogue.cpp. Take a look to an uploaded zip file that I have attached.
i'm student in computing science , i want to specialize in IT security and the first step i think is to know how to program a virus and understand how it works and how to stop it now i'm just a beginner I look for a way forward , i need some tips where can i begin? What are the basics of IT security? What programming language should I learn?
Q. In context of C language syntax checking, which of the following can be modeled using Finite Automata?
(A) Detecting proper termination of an instruction. (B) Detecting balance of parentheses. (C) Detecting initialization of a variable. (D) None of the above.
The goal of my program is to convert a decmial number to a binary number.First, the program gets an input to an array of chars, and the function translate_dec_bin converts this array to a decimal number through the strtoul function.The problem is that my program prints the binary number with an additional "0".For exmaple, for the input 1 - the program prints 01 instead of 1, for the input 3 - the program prints 011 instead of 11.
I have a program that reads a text file and then outputs the corresponding transition table according to the regular expression given in the text file. The first line that is read by the code contains the transition table. The subsequent lines of the text files include the strings. I want my code to read the strings in the subsequent lines of the text file and tell me whether the string is accepted or not by the language. Basically, what my code does is that it translates the regular expression to an NFA and then, it translates the NFA to a DFA and then it builds a transition table according to the language.
I have included a special library in my code and I compiled my code from the command line using the following command:
gcc -o lalab lalab.c -lncurses then, I just run the program like this: ./lalab
Another problem that I have is that my code does not handle the empty transitions, so the program should output a corresponding result when it is fed a regular expression such as a|e. The alphabet of the language is made of {a, b, e} e is the empty transition. The text file that the program reads from includes a regular expression in its first line and strings to be accepted or not in the following lines. Given an input file like this:
(a|b)*a aaaa aba bba ab bbb :frown:
The code should produce an output like this:
yes yes yes yes no no
Code: #include<stdio.h> #include<conio.h> #define MAX 20
//========================================================= struct nfa_state { int a, b, eps1, eps2; }NFA[20];
Program:I have 2 arrays: 1 for the correct answers to a quiz, 1 for the user. I then have a vector to hold the incorrect answers.
It keeps outputting what looks like alt characters, why.
Here is the code:
#include <iostream> #include <vector> using namespace std; int main() { const char a1[]={'a','d','b','b','c','b','a','b','c','d','a','c','d','b','d','c','c','a','d','b'}; char a2[20]; int i=0; int incorrect=0;
I need to implement a two-way asynchronous communication between two objects, not using any IPC.
What I have now is a producer-consumer model where producer sends a number "88" to consumer at random intervals. Now, I need consumer to send a number "99" back to producer at a random intervals, this probably should be done in a separate thread.
I am using GNU on Linux, here is the compile line.
Code:
g++ -g -std=c++11 main.cpp -o main
Code:
#include<iostream> #include<chrono> #include<thread> class IObject { public: virtual void fromApp(int i) = 0; virtual int toApp(int& i) = 0;// ???
I'm trying to set up some basic communication between two programs via the registry.
For this I would like to use the functions
Code: int value=10; CString strSection="Data"; CWinApp* pApp = AfxGetApp(); pApp->WriteProfileInt(strSection,ValueName,value); and
Code: CString strSection="Data"; CWinApp* pApp = AfxGetApp(); int value=pApp->GetProfileInt(strSection,ValueName,0); which read/write to the application's registry.
Is there some way of making two different programs use the same application registry?
a few pointers in building an assembler in C for a 68hc11 micro controller I'm struggling on a way to convert the assembly language in a txt file to s19 format.
My program allows a server and a client to chat over a socket. Currently I have to wait for one of them to type a message and press enter, before a message from the other person can be received.
Is there a simple way for messages to be received instantly - but not disturb any message that is being typed in?
I want parent and child processes to communicate in C linux using pipes. I have created two file descriptors. one for parent to child i.e. readpipe and other writepipe for viceversa. But I am getting null as output for ch and ch1 strings in my code below.
#include <stdio.h> #include<stdlib.h> #include #include<unistd.h> int main(){ pid_t pid;