Adc Value Monitor (read Adc) Overload

 
#1

Hi all,

I "was" having major performance problems within EZ Builder that was getting worse and worse. The program would lag badly and sometimes lock up and crash. It was driving me nuts. Window 7 was not effected but I could not decide if it was my laptop, win 7 or EZ-B. The problem got worse to the point I couldn't even click on a button or drag a window around within EZ Builder and have it react. Then EZ-B would lock up and the program would crash. I tried to have just EZ Builder running and nothing else. However testing showed Win 7 and other programs would stay up and work nicely. Then I realized that the problem had gotten worse as I added ADC port Value monitors from the Add Control feature. I have 9 ADC Value monitors running now and all were watching different ADC ports on two different boards (I plan to add more soon). Once I clicked the Pause box on all but a few ADC monitor windows all my problems went away and EZ Builder ran perfectly! No lag, no crashes.

Is this usual behavior? Seems like monitoring ADC poets is very intensive for EZ Builder. However when the lagging problem was occurring I was watching a CPU monitor and EZ-B was only using about 60% of core 2 of a dual core CPU. Has anyone else had this issue running more then a few of these monitors? Would a stronger laptop with a better graphs board run these monitors better and without lag? I'm running on an older Dell laptop with a duel core Intel Centrino now.

Now, it's not an issue since I paused most of the monitoring windows. Also now that my B9 project is mostly setup and working without issue I really see no need for the 9 or more ADC monitor windows. But they're really cool to watch as B9 is run by EZ-B.

Thanks,
Dave Schulpius

#2

It's the communication channel. If you flood it by having too many requests, the software will suffer. If you are monitoring ADC and using ReadADC() in scripts, then you are executing twice as many communication calls, which affects performance twice as much.

Remember, when the GUI is running a "read" command from the EZ-B, it has to wait until the command is read and the value is returned. The process can only be as fast as the communication channel. You may use the Benchmark Control to view the communication performance on your computer.

To monitor the ADC, do not use a graphical ADC window - instead use the Variable Watcher to view the results of your ReadADC() commands.

#3

Ahh, that splans it. Understood. Smile I also have a Variable Watcher installed to view results and that works just fine for my needs. I'm learning, slowly.

Thanks!

#4

You're doing great Grin

#5

I kinda had the same issue when I was setting up the battery monitor for Phil, it was polling for voltage as fast as it could run the script, until I added Sleep(1000) to the loop so it only polls once per second...which brought me down from 70% to 15% cpu load lol Grin I'm using win7 ultimate on an Atom n270 1.6ghz netbook with 2gb of ram....its not fast, but its very functionalGrin

:Start

Sleep(1000)
$Battvolts = GetADC(adc0) * 0.0392079031372549
If($Battvolts < 7.10)
ControlCommand("Soundboard", Track_1)
Goto(Start)

#6

Thanks! I'll see if I can use that.

#7

thanks for the "workaround" kenny. and DJ for his ever tech support! Its good to know that intensive ADC monitoring without a "sleep" can be taxing. If I might ask Dave , what are/were you doing with so many ADC monitors(enquiring minds Smile

#8

irobot58 ,

Sure, I'd love to explane:

I have 10 chest buttons on the front of B9. All are connected to momentary switches that are in turn connected to a CFSound III sound system. The cool thing about the CFSound III is that it has onboard relays that you can program to close when a momentary button is pushed and a sound file is played (on a compact flash card on the CFS III). Anyway, I have 6 ADC poets connected to 6 of those CFS III relays. one wire is from the 5vdc pin and the other is the signal pin. So when I push any of the 6 chest buttons assigned to the relays tied to the ADC ports on EZ-B, EZ-B sees the change of voltage. I can program EZ-B to execute a script that's watching that ADC port. So in short I've tied the CFS III to the EZ-B through 6 of the 10 chest momentary buttons. Does that make sense? Winky

The other 4 buttons make things happen with the CFS III like playing sound files randomly and timed randomly, play a different sound file at each button push, start up my on board Bluetooth receiver that hooks up to my laptop so I can run a program that lets me control what B9 robot phrases he recites. The 4th button will start the soil sampler and any animation other I choose to program into EZ-B.

The other ADC ports are monitoring potentiometers that give feedback for the positioning of where DC motors are.

Hope you got all that.

Dave Schulpius

#9

Dave, you could get creative and put a different value resistor on each switch and use only one adc port Smile that'd be neat - but not entirely necessary lol

#10

thanks DJ i did not think of that Grin