C code

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
alanwms
Posts: 67
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 4 times
Been thanked: 17 times
Contact:

C code

Post by alanwms »

Can I get an example of code to be pasted into the C code icon for FC5 that shows a simple example to:

Look at an input
Turn on an output.


Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: C code

Post by Benj »

Hello,

Lets say you have a flowcode variable named test.
Look at an input

Code: Select all

trisb = 0xFF;  // convert RB0-RB7 to Input
FCV_TEST = portb;   // read the value being input to portb pins
Turn on an output.

Code: Select all

trisb = 0x00;   // convert RB0-RB7 to output
portb = FCV_TEST;   // assign value in test variable to portb pins
Some chips have a LAT register as well as a port register, in which case the output code becomes.

Code: Select all

trisb = 0x00;   // convert RB0-RB7 to output
latb = FCV_TEST;   // assign value in test variable to portb pins

Post Reply