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 in simulation working but not on Matrix MM HP-488-
Moderator: Benj
-
- 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-
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
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
-
- 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-
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: 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: 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
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: 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: 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
-
- 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-
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
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