iwik
08-25-2015, 01:42 AM
Hi Guys,
Trying to get the attached code running properly, spent many hours but its apparent
I lack programming skills. Here is what I am trying to do:
Have a four position rotary switch and one push button switch connected to a
Buo386x card. I am reading the switch inputs from Offset 03c4, each switch
has a DEC code of 256,512,1024,2048 and the push button 4096. So depending
on which switches are active gives a unique DEC value. In two of the positions
I want to press the push button which will give a DEC value of 4096+ 1024 and
the other position will be 4096 + 2048.
When these two button combinations are selected I switch pages on a O/C
LCD module and want the page to be displayed for 10 seconds before returning
to page designated by the 4 pos switch.
The attached code does this with one exception. When I start sioc code
no pages get displayed until I press the Push Button. Then everything works as I want it.
Hope someone might be able to correct my code as I am exhausted trying all I know to
fix it.
Var 251,Link FSUIPC_IN, Offset $03c4, Length 4
{
IF V251 = 6144 // ALT
{
V200 = 3
V200 = DELAY 0 400
}
IF V251 = 5120 // ON
{
CALL V252
V200 = 3
V200 = DELAY 2 400
}
IF V251 = 4608 // STBY
{
V200 = 3
V200 = DELAY 2 400
}
IF V251 = 256 // OFF
{
V200 = 1
}
}
Var 252,Link SUBRUTINE
{
IF V251 = 1024
{
V200 = 3
V200 = DELAY 2 400
}
ELSE
{
V200 = 2
}
}
var 200 // LCD DISPLAY 2
Thanks
Les
Trying to get the attached code running properly, spent many hours but its apparent
I lack programming skills. Here is what I am trying to do:
Have a four position rotary switch and one push button switch connected to a
Buo386x card. I am reading the switch inputs from Offset 03c4, each switch
has a DEC code of 256,512,1024,2048 and the push button 4096. So depending
on which switches are active gives a unique DEC value. In two of the positions
I want to press the push button which will give a DEC value of 4096+ 1024 and
the other position will be 4096 + 2048.
When these two button combinations are selected I switch pages on a O/C
LCD module and want the page to be displayed for 10 seconds before returning
to page designated by the 4 pos switch.
The attached code does this with one exception. When I start sioc code
no pages get displayed until I press the Push Button. Then everything works as I want it.
Hope someone might be able to correct my code as I am exhausted trying all I know to
fix it.
Var 251,Link FSUIPC_IN, Offset $03c4, Length 4
{
IF V251 = 6144 // ALT
{
V200 = 3
V200 = DELAY 0 400
}
IF V251 = 5120 // ON
{
CALL V252
V200 = 3
V200 = DELAY 2 400
}
IF V251 = 4608 // STBY
{
V200 = 3
V200 = DELAY 2 400
}
IF V251 = 256 // OFF
{
V200 = 1
}
}
Var 252,Link SUBRUTINE
{
IF V251 = 1024
{
V200 = 3
V200 = DELAY 2 400
}
ELSE
{
V200 = 2
}
}
var 200 // LCD DISPLAY 2
Thanks
Les