Using the Data Scope

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

Moderator: Benj

Post Reply
viki2000
Posts: 190
Joined: Mon Jul 07, 2014 9:38 am
Has thanked: 30 times
Been thanked: 77 times
Contact:

Using the Data Scope

Post by viki2000 »

Based on the help page from here:
http://www.matrixtsl.com/wiki/index.php ... Data_Scope
I tried to test the given example under “Adding a digital pin or port to a stream” by monitoring the pin A0 when turning on/off a LED.
Here is the program:
PIC18F4550_SCOPE_LED.fcfx
Using the Data Scope - LED on pin A0
(5.46 KiB) Downloaded 242 times
But it is not working, I cannot see any trace as rectangular signal on oscilloscope and I am wondering what is wrong?

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 Data Scope

Post by Benj »

Hello,

You were very close but had missed the stream handle variable. I have added this now and your program should work correctly and give you a trace on the scope (note you might have to zoom in a bit to see the values).
PIC18F4550_SCOPE_LED.fcfx
(6.28 KiB) Downloaded 258 times

viki2000
Posts: 190
Joined: Mon Jul 07, 2014 9:38 am
Has thanked: 30 times
Been thanked: 77 times
Contact:

Re: Using the Data Scope

Post by viki2000 »

Thank you for clarification.
Now is working indeed.

Reading the online help I notice next:
On the next page:
http://www.matrixtsl.com/wiki/index.php ... Data_Scope
I see a "0" for PackMask:
Ex1_a.jpg
(133.9 KiB) Downloaded 635 times
Ex1_b.jpg
(110.9 KiB) Downloaded 635 times
But then on the next page:
http://www.matrixtsl.com/wiki/index.php ... Scope_Test
I see a "1" for PackMask:
Ex2.jpg
(116.55 KiB) Downloaded 635 times
Is it a mistyping mistake?

viki2000
Posts: 190
Joined: Mon Jul 07, 2014 9:38 am
Has thanked: 30 times
Been thanked: 77 times
Contact:

Re: Using the Data Scope

Post by viki2000 »

I have one more problem related with the settings of the Data Scope above code example.
I notice that for LED connected at pin A0, we have to set for PortIndex the value 0 and then for BitMask value 0x01.
Then if I want the same code, but with the LED connected on pin B3, then theoretically I should set for PortIndex the value 1 and then for BitMask value 0x04.
Is that right?

Well, is not working. For sure one more setting is needed and I do not know what.
I have tried the LED connected on pin A0 and pin A1 and is working good.
When I connect to pin A3 or A4 or B3 or B4, then the Data Scope is not working anymore.
Is it related with the fact that pin A0 and pin A1 are pure digital/analog, one single function (RA0/AN0 and RA/AN1) and the other pins have multiple functions (RB3/AN9/CCP2/VPO)?
If yes, then we solve the problem to see the siganl on DataScope at pin B3 for instance?
PIC18F4550_SCOPE_LED_PORTB.fcfx
(5.66 KiB) Downloaded 238 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 Data Scope

Post by Benj »

Hello,

To get RB3 working I changed the mask from 0x04 to 0x08, 0x04 is the mask for bit 2.

0 = 0x01
1 = 0x02
2 = 0x04
3 = 0x08
4 = 0x10
5 = 0x20
6 = 0x40
7 = 0x80
PIC18F4550_SCOPE_LED_PORTB.fcfx
(5.66 KiB) Downloaded 232 times
Regarding the pack mask question the setting only really applies if your using multiple bits on a single stream.

For example if your using 2 bits then 0b00 = 0% on the scope, 0b01 = 33%, 0b10 = 66%, 0b11 = 100%. However if the bits are not next to each other then the packmask set to 1 will automatically bring the bits together for you.

viki2000
Posts: 190
Joined: Mon Jul 07, 2014 9:38 am
Has thanked: 30 times
Been thanked: 77 times
Contact:

Re: Using the Data Scope

Post by viki2000 »

0 = 0x01
1 = 0x02
2 = 0x04
3 = 0x08
4 = 0x10
5 = 0x20
6 = 0x40
7 = 0x80
0, 1 , 2, 3, 4, 5, 6, 7 represent the pin number. So for pin A0 we have 0 and for pin A1 we have 1 and for pin B3 we have 3 and for pin B5 we have 5.
Then the mask is (2 power (pin number)) in hex.
That means for pin A0 we have (2 power 0) = 1, so it is 0x01 the mask in hex.
That means for pin A1 we have (2 power 1) = 2, so it is 0x02 the mask in hex.
That means for pin B3 we have (2 power 3) = 8, so it is 0x08 the mask in hex.
That means for pin B5 we have (2 power 5) = 32 in decimal and 20 in hex, so it is 0x20 the mask in hex.
Now is clear the part with the mask.

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 Data Scope

Post by Benj »

Hello,

Yes that's correct.

You can also use the mask to select multiple pins so for example a port of 1 and a mask of 0xFF would give you all 8-bits of PortB on a single stream. This would then give you an analogue representation of the port bits similar to how an R2R DAC works.

Post Reply