CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

ccs-c to c# dll

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
the4thfabregas



Joined: 25 Jul 2009
Posts: 3

View user's profile Send private message

ccs-c to c# dll
PostPosted: Sat Jul 25, 2009 9:04 am     Reply with quote

Hi all,
I am developing a c# application. I have a program that I developed with ccs-c. I need to use this program in my c# program. Therefore, I need something that converts my ccs-c program to c# dll file.

Any help appreciated.
Thanks in advance...
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Sat Jul 25, 2009 10:11 am     Reply with quote

Quote:
I am developing a c# application. I have a program that I developed with ccs-c. I need to use this program in my c# program. Therefore, I need something that converts my ccs-c program to c# dll file.

CCS-C is a C-to-PIC compiler. I think what you're looking for is a C#-to-x86 compiler.

This is a free C# compiler + IDE (there may be better ones out there :-P ) : http://www.microsoft.com/express/vcsharp/

Rohit
the4thfabregas



Joined: 25 Jul 2009
Posts: 3

View user's profile Send private message

PostPosted: Sat Jul 25, 2009 10:34 am     Reply with quote

I created a project in ccs-c pic c compiler.

One of my file is health_control.h
Code:

void nigth(signed int a){
         switch(a){
       
         }
}

void evening(signed int a){
         switch(a){
     
         }
}

void morning(signed int a){
         switch(a){
       
         }
}

and I make a program with using c#. User put values in a LinkedList.
For example:
Code:

values1: 1 values2:10
values1: 2 values2:20
values1: 3 values2:30
values1: 4 values2:40
values1: 5 values2:50

I want take these values and put in my healthcontrol.c
and create a file like this
Code:

void nigth(signed int a){
         switch(a){
       values1: 1 values2:10
values1: 2 values2:20
values1: 3 values2:30
values1: 4 values2:40
values1: 5 values2:50
         }
}
void evening(signed int a){
         switch(a){
     values1: 1 values2:10
values1: 2 values2:20
values1: 3 values2:30
values1: 4 values2:40
values1: 5 values2:50
         }
}

void morning(signed int a){
         switch(a){
       values1: 1 values2:10
values1: 2 values2:20
values1: 3 values2:30
values1: 4 values2:40
values1: 5 values2:50
         }
}


health.control.c created by ccs-c picc compiler and I take values c#.

How I can put my values which I created on c# to my healthcontrol.c which created on ccs-c pic c compiler?
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Sat Jul 25, 2009 8:29 pm     Reply with quote

Quote:
I want take these values and put in my healthcontrol.c
and create a file like this
I don't really understand what you are trying to do. Do you want insert those values into *after* compiling the CCS file? If so, you'll have to use a different approach. But please make yourself more clear.

A couple of questions:
- Umm, are you familiar with programming in C? The format of the 'switch' is wrong.
- What are you using C# for? Is it to create a user interface (UI)?

Rohit
the4thfabregas



Joined: 25 Jul 2009
Posts: 3

View user's profile Send private message

PostPosted: Sun Jul 26, 2009 5:08 am     Reply with quote

i make temp optimization program with ccs-c pic compiler

i split a day three part.
morning,evening and night

i make a program in c#. my c# program take values from user for temp.

for example;

Code:
         case  5:  ic=76;break;
         case  6:  ic=75;break;
         case  7:  ic=73;break;
         case  8:  ic=71;break;
         case  9:  ic=70;break


i created this values on c#. and i want take these values put my ccs-c pic file and compile it


my c# program take values from user.
Guest








PostPosted: Sun Jul 26, 2009 8:54 am     Reply with quote

Most of us use the Flash EEPROM to store 'user' values or calibration constants. That way you can have one program and binary image and then you can, at calibration time change the EEPROM values as required. A simple serial connection can be used to change the values. I suppose you can use the debugger to save change the EEPROM too, but I have not done it that way.

You can certainly also do this your way with C# - it is a simple thing to replace strings using C#.

Set your constants up as defines like,

#define const_1 100
#define const_2 220

In your C# program all you have to do is read each line and look for the "#define const_x" then replace the number at the end of the line.

Save the file again and then feed it to the command line compiler.

HTH - Steve H.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Sun Jul 26, 2009 9:09 am     Reply with quote

So from what I understand you want to:
1. take some values from the user;
2. use those values in a C# program to generate some sort of values
3. use the generated values as data in a CCS-C source file

Is that correct?

What you wish to do is to read data from a file on your PC using CCS. I don't think there are file IO directives/functions in CCS. But you could easily create a header file using C# using file output functions. The header file could contain an array with the required values. Include this header in your CCS-C source.

Here's a quick primer on file IO using C# http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=400

I'm not too good with C#, but to do something like this, I'd write a quick and dirty QBasic program with lines that look like this:

Code:
open "temp.h" for output as #1
....
....
....
input value[0]
input value[1]
input value[2]
.
.
.
for i=0 to 9
       some_string$="some_array[" + str$(i) + "]=" + str$(value[i]) + ";"
       .....
       .....
       print #1, some_string$
       .....
next i
....
....
end


This code basically creates a file called temp.h on my PC. It takes in user inputs and stores them in the array *value[]* . It uses simple string manipulation functions to output text, the fourth line of which looks like this:
Code:
some_array[3]=54;


I would then write:
Code:
#include <temp.h>
in my CCS source file.

Dirty, but it works. Razz

Rohit
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group