Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Bolt on December 12, 2019, 06:11:11 PM

Title: JSONBUILD causing Error
Post by: Bolt on December 12, 2019, 06:11:11 PM
I have this JSONBUILD instruction, containing two number "1"s (as placeholders).  Could these numbers be causing the attached errors?
Title: Re: JSONBUILD causing Error
Post by: Bolt on December 12, 2019, 07:15:55 PM
I got smart and loaded the instruction into the Simulator.  It results in a CRITCAL ERROR! Math stack underflow!, Program was halted due to an invalid instruction.

Creating a Symbolic Constant with a value of 1 does the same thing.  V0 = 1 works fine.

I also noticed that running the attached program in the Simulator, Stage 22 will run as soon as the Simulator is moved from Stop to Run.  That doesn't sound right?
Title: Re: JSONBUILD causing Error
Post by: franji1 on December 12, 2019, 08:43:20 PM
To try to diagnose the issue, eliminate the Stage.  SG S22 is the initial stage (that's what the double box means), but it appears you only want S22 to fire when X1 goes from OFF to ON.  The Initial Stage will run whenever the code block test is RUN, regardless of X1.

Just have X1 drive the JSONBUILD and the STRINSERT.

What is in SS60?
Title: Re: JSONBUILD causing Error
Post by: Bolt on December 12, 2019, 08:54:49 PM
Oh yes, I forgot that aspect when throwing the simulator project together. Makes sense.  My real projects have a main stage with "proper" logic.
Back to the original problem, in both BRX and simulator, having a number or symbolic constant in the JSONBUILD reboots the PLC. SS60 was blank in the sim, and
Code: [Select]
'2019-12-12' in the original project.
Title: Re: JSONBUILD causing Error
Post by: franji1 on December 12, 2019, 09:21:14 PM
I did something close to what you have, with symbolic constants Juan 1 and Too 2, and it works fine.   ???  (see attachment)

This isn't your issue with JSONBUILD, but for JSON grammar, make sure your SS60 string is enclosed in double quotes, since it is text, and not a simple number, null, true, or false.
Title: Re: JSONBUILD causing Error
Post by: Bolt on December 12, 2019, 09:48:04 PM
Gotcha. Now try replacing a V0 source element with Juan, Too or 3, and you'll bring the PLC to its knees for a second
Title: Re: JSONBUILD causing Error
Post by: franji1 on December 13, 2019, 09:46:30 AM
OK.  Sorry about that.  That makes a HUGE difference.  I should have gotten that.

Yes, this IS a major issue.  For now, please do NOT use NUMERIC CONSTANTs in the Field Type/Value field.  Bad things are happening in the PLC if you do that.

We will address this and have a proper fix in a future release.

Thanks for finding this and letting us know.  It's a little more work on your side for this work-around.  Sorry about that.
Title: Re: JSONBUILD causing Error
Post by: Bolt on December 13, 2019, 09:56:47 AM
No problem. I only added the constants to fill spots in order to match the layout of another string.  I have since quit doing so already and simply using a blank variable! Thanks!
Title: Re: JSONBUILD causing Error
Post by: Bolt on May 27, 2020, 07:57:37 PM
Yes, this IS a major issue.  For now, please do NOT use NUMERIC CONSTANTs in the Field Type/Value field.  Bad things are happening in the PLC if you do that.

We will address this and have a proper fix in a future release.

Thanks for finding this and letting us know.  It's a little more work on your side for this work-around.  Sorry about that.

Did this ever get fixed?

Also, I'm having trouble adding a Device's data to a JSONBUILD Array.  For example, adding $HighSpeedCounter.Acc results in
Code: [Select]
Number of Elements (1) is invalid with Start of Source ($HighSpeedCounter.Acc) element
Simply copying $HighSpeedCounter.Acc to D0, then adding D0 to JSONBUILD works, but seems silly.  What am I missing?
Title: Re: JSONBUILD causing Error
Post by: franji1 on May 28, 2020, 09:54:06 AM
Did this ever get fixed?
Should be in the latest firmware.  Is it not working?

Quote
Also, I'm having trouble adding a Device's data to a JSONBUILD Array.  For example, adding $HighSpeedCounter.Acc results in
Code: [Select]
Number of Elements (1) is invalid with Start of Source ($HighSpeedCounter.Acc) element
Simply copying $HighSpeedCounter.Acc to D0, then adding D0 to JSONBUILD works, but seems silly.  What am I missing?

Yeah, that's a bug.
Title: Re: JSONBUILD causing Error
Post by: Bolt on May 28, 2020, 05:45:00 PM
Quote
Should be in the latest firmware.  Is it not working?

Heck if I know, too scared to try!

Quote
Yeah, that's a bug.

Good to know I'm not going (completely) crazy.
Title: Re: JSONBUILD causing Error
Post by: franji1 on June 01, 2020, 12:13:00 PM
Tried it.  It works in 2.7.4 firmware (see screen shot).