Page 1 of 1

Trouble Using C code in FLOWCODE

Posted: Wed Sep 12, 2007 7:52 pm
by Daniel
I am new to C++ and I am trying to learn it using FLOWCODE.

I wrote a short program to add 4+4 in C and display it using FLOWCODE. This is the end of the program.

//Initialisation


//Interrupt initialisation code
option_reg = 0xC0;


//C Code
//C Code:
FCV_RE = 4 + 4 ;



//Output
//Output: RE -> PORT A
trisa = 0x00;
porta = FCV_RE;


mainendloop: goto mainendloop;
}

I wrote a similiar program using the FLOWCODE calculation box and the only difference was


//dan
//Calculation:
// RE = 4 + 4
FCV_RE = 4 + 4 ;

To my eye, the C code generated is identical yet the output to PORTA is different. Am I missing something.

Thanks for any help.

Regards,
Daniel Pollit
Toronto, Canada

Posted: Thu Sep 13, 2007 7:49 am
by Steve
Hello Daniel,

Is the code for the output icon the same? And what is the exact output (for both programs)?

Posted: Thu Sep 13, 2007 7:17 pm
by Daniel
Hi Steve,

The code in the Calculation Box is

RE = 4 + 4

When I run the program using C++ code

FCV_RE= 4 + 4 ;

the RE Variable stays at zero throughout and finally, the OUTPUT to PORTA of RE displays zero.

When I substitute or add the Calculation Box as above, and execute the program, the value in RE becomes 8 as the Calculation step is run and in the OUTPUT to PORTA the Led indicating 8 indeed lights up.

Thanks for any light you can shed.

Regards,
Daniel Pollit
Toronto, Canada

Posted: Fri Sep 14, 2007 8:11 am
by Steve
Are you just simulating the program on screen? Flowcode does not simulate your own C code.

But the program should work ok when downloaded to the PICmicro.

Posted: Sat Sep 15, 2007 12:27 pm
by Daniel
Hi Steve,

Thanks for clearing that up.

Regards,
Daniel Pollit
Toronto, Canada