Using the Hi Injector [Solved]

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Using the Hi Injector [Solved]

Post by QMESAR »

Hi All.

Please help an old man it seams I lost my brain :D
I would like to use the Serial monitor in the tools sections(which says it allows for connecting to a com port)
I would like send some data from my micro with UART to my virtual comport take this data in FC and display it on some gauges and dials.

However besides the small popup which says what the serial monitor is searching the wiki I found no results in helping me to get it up and running
can you guys refer me to the help of this component or explain me in short how to do this
I have done this in the past with the simulation components and just us the com port however I noticed now in FC7 we have this component and would like to use it

:oops: Sorry if I miss some basics here
Attachments
1.jpg
1.jpg (7.99 KiB) Viewed 3586 times
2.jpg
2.jpg (34.42 KiB) Viewed 3586 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: Using the Hi Injector

Post by Benj »

Hello Peter,

The Serial Monitor is an easy way to pipe data through to the console window without having to use any component macros. You can type data into the console RX Queue tab which will be sent out and you can view incoming data in the Data tab. This is similar to the terminal window available in the Arduino IDE and is useful if you want to add debug statements to your embedded program and then follow along in the Flowcode simulation. I believe the Serial Monitor console tabs will work even when the simulation is not running.

For using the data in your simulation program you have to use either the UART or COM Port component. The COM Port component is currently only available via the search component toolbar item.

For the UART component simply set the data source property to COM Port and set the COM Port property to the port you want to communicate with. You can then call the UART component macros as you normally would.

The COM Port component should work in a similar way, in fact this is built into the UART component to provide the simulation functionality. I hope this makes sense.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Using the Hi Injector

Post by QMESAR »

Ben.

Thank you very much !This is clear now :D
Another simple question what is the correct way in Flow code to initialize an array to zero in the dialog when you create the array :D
Attachments
12.jpg
12.jpg (57.67 KiB) Viewed 3577 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: Using the Hi Injector

Post by Benj »

Hi Peter,

Array specification and initialisation is something we have just added to the variable manager in v8.

For now in v7 the best way is to create a loop which loops through the elements in the array and sets them to your initialisation value. Sorry it's not more straightforward.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Using the Hi Injector

Post by QMESAR »

Hi Ben.
I am following your advise regarding initializing an array however I see some strange things and hope you can help me understand what I see.
I use a loop that takes a counter value(corresponding to the array elements) and add 1 to the counter and place it in the element
this works fine and in the debug window I can see the elements getting set to counter value +1
however when I do the same thing with a loop and only clear 1 element it seems in the debug window all elements are cleared and has no value inside
I would have expected all elements keep there value except the one that is set to zero(0)should show a zero(0) but in my case it shows( " ")whole string
What am I missing here :oops:
Thank a million
Peter
Attachments
1.jpg
1.jpg (43.01 KiB) Viewed 3561 times
2.jpg
2.jpg (49.78 KiB) Viewed 3561 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: Using the Hi Injector

Post by LeighM »

Hi Peter,
Byte arrays and strings are very similar, but a 0 or null at any point in the array will terminate a string, hence anything beyond the 0 will be ignored when printing a string.
If you were to zero the array from the end backwards you will see the difference.
Hope that helps,
Leigh

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Using the Hi Injector

Post by QMESAR »

leigh
I will give it ago now thanks a million :D

Post Reply