MACRO issue???

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

MACRO issue???

Post by Ron »

Hi,

I have been working with macros. I have macro 'A' and needed a similar macro 'B' so I copied the code from Macro 'A' and placed it in the new macro 'B'. I got the error message about the local variables not being correct. The new macro 'B' had variable names such as.... macroA.first, macroA.second and so on.

I created the proper local variables and went through and changed all of the 'A' variable to the proper 'B' variable in macro 'B'.

I am now having an issue with some code and I cannot determine where the problem is.

Question - If I do what I describe above, will the code compile properly once all the 'A' vars are changed to 'B' vars in macroB?

Thank you,

Ron

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: MACRO issue???

Post by medelec35 »

Hi Ron,
Not sure if the following will work but maybe worth a try?
Delete your new macro, and export your original macro.
Also within macro menu select 'Edit macro details' and rename your original macro.
Now using Macro menu, import your saved macro.
You should now have a copy of original macro. Nor sure If you will need to alter local variable names or not?

Martin
Martin

Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

Re: MACRO issue???

Post by Ron »

Hi Martin,

I did this and it has not helped.

Thanks for the idea, it was worth a try.

Ron

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: MACRO issue???

Post by JonnyW »

Hi Ron, what Martin suggested should work. What compiler error messages are you getting? If you post some details perhaps someone can mod your file or say what is wrong. To answer your original question yes, so long as macroA compiles OK, macroB should also compileonce all the names are changed.

Of course, an alternative is to upgrade to Flowcode v5 which has a 'duplicate macro' option for all macros (including main()).

Hope you get it sorted,

Jonny

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: MACRO issue???

Post by Steve »

Hi Ron,

If you post your file here then someone will have a look into this problem.

Regards,
Steve.

Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

Re: MACRO issue???

Post by Ron »

Hi,

I need to clarify something. My project compiles with the way I originally discussed.

I am working with RS485 and am trying to communicate with a slave I/O board using MODBUS RTU (38.4K baud). I am getting many errors when I try to read the inputs say 5 - 8% errors, and get almost no errors <1% when writing the outputs. Since all the cables/connectors are the same it makes no sense to me. The I/O board manufacturer says the problem is not them. this is a brand new board however so I am wondering if there is a timing issue on their side.

I have used a pickit 2 in UART mode to sniff the RS485 network. It always look like I am sending a good packet and the sniffer 'sees' the proper response. I still get dumped into my error code to try to retry. I cannot figure out how the problem can be on my side if I can write to the boards outputs with almost no errors.

I was wondering if cutting and pasting the way I did would cause some internal error that the compiler might not catch.

Does anyone know of a good terminal/sniffer program to capture the serial data so I can see the data. I just realized that the pickit 2 sniffer is missing some bytes on my packets when I first start up, I know the bytes are sent, wondering if the pickit 2 is missing anything else.

Thanks,

Ron

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: MACRO issue???

Post by Benj »

Hello,

We sell this digital analyzer which is really good at debugging problems like this.

http://www.matrixmultimedia.com/product.php?Prod=EB070

It supports protocols like I2C, SPI, Async, USB, CAN, 1-Wire, PS/2, SMBus and more and also includes a signal generator.

Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

Re: MACRO issue???

Post by Ron »

Hi,

Will it work with V3??

Will it work with RS232/485??

Thanks...

Ron

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: MACRO issue???

Post by Benj »

Hi Ron,

It will work with any version as it does not require Flowcode. Its basically just an 8 channel digital logic analyser with Windows software for analysing or injecting data.

It works with TTL asynchronous serial data which is what the microcontroller UART can input or output. You would then use some kind of level shifting from the UART signals to drive RS232 or RS485 data. Eg the MAX232 chip used on our EB015 RS232 E-block.

Post Reply