My Program Will not Compile To ASM or the Chip

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

ivan sandler
Posts: 4
Joined: Tue Aug 31, 2010 11:54 am
Been thanked: 1 time
Contact:

My Program Will not Compile To ASM or the Chip

Postby ivan sandler » Tue Aug 31, 2010 5:42 pm

I HAVE NO IDEA WHAT I AM DOING HERE IS RIGHT
I HAVE A PROBLEM TO GET INFORMATION HOW TO ASK QUESTIONS IN THIS FORUM. THIS IS CERTAINLY NOT AN EASY WAY

THIS IS MY PROBLEM . I AM STILL LEARNING THE PROCESS TO WRITE FLOW CODE. I DID A KEYPAD LOCK WHICH WORKS PERFECTLY IN THE SIMULATOR BUT WHEN I COMPILE IT TO ASM IT TELLS ME OF TWO ERRORS WHICH IT SAY CHECK TO SEE ID THERE C CODE AND IF NOT CONTACT TECHNICAL ASSISTANCE.

I BOUGHT FLOWCODE4 PACKAGE IN MAY THIS YEAR . I CHECK THE REC=VISION AND UPGRADED TO THE LATEST VERSION TODAY AND IT STILL DOES NOT HELP.

WHEN I COMPILE TO C IT DOES IT IN A SECOND AND IT TELLS ME SUCCESSFUL BUT THE 2 ERRORS WHICH ARE LISTED IN ASM COMPILING WHICH I CAN ONLY SEE IN THE C CODE AS THERE NO ASM CODE ARE ALL DONE BY FLOWCODE CONVERTING TO C

SO THERE MUST BE A BUG .

PLEASE HELP ME AS THE FORUM IS NOT FOR ME AN ANSWER RIGHT NOW

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

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby Benj » Wed Sep 01, 2010 8:31 am

Hello Ivan,

I HAVE A PROBLEM TO GET INFORMATION HOW TO ASK QUESTIONS IN THIS FORUM. THIS IS CERTAINLY NOT AN EASY WAY


Simply post your topic in the right section of the forum providing as much detail as possible and we will do our best to try and help.

WHEN I COMPILE IT TO ASM IT TELLS ME OF TWO ERRORS WHICH IT SAY CHECK TO SEE ID THERE C CODE AND IF NOT CONTACT TECHNICAL ASSISTANCE.


Ok so what are the errors? Maybe attaching your program to this forum topic would be the best approach to allow us to help. The errors refer to line numbers in the C code. Have you crossed referenced them to see what the problem is?

User avatar
Steve
Matrix Staff
Posts: 3103
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 391 times
Contact:

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby Steve » Wed Sep 01, 2010 9:23 am


ivan sandler
Posts: 4
Joined: Tue Aug 31, 2010 11:54 am
Been thanked: 1 time
Contact:

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby ivan sandler » Wed Sep 01, 2010 6:34 pm

tTHIS IS MY THIRD MESSAGE.
I SENT ON EARLIER TODAY WITH THE ATTACHED C FILE
BUT TONIGHT I THINK I HAVE FOUND THE PROBLEM
IT ALL TO DO WITH THE FLOWCODE KEYBOARD MACRO
THE PROGRAM IS FINE AND YOU CAN COMPILE TO HEX BUT AS SOON AS YOU INCLUDE THE KEYBOARD MACRO TO TEST A KEY IS WILL NOT COMPILE TO HEX AND GIVES 2 ERRORS CONCERNING THE KEY BOARD . THIS SEEM TO BE THE SAME
THAT I HAD BEFORE

PLEASE HELP

SEE BELOW
********************************************************************************************************************

File name: C:\Documents and Settings\Ivan Sandler\My Documents\keypad test.c
Generated by: Flowcode v4.3.7.63
Date: Wednesday, September 01, 2010 20:57:35
Licence: Professional
Registered to: ivan sandler


http://www.matrixmultimedia.com


Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F877A "keypad test.c"
BoostC Optimizing C Compiler Version 6.95 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Single user Lite License (Unregistered) for 0 node(s)
Limitations: PIC12,PIC16 max code size:2048 words, max RAM banks:2, Non commercial use only


keypad test.c
Starting preprocessor: C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\pp.exe "C:\Documents and Settings\Ivan Sandler\My Documents\keypad test.c" -i C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\include -d _PIC16F877A -la -c2 -o "C:\Documents and Settings\Ivan Sandler\My Documents\keypad test.pp" -v -d _BOOSTC -d _PIC16


................

C:\Documents and Settings\Ivan Sandler\My Documents\keypad test.c(575): error: missing semicolon
C:\Documents and Settings\Ivan Sandler\My Documents\keypad test.c(510): error: failure

failure

Return code = 1

Flowcode was unable to compile the flowchart's C code due to the following errors:


If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.

FINISHED

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8544
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2456 times
Been thanked: 3528 times
Contact:

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby medelec35 » Wed Sep 01, 2010 9:11 pm

Hello ivan
You have had to post more than one message since you posted off topic. There are people with pirate copy of flowcode 4, so it is a requirement that you sign up for this forum topic by using the 'Online Resources' link in the Flowcode Help Menu to show you have a genuine copy.
Now that you have:

If I remember correctly errors of this kind is almost always caused by an unconnected pin, or a calculation that is wrong e.g Number = 23. 45 instead of Number = 23.45 (note the space where there should not be one!) Or A C code box with semicolon missing at the end.

My guess is you have loaded a flowcode example, then changed the target device, so new device has not got the same ports as the original target device. When that happens, pins become unconnected.

Right click on the keypad that is on the panel, then select 'connections'
Make sure all connections are valid, and not showing unconnected!

To check for a calculation error:
If you download Notepad++ or notepad2 (or any other notepad replacement that shows line numbering).
Then in 'Chip, 'Compiler Options' Where is says file viewer, just browse to the new notepad replacement. You only need to do this once.

Now compile to hex. Note the top line number within brackets e.g: C:\Documents and Settings\Ivan Sandler\My Documents\keypad test.c(575): error: missing semicolon
You are interested in line 575.

Next Click on 'Chip' , View C....
New notepad replacement will load. Scroll down to line 575.
Look for any mistakes along that line.
If you can't remember the lines showing up with errors, just look when the flowchart is saved for a file with extension .msg.txt
You can alternately load .c file into your editor which displays line numbers.

If you are still stuck, then if you don't mind sharing, post your flowchart (.fcf extension) then we can help you further.
If you don't mind, could you please let us know how you got on. Thanks.

Edit: After studing your C code, it looks like you have not connected the rows, only columns are connected!
Unconnected pins.jpg
Unconnected pins.jpg (81.58 KiB) Viewed 4336 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

ivan sandler
Posts: 4
Joined: Tue Aug 31, 2010 11:54 am
Been thanked: 1 time
Contact:

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby ivan sandler » Mon Sep 06, 2010 8:44 am

THANKY YOU VERY MUCH YES THE PORTS TO THE KEYPAD WERE NOT SET . NOW I CAN COMPILE TO A HEX FILE AS WELL

I SAW A LCD AND KEY BOARD PROGRAM ON YOU TUBE , BUT DID NOT DOWN LOAD IT . IT WAS THE FIRST TIME I USED THE KEYPAD.

THERE IS ONE MORE ISSUE I WOULD LIKE HELP WITH AT THE MOMENT

IF I WANT TO INSERT ANY ASM CODE ,IT GETS REJECTED . I HAVE TO REMOVE IT ,TO COMPILE.
WHAT AM I NOT DOING RIGHT
IF I WANT TO TO USE ASM COMMANDS BSF,BCF,CLRF IN THE C CODE FLOW CHART BOX IS DOES NOT ACCEPT IT

SEE MY C CODE LISTING BELOW. LINE 100 IS THE EEROR WHAT MUST I PUT
*********************************************************************************************************************************************
File name: C:\Documents and Settings\Ivan Sandler\My Documents\ASM CODE.c
Generated by: Flowcode v4.3.7.63
Date: Monday, September 06, 2010 11:04:42
Licence: Professional
Registered to: ivan sandler


http://www.matrixmultimedia.com


Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F877A "ASM CODE.c"
BoostC Optimizing C Compiler Version 6.95 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Single user Lite License (Unregistered) for 0 node(s)
Limitations: PIC12,PIC16 max code size:2048 words, max RAM banks:2, Non commercial use only


ASM CODE.c
Starting preprocessor: C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\pp.exe "C:\Documents and Settings\Ivan Sandler\My Documents\ASM CODE.c" -i C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\include -d _PIC16F877A -la -c2 -o "C:\Documents and Settings\Ivan Sandler\My Documents\ASM CODE.pp" -v -d _BOOSTC -d _PIC16


..............................................

C:\Documents and Settings\Ivan Sandler\My Documents\ASM CODE.c(100): error: error in built-in assembly
ASM CODE.c success

failure

Return code = 1

Flowcode was unable to compile the flowchart's C code due to the following errors:


If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.

FINISHED

***********************************************************************************************************************************************

//************************************************************************************
//**
//** File name: C:\Documents and Settings\Ivan Sandler\My Documents\ASM CODE.c
//** Generated by: Flowcode v4.3.7.63
//** Date: Monday, September 06, 2010 11:06:43
//** Licence: Professional
//** Registered to: ivan sandler
//**
//**
//** http://www.matrixmultimedia.com
//************************************************************************************


#define MX_PIC

//Defines for microcontroller
#define P16F877A
#define MX_EE
#define MX_EE_TYPE2
#define MX_EE_SIZE 256
#define MX_SPI
#define MX_SPI_C
#define MX_SPI_SDI 4
#define MX_SPI_SDO 5
#define MX_SPI_SCK 3
#define MX_UART
#define MX_UART_C
#define MX_UART_TX 6
#define MX_UART_RX 7
#define MX_I2C
#define MX_MI2C
#define MX_I2C_C
#define MX_I2C_SDA 4
#define MX_I2C_SCL 3
#define MX_PWM
#define MX_PWM_CNT 2
#define MX_PWM_TRIS1 trisc
#define MX_PWM_1 2
#define MX_PWM_TRIS2 trisc
#define MX_PWM_2 1

//Functions
#define MX_CLK_SPEED 19660800
#ifdef _BOOSTC
#include <system.h>
#endif
#ifdef HI_TECH_C
#include <pic.h>
#endif

//Configuration data
#ifdef _BOOSTC
#pragma DATA 0x2007, 0x3f3b
#endif
#ifdef HI_TECH_C
__CONFIG(0x3f3b);
#endif

//Internal functions
#include "C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h"

//Macro function declarations


//Variable declarations
char FCV_ERROR;



//Macro implementations

void main()
{

//Initialisation
adcon1 = 0x07;


//Interrupt initialisation code
option_reg = 0xC0;


//Loop
//Loop: While 1
while (1)
{
//C Code
//C Code:
/*Enter C code below these comments
Alternatively, to enter assembly code,
use the asm operator in front of each instruction, e.g.
asm movlw 5
or enclose several statements within an asm block:
asm
{
movlw 8
movlw4
}
*/
asm bsf gbl_FCV_ERROR "!!!!!!! I HAVE TRIED TO PUT THIS 10 DIFFERENT WAYS BUT STILL IT WONT ACCEPT IT"


//Output
//Output: ERROR -> A0
trisa = trisa & 0xfe;
if (FCV_ERROR)
porta = (porta & 0xfe) | 0x01;
else
porta = porta & 0xfe;


//Delay
//Delay: 100 ms
delay_ms(100);


//Calculation
//Calculation:
// ERROR = 0
FCV_ERROR = 0;


//Output
//Output: ERROR -> A0
trisa = trisa & 0xfe;
if (FCV_ERROR)
porta = (porta & 0xfe) | 0x01;
else
porta = porta & 0xfe;


//Delay
//Delay: 100 ms
delay_ms(100);


}


mainendloop: goto mainendloop;
}

void MX_INTERRUPT_MACRO(void)
{
}

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8544
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2456 times
Been thanked: 3528 times
Contact:

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby medelec35 » Mon Sep 06, 2010 11:21 am

Hello ivan sandler.
What about this:

Code: Select all

char error;
asm bsf _error,0

Since you are using bsf (Bit Set File) you are setting 1 bit of an 8 Bit file. Therefore you need to state after comma what bit you would like to set.

Also If using a C variable or register within ASM you can precede variable with and under score e.g movwf _trisa
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
Steve
Matrix Staff
Posts: 3103
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 391 times
Contact:

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby Steve » Mon Sep 06, 2010 1:02 pm

To access the Flowcode variable "error" in ASM, you might need to use "_FCV_ERROR" when using BoostC as the compiler, e.g.

Code: Select all

asm
{
  bsf _FCV_ERROR, 5
}

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8544
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2456 times
Been thanked: 3528 times
Contact:

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby medelec35 » Mon Sep 06, 2010 3:03 pm

steve wrote:To access the Flowcode variable "error" in ASM, you might need to use "_FCV_ERROR" when using BoostC as the compiler, e.g.

Thanks steve.
You can correct me of course, but I believe if you use:
char FCV_ERROR;
then you can use
asm
{
bsf _FCV_ERROR, 5
}

However also with boost C
You can also use:

char error;

Then you will need to use:
asm
{
bsf _error,5
}

What would be the differnce please?
Is first one Global and 2nd one local?
Thanks
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
Steve
Matrix Staff
Posts: 3103
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 391 times
Contact:

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby Steve » Tue Sep 07, 2010 5:53 am

My post simply refers to variables that are declared as Flowcode variables rather than variables declared within the C code itself.

Declaring the variable in the C code using "char error;" means the variable is only "visible" in the C code and cannot be used within any other Flowcode icons (other than the "C" icon).

Any variable declared within Flowcode (e.g. "Error") is declared in the C code with the prefix "FCV_" and is capitalised (e.g. "FCV_ERROR"). Any variable declared in C code in then accessible via assembly with a single underscore prefix (e.g. "_FCV_ERROR").
These users thanked the author Steve for the post:
medelec35 (Fri Oct 22, 2010 11:44 am)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8544
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2456 times
Been thanked: 3528 times
Contact:

Re: MY PROGRAM WILL NOT COMPILE TO ASM OR THE CHIP

Postby medelec35 » Tue Sep 07, 2010 11:47 am

That's very useful information.
Thanks for the explanation
Steve.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.