Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help with Fuzzy C to be used on PIC 16F74

Status
Not open for further replies.

solidust

Newbie level 4
Joined
Jan 7, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
trinidad and tobago
Activity points
1,322
Ok hope that somebody could help. I tried a simple program on Fuzzytech Pro edition, basically one input and one output and two rules 1 If input low output off. 2 If input high output on.

I want use this on a PIC 16F74 micro-controller.
I compiled to C in fuuzytech and this is the code obtained. wat the???

How can i get this in a form the PIC can understand?



#define PRECOMPILER
#define FTLIBC16
#include "ftlibc.h"
#define FUZZYDEFINED
#define FLAGSDEFINED
#include "FUZZYPIC.h"

static FUZZY crispio[1+1];

static FUZZY fuzvals[2+2+0];

static double dcvs[1+1];
double * const pcvfuzzypic = dcvs;


static const FUZZY tpts[8] = {
0x0000, 0x0000, 0x4000, 0xDFFF,
0x2000, 0xBFFF, 0xFFFF, 0xFFFF};

static const FUZZY xcom[2] = {
0x0000, 0xFFFF};

static const BYTE rt0[6] = {
0x00, 0x01, 0x02,
0x00, 0x01, 0x03};

static const FRAT frat0[4] = {
0x0003, 0x0000, 0x0003, 0x0001};

static const FUZZY BVRCode[4] = {
0x0000, 0xFFFF,
0x0000, 0xFFFF};

static const double BVRShell[6] = {
0, 1, 2e-005,
0, 1, 2e-005};


FLAGS fuzzypic(void) {
crispio[0] = BVScaleShell2Code(&BVRCode[0*2], &BVRShell[0*3], dcvs[0], BVRCode[0*2+1]<MAXBVRANGE, MAXBVRANGE);

fuzptr = (PFUZZY) fuzvals;
tpptr = (PFUZZY) tpts;

crisp = crispio[0];
bTNum = 2;
flms();

fuzptr = (PFUZZY) fuzvals;

bTNum = 2;
fratptr = (PFRAT) frat0;
rtptr = (PFTBYTE) rt0;
iMMin(); /* Max-Min */

invalidflags = 0;
fuzptr = &fuzvals[2];
xcomptr = (PFUZZY) xcom;

crispio[1] = 0x8000;
bTNum = 2;
defuzz = &crispio[1];
þ·—<mI q();

dcvs[1] = BVScaleCode2Shell(&BVRCode[1*2], &BVRShell[1*3], crispio[1]);
return invalidflags;
}

void initfuzzypic(void) {
for (fuzptr = &fuzvals[2];
fuzptr <= &fuzvals[3];
*fuzptr++ = 0);
}




This is crazy. Anybody can make sense? Also a .h file was created but i didn't include it here.
 

wp100

Advanced Member level 5
Joined
May 15, 2009
Messages
3,056
Helped
883
Reputation
1,781
Reaction score
736
Trophy points
113
Location
Prime Meridian
Activity points
0
Hi,

Have never heard of that FuzzyTech Pro before, but just quickly reading its description seems you have used it to generate your code in its ' portable C ' state.

Think that your code now needs to be added to your main project code using a C complier.

Its this that will then compile all the code and produce the .hex file to program into your chip.

If you go to the Microchip site they have free C compliers for the 16F chips.
 

    solidust

    Points: 2
    Helpful Answer Positive Rating

solidust

Newbie level 4
Joined
Jan 7, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
trinidad and tobago
Activity points
1,322
Thanks. Do you know a good C compiler that may be able to interpret this C?

I know some compilers have their own differences in the C language.
 

wp100

Advanced Member level 5
Joined
May 15, 2009
Messages
3,056
Helped
883
Reputation
1,781
Reaction score
736
Trophy points
113
Location
Prime Meridian
Activity points
0
Hi,

If you are wanting to use the Pic 16F range it would seem the Hi Tec C is the one Microchip use.

Afaid I cannot offer any advice on it as I only use assembler.

You can get the free version here -
**broken link removed**
 

nikhil_damle

Advanced Member level 4
Joined
Dec 15, 2005
Messages
117
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Activity points
1,936
useing fuzzy logic is easy in fuzzytech pro but to use it in pic16 u soud use mickro biasic so that ur code from fuzzy tech can be converted to hex

Added after 8 minutes:

mikro baic for use here
 

    solidust

    Points: 2
    Helpful Answer Positive Rating

solidust

Newbie level 4
Joined
Jan 7, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
trinidad and tobago
Activity points
1,322
Thanks so much guys.

nikhil concerning mikrobasic,

it doesn't recognize any of the c code defs from fuzzytech such as 'static', 'crispio', 'btnum', etc , as seen above in the program. I went tru the entire program from fuzzytech but to no avail.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top