How to realize communication problem?

Hello everybody.
I am working on a project in which I read/write data via rs-232 from/to my 
Windows application to/from an microcontroller. 
Now, my boss wants me to write a library which he can use for different 
microcontrollers. This library should store any changes of data. So the 
desired microcontroller should just be able to pick up the data. 

You can think of it this way: Me, representing the Windows application, put 
a sheet of information into a drawer. A buddy of mine, (representing a 
microcontroller) can go to the drawer an pick up the sheet for further 
treatment.

So, my question: How can I create such a library with such a kind of 
communication?
I've read any possibilites of interprocess communications, but in my opinion 
there is nothing of use to my problem, isn't it?

Help would really be appreciated. 

With kind regards,
Paul.
0
PaulC (24)
8/2/2005 1:47:08 PM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
860 Views

Similar Articles

[PageSpeed] 6

Paul C. wrote:
> Hello everybody.
> I am working on a project in which I read/write data via rs-232 from/to my
> Windows application to/from an microcontroller.
> Now, my boss wants me to write a library which he can use for different
> microcontrollers. This library should store any changes of data. So the
> desired microcontroller should just be able to pick up the data.
>
> You can think of it this way: Me, representing the Windows application, put
> a sheet of information into a drawer. A buddy of mine, (representing a
> microcontroller) can go to the drawer an pick up the sheet for further
> treatment.
>
> So, my question: How can I create such a library with such a kind of
> communication?
> I've read any possibilites of interprocess communications, but in my opinion
> there is nothing of use to my problem, isn't it?
>
> Help would really be appreciated.
>
> With kind regards,
> Paul.

It doesn't sound like you need to communicate between processes, so no.
Your boss would include your library in programs that needed it, but I
don't see a reason you'd need to include communication within Windows
into it (besides the obvious thing of communicating via RS232.

It sounds like you need to pick out which functions will be common
throughout the microcontrollers, create an abstract base class with the
necessary virtual functions, and then create the derived classes
(You've already got one I'm assuming) for the ones your boss wishes to
use. From there, you can just use the abstract base in the main source
of the code, and just set the derived class on initialization of the
program.

Josh McFarlane

0
darsant (187)
8/2/2005 2:00:03 PM

"Josh McFarlane" wrote:

> Your boss would include your library in programs that needed it, but I
> don't see a reason you'd need to include communication within Windows
> into it (besides the obvious thing of communicating via RS232.

I think I do not understand. Well, I've got an application in which the user 
can choose the microcontroller he/she wants to work with.
This microcontroller is connected to the pc via rs-232.

First I established communication with the CreateFile, WriteFile.....  in a 
thread.
In the software of the microcontroller which is written in C not in C++, I 
uses its interuppts to set/get the data. 
It worked all fine. Now my boss wants to use a library, which shall handle 
the used varibles. If they are changed they should be stored. 
0
PaulC (24)
8/2/2005 2:31:06 PM
I'm finding it difficult to follow what you want - I'm wondering if English
is your second language or if you have just found yourself dumped in the
deep end?

Maybe you're just talking about storing persistent data on teh PC that
multiple versions of microcontrollers will be able to query via the serial
port?
If that's the case, then save it in a file or the registry?  You app(s) will
change behaviour, if necessary, depending on the microcontroller that it
detects on teh serial port?

define the following and things will be a lot clearer:

"the data"
"library"
"used variable"
"changed"
"stored"

I'd recommend, if the task is not clear to you, to either get a spec from
your 'boss' or write one before doing any more work and get your 'boss' to
ok it before you continue.



"Paul C." <PaulC@discussions.microsoft.com> wrote in message
news:596DB01F-0DEC-4FBE-BBF1-447CB8036DD1@microsoft.com...
>
>
> "Josh McFarlane" wrote:
>
> > Your boss would include your library in programs that needed it, but I
> > don't see a reason you'd need to include communication within Windows
> > into it (besides the obvious thing of communicating via RS232.
>
> I think I do not understand. Well, I've got an application in which the
user
> can choose the microcontroller he/she wants to work with.
> This microcontroller is connected to the pc via rs-232.
>
> First I established communication with the CreateFile, WriteFile.....  in
a
> thread.
> In the software of the microcontroller which is written in C not in C++, I
> uses its interuppts to set/get the data.
> It worked all fine. Now my boss wants to use a library, which shall handle
> the used varibles. If they are changed they should be stored.


0
8/2/2005 2:43:31 PM
Well, english is my second language. But that is not the problem, I hope.
The problem is, that it is not what I want but what he wants. He  somehow 
insists of using a library for saving data and other stuff, which definitely 
do not work.

> Maybe you're just talking about storing persistent data on teh PC that
> multiple versions of microcontrollers will be able to query via the serial
> port?

Yeah, generally right. ;)

> If that's the case, then save it in a file or the registry?
Me, I wanted to do so. 

 
> You app(s) will
> change behaviour, if necessary, depending on the microcontroller that it
> detects on teh serial port?

Yes, some data variables won't be necessary for some microcontrollers.

> define the following and things will be a lot clearer:
> 
> "the data"                   
> "library"
> "used variable"
> "changed"
> "stored"

I am not sure, what you want me to do.
You mean, I shall write down for every controller, which data is needed, and 
so on?
> I'd recommend, if the task is not clear to you, to either get a spec from
> your 'boss' or write one before doing any more work and get your 'boss' to
> ok it before you continue.
 
Right, I am going to do this tomorrow morning! 


Thanks  - a lot. 

Kind regards. 
Paul
0
PaulC (24)
8/2/2005 6:32:03 PM
"Paul C." <PaulC@discussions.microsoft.com> wrote in message
news:3178A6E4-5D7B-4CB2-9E2F-44D62D6781CB@microsoft.com...
> Well, english is my second language. But that is not the problem, I hope.
> The problem is, that it is not what I want but what he wants. He  somehow
> insists of using a library for saving data and other stuff, which
definitely
> do not work.

But we don't know why it does not work because we have no details yet.

>
> > Maybe you're just talking about storing persistent data on teh PC that
> > multiple versions of microcontrollers will be able to query via the
serial
> > port?
>
> Yeah, generally right. ;)
>
> > If that's the case, then save it in a file or the registry?
> Me, I wanted to do so.

If by 'library', you mean a module that other apps can use, then the save to
file or save to registry is still appropriate.  Your lib file (or perhaps
dll) will just take care of all the file/registry saving so that others can
add in new microcontrollers without needing to know the details of how to
save the data (they just know that the data IS being saved on the PC by
calling routines in your library).

If by 'libary' you mean a repository of information, then you really do need
a specification that can be agreed on before work begins.


>
>
> > You app(s) will
> > change behaviour, if necessary, depending on the microcontroller that it
> > detects on teh serial port?
>
> Yes, some data variables won't be necessary for some microcontrollers.
>
> > define the following and things will be a lot clearer:
> >
> > "the data"
> > "library"
> > "used variable"
> > "changed"
> > "stored"
>
> I am not sure, what you want me to do.
> You mean, I shall write down for every controller, which data is needed,
and
> so on?

I actually meant for you to explain what each of these terms means to the
group, so that we can better understand what you want.  Although, your above
response will almost certainly be beneficial to everyone involved.


> > I'd recommend, if the task is not clear to you, to either get a spec
from
> > your 'boss' or write one before doing any more work and get your 'boss'
to
> > ok it before you continue.
>
> Right, I am going to do this tomorrow morning!
>
>
> Thanks  - a lot.
>
> Kind regards.
> Paul


0
8/2/2005 6:54:19 PM
"Joe Butler" wrote:
> But we don't know why it does not work because we have no details yet.

Well, let me try to explain. My boss wants the library ( a static library 
[.lib-file]) to 
handle the initialization and running of the UART of the microcontroller. 
Since this is just a library which cannot run routines due to the fact it 
does not have a main function it won't work. 

> If by 'library', you mean a module that other apps can use, then the save to
> file or save to registry is still appropriate.  Your lib file (or perhaps
> dll) will just take care of all the file/registry saving so that others can
> add in new microcontrollers without needing to know the details of how to
> save the data (they just know that the data IS being saved on the PC by
> calling routines in your library).

Like I said, a static library file is meant. So you are suggesting writing 
e.g. a function called ' void saveData(BYTE data)' which every app can use. 
This function saves it to a file. Am  I right? 

   "the data"         :  bytes transferred via rs-232; contains encrypted 
values for  the 'used variables'
   "library"            : static .lib-file
   "used variable"  : my variables, which contain lots of values of the µC, 
like voltage, current, ...... and variables which are used in the C-app of 
the µC
   "changed"         : with my application I can alter some values of the 
variables
   "stored"            : the changed values of the variables should be 
stored/saved

Paul.

0
PaulC (24)
8/3/2005 5:44:05 AM
I'm sure you've sorted this out by now, but there's a few questions in-line.

"Paul C." <PaulC@discussions.microsoft.com> wrote in message
news:E598BD9E-0342-486C-B792-ED89EB3DD150@microsoft.com...
> "Joe Butler" wrote:
> > But we don't know why it does not work because we have no details yet.
>
> Well, let me try to explain. My boss wants the library ( a static library
> [.lib-file]) to
> handle the initialization and running of the UART of the microcontroller.
> Since this is just a library which cannot run routines due to the fact it
> does not have a main function it won't work.

The lib file is compiled for Windows?
And the lib is supposed to supply a routine that runs on each type of
microcontroller?
Or the lib is supposed to initialise serial comms on the PC depending on
which processor is selected - i.e. some microcontrollers will be set up to
communicate at a slower baud rate than others, etc.?


>
> > If by 'library', you mean a module that other apps can use, then the
save to
> > file or save to registry is still appropriate.  Your lib file (or
perhaps
> > dll) will just take care of all the file/registry saving so that others
can
> > add in new microcontrollers without needing to know the details of how
to
> > save the data (they just know that the data IS being saved on the PC by
> > calling routines in your library).
>
> Like I said, a static library file is meant. So you are suggesting writing
> e.g. a function called ' void saveData(BYTE data)' which every app can
use.
> This function saves it to a file. Am  I right?

Essentially, but there are going to be details that need to be fleshed out -
such as:

- How the microcontroller is going to be sending the data: in a fixed format
block (structure) or as series of separate responses to multiple queries
originating at the PC, etc.

- How you know when you are reading back PC data that it goes to the correct
place on teh microcontroller.

- How to know the data is not corrupt.

etc. etc.


>
>    "the data"         :  bytes transferred via rs-232; contains encrypted
> values for  the 'used variables'

OK.


>    "library"            : static .lib-file

OK - a Visual C++ or MFC lib.


>    "used variable"  : my variables, which contain lots of values of the
�C,
> like voltage, current, ...... and variables which are used in the C-app of
> the �C

OK - so you want your microcontroller to get to a state where it can
communicate with the PC so that it can then ask the PC for specific
initialisation values that when received will be used to initialise the
microcontroller properly.  Is this a once-only thing at the factory, is is
to give different personalities to different units?

>    "changed"         : with my application I can alter some values of the
> variables

OK, so this gives the microcontroller some new parameters to work with.


>    "stored"            : the changed values of the variables should be
> stored/saved

OK, so is this so that when a unit is in the field you can query its setup
parameters or so that you can 'program' all teh other PCBs with the values
that work for that version of teh board.

>
> Paul.
>


0
8/4/2005 3:09:07 AM
Reply:

Similar Artilces:

Weird problem
Client bought three new computers and I installed them this week. Old ones were 98 machines with office 97. New ones are XP Pro with Office XP. Server is Win2000 SBS but using more as a workgroup setup, i.e., the workstations are using workgroup not domain. All the new computers are identical and all the users have local admin rights and user rights on the server. One user is not experiencing this problem, but two of the users go to the data folder on the server, open up an existing spreadsheet, make changes, save it and close it. The next time they try to open it, it tells them they can ...

My product key is incorrect how do I resolve this problem?
My laptop came with Microsoft word 2007. Microsoft word tells me to put in my product key. So i put in the product key that is located on the bottom of my laptop but for some reason it says it's incorrect how do i resolve this? The product key on the bottom of your laptop is undoubtedly for Windows and not Word. Laptops often come with a trial version of Office 2007. Unless you paid extra for a retail version of the Office software it may be that your trial has now expired. -- <>>< ><<> ><<> <>>< ><<> <>>...

problem with multiple SMTP domains in Exchange Server 2003
Hi there I have added a second SMTP domain to the Email Addresses (Policy) as follows: Recipients > Recipient Policies > Default Policy > Email Addresses (Policy) > New ... > SMTP Address > @xyz.com > (checked) This Exchange Organization is responsible for all mail delivery > to this address > Apply. When I do so, I no longer receive external emails on the first SMTP domain (@abc.com). Is this related to relay settings, or perhaps something else? Best regards Loane ...

Problem cut-n-paste function
I'm having a bizarre problem cut-n-pasting a very simple calculation (ie = A1 � B1) in C1 down the column (ie C2 to Cn). When I cut-n-paste the function in C1, value that displays is the same as the source cell. If I click on the target cell, the correct cells are highlighted and if I hit the enter button, the formula calculates as expected. What is going on? What do I have to do to force the formula to auto calculate? Turn on Automatic Calculation <g>. You do that at Tools/Options/Calculation. On 27 Sep 2004 18:56:34 -0700, jsausten@hotmail.com (Stephen Miller) wrote: >I'm...

CRM 4.0: WebSite deployment problem
CRM 4.0: I cannot deploy my WebSite in the CRM WebSite, below is the error: 'Microsoft.Crm.WebServices.Crm2007.MultipleOrganizationSoapHeaderAuthentica­tionProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' doesn't exist. Parameter name: Microsoft.Crm.WebServices.Crm2007.MultipleOrganizationSoapHeaderAuthenticat­ionProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Description: An unhandled exception occurred during the execution of the current web request....

ActiveX Browser Problem
Hi, I am using an Activex browser control in my application. I have also implemented the IDocHostUiHandler interface for customizing it. The problem is that when i press Ctrl+N, a new internet explorer window comes up. How should i avoid it....? Thanks, gshetty ...

STATEMENT DOWNLOAD PROBLEMS #2
Hi, I am trying to download statements and keep coming up with an error which says that "A communication error has occurred. Please try or call again." I have tried deleting and recreating the OFX file extension but this hasn't helped. Does anyone have any ideas? Thanks Caz In microsoft.public.money, Cazzy123 wrote: >I am trying to download statements and keep coming up with an error which >says that "A communication error has occurred. Please try or call again." I >have tried deleting and recreating the OFX file extension but this hasn't >he...

Attachment problems #2
When someone in our office sends an e-mail from their Mac with an attachment(e.g. a jpeg file) those of us with PC's can't open it. However, if one of us with a PC can access the file, we can attach the file and send to everyone (and they can open it). What's going on? ...

Wacky migration wizard problems
Hello all, We have two separate domains with the following configuration: Single NT4 PDC running Exchange 5.5 Single W2003 DC running Exchange 2003 There is a two way trust between the domains. I ran the Migration Wizard and moved over one user account. I logged into the new domain as the user, setup Outlook with the proper settings, and got an error that the user account did not have permissions to the mailbox. I checked in system manager and Self has all the necessary rights to the mailbox. The weird thing is that we did another test migration a month ago with the same domains...

#Name? problem that has been stumping Everyone
I have been posting this message for about 5 days now and no one has been able to help. I have a macro that fills down the formula =IF(AT2 = 500,MROUND(AI2,500),IF(AT2 = 5,MROUND(AI2,5),IF(AT2 = 10,MROUND(AI2,10),IF(AT2 = 25,MROUND(AI2,25),IF(AT2 = 100,MROUND(AI2,100),IF(AT2 = 200,MROUND(AI2,200),IF(AT2 = 364,MROUND(AI2,364),ROUNDDOWN(AI2,0)))))))) Each time I fill down the range using the macro I get a #name? error. As I have posted before there is no error in the function because when I go into the status bar at the end of the formula and MANUALLY hit enter the formula calculates correctl...

I have a problem with getting a total Sum of numbers (URGENT)
I'd really appreciate if someone could help me here. I am using Microsoft Excel 2002 on a Microsoft Office XP system. I a trying to develop a minor league baseball schedule, but am having som problems. I have attached a copy of my spreadsheet to give everyone some idea o what I'm doing here. I have where the fans list the "RUNS, HITS & ERRORS) of both teams an for each game of the series. I then have it set up in the TOTA WON/LOST column where if the T-Bones RUNS are more than the SALTDOG runs, a "1" appears in the WON column. If the SALTDOGS have a highe numbe...

Outlook 2003 Add-in: Personal Folders Backup uninstall problem
Hello techie nerds out there Help! I am trying to uninstall this utility to reinstall it on another desktop on the same machine. It seems you can only run this utility on one desktop? Running windows XP pro and Outlook 2002 The programme does not show up in the Add/Remove programme window in the Control Panel. Many, many thanks Paul Paul Allen <ict@wandsworthvb.org.uk> wrote: > I am trying to uninstall this utility to reinstall it on > another desktop on the same machine. It seems you can only > run this utility on one desktop? Doesn't seem to be the case here. ...

Serious problem with Money Plus Deluxe
I have about 17 years worth of investment data in my Money file along with several years of credit card and checking account data. All of the investment transactions have been entered manually; the credit card and checking account data is downloaded online. Stock prices have been updated daily over at least the last dozen years. On Friday, after entering a bunch of new transactions which were accepted normally and shutting Money down, I tried to open my file again. After I entered my login info, Money gave me the memo that it had "encountered a problem and was shutting down.&qu...

Rows and Columns Settings Problem
How do you set rows and columns in a way that when you scrol down/column you can always see a certain row(s)/column(s) -- Message posted from http://www.ExcelForum.com Check out XL Help for "Freeze Panes" In article <JMorgan.1ad5vf@excelforum-nospam.com>, JMorgan <<JMorgan.1ad5vf@excelforum-nospam.com>> wrote: > How do you set rows and columns in a way that when you scroll > down/column you can always see a certain row(s)/column(s). Thank -- Message posted from http://www.ExcelForum.com ...

HQ Client
We are trying to process 501 worksheet from different stores. But these worksheets are getting timed out. There are about 40K items on each store. We tried communicating one store at a time, but with no results. Can someone help? Thanks in advance ...

"Find a contact box" problem
Hi. I�m having problems with the �Find a contact� box on the Standard toolbar. Previously, I would type in a name and the search would pull up name/s from the Outlook Contacts folder first then, if the name is not in the Contacts folder, it would pull up name/s from the Global Address List if any. Now, when I type in a name, the search only pulls up name/s from the Global Address List. The search does not include the Contacts folder although there are entries in the Contacts folder. The problem started after I transferred a couple of Contacts subfolders to another pst file. How do I fix the p...

Problem opening up current Excel wksht to mail merge in Word
Hi, I have Microsoft 2007. I created a list in Excel with clients' name, address, city, state, zip. Then, in Word I go to Select Recipients, locate the Excel file and click open. Here's the problem: a Select Table box appears with Sheet1$, Sheet2$, and Sheet3$ as options. clicking on any of the three results in NOTHING. Nothing at all appears! I'm not sure what the problem might be. Thank you for the help! Rachelle ...

Exchange 2000 problems
Since the HD failed I have been trying to put my domain backup. The PDC, W2k, had IIS and Exchange on it. I have reloaded W2k with SP's and installed Exchange 2000. None of my virtural stores Protocols are running and when I open the properties of each the "Start, Stop, Pause" choices are grayed out. The First Storage Group/Mailbox Store is also down. When I try to Mount it I get this error: "An internal processing error has occured. Try restarting the Exchange System Manager or the Microsoft Exchange Information Store service or both." ID c1041724 Help...I'm...

Exchange 2003 ADC problems
Hi, I have the following situation.... We have multiple Exchange 5.5 sites being migrated to one Exchange 2K3 organisation (called Localmail). The first server in the 2K3 org (which had the CA Config agreement) and also the connection agreement to the EX5.5 server (in Localmail) has died and there is no suitable backup for recovery. I need to remove the connections from this dead server. I cannot remove the CA Config agreement - there is no delete option for this connection. If I try to modify the Config CA connection to run on another Exchange 2003 box in the Localmail org I get the c103a...

Problems with CTabCtrl
I derived a new class from CTabCtrl. I created four dialogs for each tab. The tab controls is displayed fine and all the controls for each tab are also displayed. The problem is that I cannot initialize the edit controls in OnInitDialog for each tab dialog. m_cNameEdit.SetWindowText( m_sName ); IDD_NAME_EDIT has 'm_cNameEdit' and 'm_sName' as member variables. Variables are defined in the CTab1Dlg class. When the tab appears there is nothing in the edit control. Thanks. "Mark F." <replytogroup@news.com> wrote in message news:21TFd.3196$Z%.402@fe1.tex...

Data Entry Problem
I am designing a database to manage staff absences. I have a number of forms (one for each manager) feeding one table for company reports etc. I have a 'member of staff' field that is a comby on each form to restrict entry for managers to their team members only. My problem is that i set the data entry property to 'Yes'. This clears the form on open but prevents me from finding records (obviously because the form is empty). If i set the data entry to 'No', all records from other managers are showing on all managers forms also. Due to data protection i need to ov...

Problem creating 2003 PST file
Hi, I am currently running Outlook 2003 (Client). I am trying to create a new PST file. However when I try to add a new file (file\new\outlook data file\) I can only select: Outlook 97-2002 Personal Folder File. On the microsoft website it says I should see something like "Office Outlook Personal Folders File (.pst)" but it is not listed. Is there any way to correct this?? I am running Outlook 2003 SP1. Thanks for any help, Wouter Hi, Kan iemand mij helpen? Het moet mogelijk zijn om bij het verzenden van een emailtje de afzender te veranderen. Ooit wist ik het, maar ik ben...

Problem with Trendline
Hello, I added a polinomial trendline to my graph. The line describes the very well, but I've been unable to figure out how to extract the numbers in the trend line, ans show them in a table. How is this done? Also, is there any help which gives some detail about how the Escel polinomial trendline graph works? Thanks very much, Keith There is no easy way to extract the information from a trendline. You are better off using LINEST, which, contrary to the help file, works just fine with polynomials. For an example see http://www.stfx.ca/people/bliengme/ExcelTips/Polynomial.htm ...

problem with GetChunk in windowsXP
Hi, I have a program using ADO with access database. It works quite smoothly in win2000, but in windows XP, there is serious problems, I use the following lines to get the buf from my db and it gives run time error. _variant_t varChunk; varChunk = MeasureDB->m_pRs->Fields->Item["Points"]->GetChunk(ChunkSize); COleVariant s1(varChunk); CString s2=s1.bstrVal; // this line gives exception error Thanks for any hints, Behzad ...

Drag Drop problem in CListCtrl
Hello , I have a CListCtrl which displays the thumbnail view of image files & other related info like file size , destination.The owner drawn property of the list cntrl is set to true. I want to be able to drag - drop the thumbnails within the list view itself. But the dragged image of the selected list item is always displayed as a black bitmap.I have used CreateDragImage , BeginDrag , DragEnter , DragMove etc for this.Why is this problem ocurring???? Also if instead of having the dragged image of the item to be displayed , i have set a default bitmap, but it too doesn't get displa...