'Switches in simulation working but not on Matrix MM HP-488-

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

'Switches in simulation working but not on Matrix MM HP-488-

Post by christoph »

Hi,
I wonder if anyone could give me a clue as to why I cant get the HP-448 development board switches to input or have any effect although it all works fine in simulation. In fact I have NEVER been able to use them in spite of the fact that all my projects with switches worked fine!? The simple flowchart is attached. Any ideas - obviously something I'm not doing correctly, I do realise!
switches with LCD.fcf
(13 KiB) Downloaded 372 times

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: 'Switches in simulation working but not on Matrix MM HP-

Post by christoph »

Hi,
I should mention I posed simalar question a year ago but I am not intending to actually use inputs A4 or A5(MCLR) and using internal oscillator so would be using A6 & A7 thus making 6 inputs available. However, NONE of the 6 work re the board.
Chris

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: 'Switches in simulation working but not on Matrix MM HP-

Post by medelec35 »

Hi Chris,
Looking at the data sheet of HP88 (Assuming you have
V2).
Switches are only connected to:
A0 to A4 (J14 must be connected to Digital side)
&
B0 to B7.

On your flowchart your using an input on the Entire Port A
then means IF:
BYTE=1 is only checking switch connected to A0
BYTE=2 is only checking switch connected to A1
BYTE=4 is only checking switch connected to A2
BYTE=8 is only checking switch connected to A3
BYTE=16 is only checking switch connected to A4
BYTE=32 is only checking switch connected to A5 (Switch Does not exist)
BYTE=64 is only checking switch connected to A6 (Switch Does not exist)
BYTE= 128 is only checking switch connected to A7 (Switch Does not exist)

So with BYTE= 128, your testing for a sinlge switch input that's not even physically place on the test board.
No other switches will be tested, so it will show on hardware as no switches are working.

You have a few options
For say switch connected to A2
Use i/p icon and select single Bit, then select 2
Thant means only A2 input is read.
So now if switch connected to A2 is closed then BYTE = 1
otherwise BYTE = 0

Or
Useful for reading multiple switches at a time or just having more than one switch connected :
On the input icon, select Entire Port and Use Masking instead of single Bit.
Then only select switches you want to use e.g switches connected to A1 and A4 then select 1 & 4
Then the:
BYTE=2 is only checking switch connected to A1
&
BYTE=16 is only checking switch connected to A4
Applies
If both switches are held down simultaneously
then the value of BYTE = 2 + 16 = 18
See attached Flowchart:
switches with LCD V2b.fcf

You can then use the switch icon:
Swich icon.png
(352 Bytes) Downloaded 3001 times
See attached Flowchart:
switches with LCD V2a.fcf

Note if only using 2 or less switches:
For 2 switches right click on a switch on your control panel and select Ext Properties.
From that you can just select number of switches your using.
Or just use single switches instead of switch bank.

There is also a third option to detect switches pressed and that is using the switch component macro and ReadState.
I can post an example if you wish, but currently ran out of time.

What you could find very helpful is watching the variable values:
Watch variables.png
(26.7 KiB) Downloaded 3001 times
To do that just with Flowchart paused (or with flowchart stopped press F8 on your keyboard)
A Variables window will pop up.
Right click in the window and select Add Variable, then just add the variables your interested in watching.

Then you can either single step by keep pressing F8 , or use 'View', 'Project Options' then choose a slower simulation speed, since if the default 'As fast as possible' is selected the the variables in the watch window will disappear.

Martin
Attachments
switches with LCD V2b.fcf
(10 KiB) Downloaded 353 times
switches with LCD V2a.fcf
(10.5 KiB) Downloaded 346 times
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: 'Switches in simulation working but not on Matrix MM HP-

Post by christoph »

Hi Martin,
My HP488 is actually version 3 but I assume it is similar in respect of the detail in question. The print on my copy of the scematic is so poor its unreadable so I will need to enlarge it on screen to write in the tie-insas they ARE rather than my assumptions! Thankyou soooo... much for that explanation - I fully understand now and this will be SO usefull for the future as in the past I have just had to rely on the simulation giving me the thumbs up and 95% of the time it does BUT this will be MUCH better! If you have a moment I would like an example of 'switch component macro and ReadState' but ONLY if and when you have a moment!!
I was pleased to see Benj gave you thanks re all that useful info and big thanks from me!
Cheers, Chris

Post Reply