C :: USB To Serial Communication Using Language

Dec 18, 2013

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 :

Code:

#include <stdio.h>
#include <bios.h>
#include <conio.h>
}

[code]....

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.

View 6 Replies


ADVERTISEMENT

Visual C++ :: Manage Serial Communication With A Pedal

Jan 17, 2013

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.

View 3 Replies View Related

C :: How To Capture And Store Serial Communication Data In Buffers

Jun 18, 2013

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 ..

View 1 Replies View Related

Visual C++ :: Serial Communication In Windows - ClearCommError Finds No Data In Read Buffer

Dec 13, 2013

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.

View 2 Replies View Related

Visual C++ :: PIC To PC Using MFC Visual Studio Through Serial Communication

May 28, 2014

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.

View 6 Replies View Related

C :: How To Program A Virus With Language

Oct 3, 2013

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?

View 3 Replies View Related

C :: Language Syntax Checking

Jun 15, 2013

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.

View 4 Replies View Related

C++ :: Compilation In Machine Language

Jan 25, 2013

Have a program which given a C source code file, gives back RAW MACHINE CODE, which means it doesn't have to be a executable on his own.

Like:

Given a example function for C:

int stdcall Function(void)
{
return 0;
}

Gives back the Machine Code for the Example Function.

It doesn't need to be actual C code, it can also be like:

type int
return 0

Or also it can be a straight assembly-to-machine-code compiler.

Is there any Library? Or even a external tool I can look into?

View 4 Replies View Related

C++ :: Communication Between Functions Of Class

May 19, 2013

I have a class as follows:

class testa {
public:
testa_b();
~testa_b();
testa_c();
}

Then I have defined some variables in testa_b:

testa::testa_b()
{
double aa = 1.0;
}

What is the easiest way to make testa_c() can use the aa defined in testa_b() (without declaring them in the class)?

View 3 Replies View Related

Visual C++ :: COM Port Communication

Nov 30, 2012

How to communicate my COM PORT to my visual c++ ... Means i want to read data from my port and want to show in visual c++ so what to do ...

View 1 Replies View Related

C :: Opening Audio File Using Language

Sep 6, 2013

how to open an audio file using c. write a code to open an audio file.

View 2 Replies View Related

C :: Convert Decimal To Binary On Language

Nov 15, 2013

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.

Code:

#include <stdio.h>
#include <stdlib.h>
#define MAX_LEN 20
void translate_dec_bin(char s[]){
char st[sizeof(unsigned)*20] = { 0 };
}

[code]....

View 2 Replies View Related

C++ :: Writing Simple Compiler For A Language

Mar 13, 2014

I have a problem about compiler.I want to write a simple compiler for a language.

stm -> id := expr
| print expr
| if expr then stm
| while expr do stm
| begin opt_stmts end

[Code] .....

I guess I should create main.c to convert source code.Also,I should create a source.c to write a example program that is relevant with above grammar.

View 1 Replies View Related

C/C++ :: Automata - Tell Whether A String Is Accepted By Language

Sep 27, 2014

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];

[Code] .....

View 8 Replies View Related

C/C++ :: Vector Outputs Alien Language?

Oct 19, 2014

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;

[code].....

View 1 Replies View Related

C/C++ :: What Settings Has To Be Made To Run Language In Jgrasp

Nov 25, 2012

Running c in jgrasp.. i am getting error has gcc not found.

View 4 Replies View Related

C++ :: Two Way Event-driven Communication Between Objects

Oct 26, 2013

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;// ???

[code].....

View 8 Replies View Related

C++ :: Implement Bidirectional Communication Between Two Processes?

Mar 29, 2012

I have two command line apps, one of them is multithreaded. I need to implement a bidirectional communication between them. Currently I can do

Code:
ProgramA 1> ProgramB

for the first programA to direct output into ProgramB, however I also need ProgramB to send messages to ProgramA.

how to implement it in a easiest way.

btw, I am on Ubuntu. I'd rather not to use third party libraries, Boost, etc.

View 7 Replies View Related

Visual C++ :: Communication Between Two Programs Via Registry?

Jan 24, 2014

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?

View 14 Replies View Related

C :: How To Convert Assembly Language In Txt File To S19 Format

Apr 25, 2013

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.

View 1 Replies View Related

C# :: Way To Build Project To Dynamic Linking Language

Dec 28, 2011

I have a project C# and i want to build it to .dll for use in ASP.Net project . Any way to do it. It look like my attachments image .

View 1 Replies View Related

C++ :: Create Symbol Table For Assembly Language?

Jan 21, 2013

how to create a symbol table for an assembly language and high level language program in c++

View 1 Replies View Related

C :: Simple Way To Have Instant Communication In TCP/IP Chat Program?

Mar 25, 2014

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?

View 2 Replies View Related

C/C++ :: Two Way Communication Between Child And Parent Processes (pipes)

Mar 19, 2014

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;

[Code] .....

View 1 Replies View Related

C :: Language Program Environment Does Nothing To Prevent Buffer Overflows

Sep 25, 2013

TheC language program environment does nothing to prevent buffer overflows ..... is there any pros to the obvious cons of this?

View 3 Replies View Related

C++ :: Create Symbol Table For High Level Language?

Jan 21, 2013

How to create a symbol table for an assembly language and high level language in c++?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved