Variables
ryanww
Posts: 196
I am making a favorite channel structure. I tried originally making it like so:
Define Type
STRUCTURE fav_chnls_PRAMETERS
{
CHAR NAME [20]
INTEGER chanel
}
Define Variable
persistent fav_chnls_PRAMETERS FAV_CHNLS [48]
But whenever I try to load it, it would come up with errors like:
Ref Error ^Fav_chnls index to large
I have tried taking it and just making it a single variable by doing just "persistant Fav_chnls[48]" and just loading it in that, and it still had the errors on it. I then lowered it to 12, and the same, more errors. A 12 variable array is obviously not that large. a 48 is a big variable.
I am using a NI-2100 and I believe it has a 32meg card. I have used another processor with a 20 position structure using a 20 position name and a integer and it has no problem on a 2000. I don't see why I 2100 wouldn't be able to handle it.
Thanks,
Ryan
Define Type
STRUCTURE fav_chnls_PRAMETERS
{
CHAR NAME [20]
INTEGER chanel
}
Define Variable
persistent fav_chnls_PRAMETERS FAV_CHNLS [48]
But whenever I try to load it, it would come up with errors like:
Ref Error ^Fav_chnls index to large
I have tried taking it and just making it a single variable by doing just "persistant Fav_chnls[48]" and just loading it in that, and it still had the errors on it. I then lowered it to 12, and the same, more errors. A 12 variable array is obviously not that large. a 48 is a big variable.
I am using a NI-2100 and I believe it has a 32meg card. I have used another processor with a 20 position structure using a 20 position name and a integer and it has no problem on a 2000. I don't see why I 2100 wouldn't be able to handle it.
Thanks,
Ryan
0
Comments
DEFINE_START
FAV_CHNLS[1].Name = 'CNN'
FAV_CHNLS[1].chanel = 202
FAV_CHNLS[2].Name = 'C-SPAN'
FAV_CHNLS[2].chanel = 350
//...
FAV_CHNLS[48].Name = 'NASA TV'
FAV_CHNLS[48].chanel = 376
HTH
BUTTON_EVENT [dvTP_Controls,FAV_CHNLS_BTNS]
{
PUSH:
{
SELECT
{
ACTIVE (!nEditChannel):
{
SEND_COMMAND dvCable,"'XCH ',ITOA(FAV_CHNLS[BUTTON.INPUT.CHANNEL - 1000])"
}
ACTIVE (nEditChannel):
{
SEND_COMMAND dvTP_Nav,'AKEYP'
WAIT_UNTIL (TP_DONE) 'Channel Edit'
{
FAV_CHNLS[button.input.channel - 1000].CHANNEL = TP_NUM
SEND_STRING 0,"FAV_CHNLS[BUTTON.INPUT.CHANNEL - 1000]"
}
}
}
}
}
I know the recall of some is not correct as I was switching it around.. but the storing is the problem.
I started loading some though NS, but I am just planning on loading them using a record flag from another button and then just loads a converted integer from the touch panel key pad.
Please edit the line to and check what it shows in terminal.
But then again, I do remember just trying it using a fixed position number like 12 and I think it still came up with the error message. I will try it again..
and I knew the debug line was off.. just too busy doing other things..
Thanks,
Ryan
BUTTON_EVENT [dvTP_Controls,FAV_CHNLS_BTNS]
{
PUSH:
{
LOCAL_VAR INTEGER CURRENT_CHNL
CURRENT_CHNL = BUTTON.INPUT.CHANNEL - 1000
SELECT
{
ACTIVE (!nEditChannel):
{
SEND_COMMAND dvCable,"'XCH ',ITOA(FAV_CHNLS[BUTTON.INPUT.CHANNEL - 1000])"
}
ACTIVE (nEditChannel):
{
SEND_COMMAND dvTP_Nav,'AKEYP'
WAIT_UNTIL (TP_DONE) 'Channel Edit'
{
FAV_CHNLS[CURRENT_CHNL] = TP_NUM
SEND_STRING 0,"'FAV_CHNLS'"
SEND_STRING 0,"'CHANNEL SENT',ITOA (FAV_CHNLS[CURRENT_CHNL])"
}
}
}
}
}
I could also do a get last on the channel structure of the buttons I suppose.. but either way..
You need to change the line:
SEND_COMMAND dvCable,"'XCH ',ITOA(FAV_CHNLS[BUTTON.INPUT.CHANNEL - 1000])"
To:
SEND_COMMAND dvCable,"'XCH ',ITOA(FAV_CHNLS[BUTTON.INPUT.CHANNEL - 1000]. chanel)"
Or
SEND_COMMAND dvCable,"'XCH ',ITOA(FAV_CHNLS[CURRENT_CHNL]. chanel)"
The same goes for the SEND_STRING 0 statements.
You also need to change the line:
FAV_CHNLS[CURRENT_CHNL] = TP_NUM
TO:
FAV_CHNLS[CURRENT_CHNL].chanel = TP_NUM
I prefer using GET_LAST() over BUTTON.INPUT.CHANNEL-(some offset) because it?s more flexible. But just because I would do it that way doesn?t make your way any less correct.
Happy channel changing.
SEND_COMMAND dvTP_Nav,'AKEYP'
oops...
but hey, I got it now. Thanks for all your help as always,
Ryan