Why Doesnt my send level not work
Gfull
Junior Member
I was wondering if i'm changing the volume on the processor and parsing the data out to an variable (in this case cVolume), shouldn't this update my bargraph if i use the send level in an active statement.
The Parsing does work i can see cvolume update with the right info instantly whenever i hit volume up or down.
dTP[2] is 10002:1:0
The Bargraph is set to passive with a range of 0-255, level port 1, level code 1
Another thing i'm not sure about is how to convert the values in cVolume which range from hex 0C (+12db) to hex B0 (-80) to something that i can display in the bargraph with a range of 0-255 or 0-100.
Any help will be appreciated
DATA_EVENT [dvSerial_MC8]
{
ONLINE:
{
send_command dvSerial_MC8, "'SET BAUD 19200,O,8,1'"
send_command dvSerial_MC8, "'HSOFF'"
send_command dvSerial_MC8, "'XOFF'"
send_command dvSerial_MC8, "'CHARD-0'"
}
STRING:
{
LOCAL_VAR CHAR cTRASH[100]
LOCAL_VAR CHAR cStatus_Buffer[100]
SELECT
{
ACTIVE(FIND_STRING(cMC8_Buffer,"$F1,$07,$05,$04,$14,$01,$06",1)):
{
cStatus_Buffer=REMOVE_STRING(cMC8_Buffer,"$F2",FIND_STRING(cMC8_Buffer,"$F1,$07,$05,$04,$14,$01,$06",1))
cVOLUME=MID_STRING(cStatus_Buffer,8,1)
SEND_LEVEL dTP[2],1,ATOI(cVOLUME)
}
}
CLEAR_BUFFER cMC8_Buffer
}
}
The Parsing does work i can see cvolume update with the right info instantly whenever i hit volume up or down.
dTP[2] is 10002:1:0
The Bargraph is set to passive with a range of 0-255, level port 1, level code 1
Another thing i'm not sure about is how to convert the values in cVolume which range from hex 0C (+12db) to hex B0 (-80) to something that i can display in the bargraph with a range of 0-255 or 0-100.
Any help will be appreciated
DATA_EVENT [dvSerial_MC8]
{
ONLINE:
{
send_command dvSerial_MC8, "'SET BAUD 19200,O,8,1'"
send_command dvSerial_MC8, "'HSOFF'"
send_command dvSerial_MC8, "'XOFF'"
send_command dvSerial_MC8, "'CHARD-0'"
}
STRING:
{
LOCAL_VAR CHAR cTRASH[100]
LOCAL_VAR CHAR cStatus_Buffer[100]
SELECT
{
ACTIVE(FIND_STRING(cMC8_Buffer,"$F1,$07,$05,$04,$14,$01,$06",1)):
{
cStatus_Buffer=REMOVE_STRING(cMC8_Buffer,"$F2",FIND_STRING(cMC8_Buffer,"$F1,$07,$05,$04,$14,$01,$06",1))
cVOLUME=MID_STRING(cStatus_Buffer,8,1)
SEND_LEVEL dTP[2],1,ATOI(cVOLUME)
}
}
CLEAR_BUFFER cMC8_Buffer
}
}
Comments
-
Are you seeing the level fire in Diagnostics?
-
Keep in mind that hex is a 2's compliment of the signed integer value. You'll need to convert it to an unsigned integer then scale it to 255 for the bar graph.
-
kbeattyAMX wrote: »Keep in mind that hex is a 2's compliment of the signed integer value. You'll need to convert it to an unsigned integer then scale it to 255 for the bar graph.
The sign bit is the most significant bit. If it is 1 the value is negative and 0 for positive. If positive the value is directly representing the integer. If negative, subtract 1 and do a binary not. Then the value represents the unsigned integer of the negative value. -
ericmedley wrote: »Are you seeing the level fire in Diagnostics?
Just tried and no i don't see any level events happening in device notifications. Still don't see why the send level isn't working. -
Just tried and no i don't see any level events happening in device notifications. Still don't see why the send level isn't working.
Can you put up the DEV array for dTP[2] ?
Also, you might put a boink in the Select/Active statement to see if the condition is genuinely ever met.
I will put send_command dv_panel,'adbee' sometimes or send_string(o),'it happened' or something of that nature. -
ericmedley wrote: »Can you put up the DEV array for dTP[2] ?
Also, you might put a boink in the Select/Active statement to see if the condition is genuinely ever met.
I will put send_command dv_panel,'adbee' sometimes or send_string(o),'it happened' or something of that nature.
You can't send the value in cvolume because it's not an integer equivalent. -80db is $B0 = 176 and $0C is +12. -
ericmedley wrote: »Can you put up the DEV array for dTP[2] ?
Also, you might put a boink in the Select/Active statement to see if the condition is genuinely ever met.
I will put send_command dv_panel,'adbee' sometimes or send_string(o),'it happened' or something of that nature.
Sure... its down below and i tried a test statement earlier
dvTP1 = 10001:1:0
dvTP2 = 10002:1:0
dev dTP[] = {dvTP1,dvTP2} -
kbeattyAMX wrote: »You can't send the value in cvolume because it's not an integer equivalent. -80db is $B0 = 176 and $0C is +12.
Here is the full string that comes back whenever you change the volume
F1,7,5,4,14,1,6,F6,F2
The only value that changes is position 8 (F6) regardless if its a negative value or not
i hope you can forgive my limited understanding of 2's compliment and all.. but i only see one byte changing
And i thought that by using Atoi it would change the value to a signed integer or do i have to do slong atoi -
Sure... its down below and i tried a test statement earlier
dvTP1 = 10001:1:0
dvTP2 = 10002:1:0
dev dTP[] = {dvTP1,dvTP2}
What is the current range of the bar graph in the touchpanel? All negative values will be greater than 128. -
2 compliment is a way to represent a negative value with 8 bits.Here is the full string that comes back whenever you change the volume
F1,7,5,4,14,1,6,F6,F2
The only value that changes is position 8 (F6) regardless if its a negative value or not
i hope you can forgive my limited understanding of 2's compliment and all.. but i only see one byte changing
And i thought that by using Atoi it would change the value to a signed integer or do i have to do slong atoi
11111111 = -1
00000001 = 1 so
$B0 = 10110000 but because the 8th bit is on, it's a negative number.
So subtract 1 from $B0 and you get $AF = 10101111 Ones complement is 01010000
Which is 80 without the sign. -
kbeattyAMX wrote: »What is the current range of the bar graph in the touchpanel? All negative values will be greater than 128.
range low =0
range high =255 -
kbeattyAMX wrote: »2 compliment is a way to represent a negative value with 8 bits.
11111111 = -1
00000001 = 1 so
$B0 = 10110000 but because the 8th bit is on, it's a negative number.
So subtract 1 from $B0 and you get $AF = 10101111 Ones complement is 01010000
Which is 80 without the sign.
Here's how you program it.
Our range would be 92 (80 + 12)
If (cVolume band $80) //negative value
{
cVolume = 80 - (bnot (cVolume -1))
}
else
{
cVolume = 80 + cVolume
}
BarVolume = (cVolume*255)/92
Something like this. I'm sure there's typos. -
kbeattyAMX wrote: »Here's how you program it.
Our range would be 92 (80 + 12)
If (cVolume band $80) //negative value
{
cVolume = 80 - (bnot (cVolume -1))
}
else
{
cVolume = 80 + cVolume
}
BarVolume = (cVolume*255)/92
Something like this. I'm sure there's typos.
Thanks KB I'll give it a shot -
Thanks KB I'll give it a shot
I'm getting warnings on using a char in a math operation.. and i cant parse the data to a integer.. is there a way to convert a char to an integer and achieve the same results -
never mind ......i know how its been a long day
-
You could type cast it. Keep in mind that cVolume has a value in it. That value could be interpreted as an ascii, hex or decimal. If it is to be interpreted as an ASCII it needs to be coded as an ASCII. The Programmer intended $31 to be an ASCII '1' not just decimal 49. The value in cVolume might have an ASCII representative character but it was programmed to be 2 compliment. So just because you have it typed as a character in AMX doesn't change the value that is stored. Just typecast it.
-
I had a similar thing a while ago, where the bargraph was 0 - 144, where 0 was -60dB and 144 was +12dB, incrementing by .5 dB.
I seem to remember using ITOHEX and HEXTOI, but I think there was a problem getting a 'real' volume number back - i.e. it was fine getting e.g. $0A and converting it to an Integer 10. But then I couldn't relate that to the actual dB value as I couldn't then convert that ASCII 10 into -55, I got a 'NO CONVERSION FOR DOUBLE PRECISION' warning from the notifications whether my variable was a SINTEGER, a FLOAT, or a DOUBLE. -
I'm getting warnings on using a char in a math operation.. and i cant parse the data to a integer.. is there a way to convert a char to an integer and achieve the same results
That generally means a CHAR array, not a simple CHAR ... you can do math on simple CHARs. If you have it in double quotes, it will be treated like string (CHAR array) of size one, so that is something to look for as well.
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums