How can I edit inherited macros in new component?

A forum where Flowcode v6 user created components can be shared, discussed and reviewed.

Moderator: Benj

Post Reply
maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

How can I edit inherited macros in new component?

Post by maharadga »

Hi all.
I want create new component like thermistor EBM003, but I want increase range from -50C to 300C. I copy settings and inherit macros from EBM003 to new component but I can't edit macros called SetMinMax.
It's possible edit this macros or not?

I think tutorials how create new component or edit exist must be more detailed and understandable.
Thank You.

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: How can I edit inherited macros in new component?

Post by Benj »

Hello,

We have recently done a lot with the component creation system to vastly simplify it. This v7 update is currently pending and should be available soon.

Once we have released this we can start updating the documentation and creating some much more user friendly examples.

For now here is the EBM003 component source which you can use to create your own slant on the component.
EBM003v1.fcfx
(50.03 KiB) Downloaded 357 times
Let us know how you're getting on.

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: How can I edit inherited macros in new component?

Post by maharadga »

Thank you. I try and will reply.

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: How can I edit inherited macros in new component?

Post by maharadga »

Hi.
I make my component but have the same problem. I can't read temperature over 125C and under -25C. She's show but can't read. I think because new component EBM003v1 have inherited macros from thermistor base component. They don't allow /maybe/ increase range.
See attached files for details.
Attachments
Pt100.fcpx
(5.5 KiB) Downloaded 341 times
Pt100 read and display.fcfx
(9.19 KiB) Downloaded 338 times

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: How can I edit inherited macros in new component?

Post by Benj »

Aha, Yes you're absolutely right. Here is the source for the v6 thermistor base component so you can edit the range.
Thermistor_base.fcfx
(26 KiB) Downloaded 347 times

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: How can I edit inherited macros in new component?

Post by maharadga »

Hello.
I make RTD_base component from Thermistor_base. After that I make component Pt100 from EBM003v1r + RTD_base.
And finaly If I try read and display temperature, readings are over 25C and I can't make hex file. There's lot of mistakes
I know I was wrong but where? Calculations not my power. If anyone has some free time to look at the files and give me direction, I would be very grateful.
Thank you.
Attachments
Pt100.rar
(22.19 KiB) Downloaded 352 times

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: How can I edit inherited macros in new component?

Post by maharadga »

Hello. I edit component EBM003 and make component Pt100 with less range. From -25C to 200C. Add 3 sample points and expand range. ADC resolution is set to 10 bit. Now in simulation work normally but in compilation I see following message:


Pt100 read and display.c:
116: 450
^ (285) no identifier in declaration
^ (374) missing basic type; int assumed (warning)
^ (314) ";" expected
118: 465
^ (285) no identifier in declaration
^ (374) missing basic type; int assumed (warning)
^ (314) ";" expected
120: 479
^ (285) no identifier in declaration
^ (374) missing basic type; int assumed (warning)
^ (314) ";" expected
(908) exit status = 1
(908) exit status = 1

I attach c file, project and component. Have somebody idea what is the mistake?
Attachments
Pt100 read and display.c
(32.76 KiB) Downloaded 341 times
Pt100.fcpx
(5.45 KiB) Downloaded 322 times
Pt100 read and display.fcfx
(8.78 KiB) Downloaded 341 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: How can I edit inherited macros in new component?

Post by LeighM »

Hi,
Looks like you are making good progress.
Have a close look at how you have edited the .Expansion in Ev_AddVar
In the original code each item added is followed by

Code: Select all

.Expansion = .Expansion + ",\n"
the last item is followed by

Code: Select all

.Expansion = .Expansion + "\n};\n"
Looks like you have that last line after each of your new additions.

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: How can I edit inherited macros in new component?

Post by maharadga »

Thank you, LeighM.
You're absolutely right. Like I say calculation not my power. I simply paste and copy new Expansion but not right :=)
Thank you very, very much! Now everything is Ok.
I will made new component Pt1000, taste it in work and paste in forum.
Have a nice day!

Post Reply