I have applied background agent in my windows phone app and I want my app to run in every 1 min.
for that i have given "FromMinutes(1)" but now I want to pass time dynamically like
TimeSpan.FromMinutes()..want to pass any minutes 1 or 10 or 15 dynamically
#if DEBUG
ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(60));
#endif
Now I'm doing it like this
#if DEBUG
//myinput is the dynamic time given by the user, it varies form user to user.
int myinput = 10;
ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromMinutes(myinput));
#endif
Related
I have a particle system, a material and I have 10 different textures to choose from. Is there a way to randomize the texture every 5 seconds for my emitter?
Use the Loop animation 'Looped' pulse to trigger the random value every time it completes a loop. Floor the random value so it outputs a whole number and then put the output from that into an Option Picker to choose the Texture.
patch example
I want Even number List of a string in web methods development . If i give input string,i want Even number of that input string in web methods flow steps.
ex input number 10
output number 2 4 6 8
make a loop over a stringList
inside a loop call Java servis (build it yourself), that will check modulo of iteration number.
check modulo in a branch.
Goal of the project: To connect an LCD with 8051 as an external memory-mapped I/O device
Problem: Given the following details, my 8051 controller just does not generate an external RD/WR command as required for the rest of the code to work.
Previous work: I used 8051 port 3 pins to generate EN, R/W and RS signals and got it to work. Therefore, I know that my command sequence is working fine. However, this was a really inefficient way of using the LCD because the enable pulse was generated by setting and resetting a port pin. I wish to connect the LCD using the external WR/RD signals and mapping it as a memory-mapped IO device. I have worked through the timing diagrams and the overall block diagram is attached here. As you can see (in the block diagram), the R/W line of LCD is activated using the most significant 6 pins of port 2 so that the LCD gets activated only at the right memory addresses. This operation (implemented in an SPLD) also serves to ensure the delay required at the LCD to ensure the minimum setup time after Port 2 pins 0,1 are used to set inputs at R/W and RS signals of LCD.
Additional hardware info: I have attached a spice diagram to show how the rest of my 8051 is connected. The one thing that is not included there is this: "I use a momentary pushbutton and pull-down resistor for /PSEN, and hold that button when coming out of reset in order to force bootloader operation; then, after the bootloader has started, I release that button to eliminate drive fight issues on the /PSEN line. I use a header/jumper for the /EA input to ensure it is high. Note that if you use these hardware conditions to enter the bootloader when you come out of reset, then the Atmel bootloader is entered regardless of the values of BLJB, BSB, and SBV."
Software used: I am using the paulmon2 to test my code. Programming is done using Flip utility: Flip 3.4.7 through the serial port. A serial emulator program (TeraTerm) is used to communicate with the microcontroller. The microcontroller first executes the paulmon code as well as its extra commands that have been programmed into it before the current user code at 0x2000 location. An extra command allows the user to jump to this code using 'J' command and then giving the address for memory: 0x2000. This calls the current
program and executes it. This is where my code resides and executes from.
The addresses used to map LCD are the following:
LCD_INSTR_WR: 0xA8FF ---> Used to write commands to LCD controller.
This includes all initialization and setup and management commands.
LCD_INSTR_RD: 0xA9FF ---> Used to read command. Done only to read the busy
flag or the current address counter. This is valid only for a single
instruction on the LCD.
LCD_DATA_WR: 0xAAFF ---> Used to write Data to the current address which has
been set either in DDRAM or CGRAM given the LCD_INSTR_WR above.
LCD_DATA_RD: 0xABFF ----> Used to read Data from the current address which
has been set either in DDRAM or CGRAM given the LCD_INSTR_WR above.
The code snippet I write in C to write the external memory:
//Global variables
volatile unsigned char xdata *LCD_INSTR_WR = (char xdata *) 0xA8FF;
volatile unsigned char xdata *LCD_INSTR_RD = (char xdata *) 0xA9FF;
volatile unsigned char xdata *LCD_DATA_WR = (char xdata *) 0xAAFF;
volatile unsigned char xdata *LCD_DATA_RD = (char xdata *) 0xABFF;
/// More code
//Write command example
lcdbusywait();
* LCD_DATA_WR = cc;
Earlier tests one to figure out the problem:
I have tried writing to the memory locations above 2000 using the paulmon memory edit instructions and they write the memory locations alright. Even /WR command is generated in this case as observed (but I have not properly measured/counted the accesses and /WR edge changes.
I have used the logic analyser to confirm that the address (and consequently RS and RW) and data (0x30H command in the beginning) are coming to the ports as expected. ALE is being generated.
I have verified that AUXR register bit EXTRAM is set (AUXR = 0x0E). Also, since EXTRAM is set by default, I tried to remove my initialization code for AUXR completely and that didn’t work either.
I was not sure that the C code that I have written for the XRAM address accesses is correct. However, I went on to check the .asm file and (unless I am neglecting something very minute), the assembly code generated does assign a 0x30h value as immediate data to a register A and uses a “MOVX #dptr,A” instruction to write this value to external memory.
Finally, this is my first post at Stack overflow so the formatting may be off and I do realize this is an extremely long post. Apologies for that. Let me know if you need to see the code files or the compiled hex file or other details. All your help is deeply appreciated.
volatile unsigned char xdata *LCD_INSTR_WR = (char xdata *) 0xA8FF;
I guess LCD_INSTR_WR should have address0xA8FF value.
You can try by using
#define LCD_INSTR_WR XBYTE[0xA8FF]
and then
LCD_INSTR_WR = cc;
or
char xdata LCD_INSTR_WR _at_ 0xA8FF; //This will declare the LCD_INSTR_WR at location 0xA8FF-
You may need to look into the data sheet of the micro controller how to configure extrnal memory
LCD_INSTR_WR = cc;
In windows phone store, there are have an app named TimeMe Tile, it can update current time on Tile every 1 minute, I am very curious how it is implemented, as far as know, the period of background task is 30 minutes.
Here is this app's link:
http://www.windowsphone.com/zh-cn/store/app/timeme-tile/ef6099f2-41dd-4bad-9fa1-8f4143386194
Thank you.
If you have predictable tile information (like the time) then you can schedule the tile notifications ahead of time with the ScheduledTileNotification class. Scheduled notifications will fire even if the app itself is not running. The app only needs to run (in the foreground or as a background task) to schedule the notification.
You can schedule a tile to update every minute for the next hour something like the following:
int min = 0;
for(min=0;min<60;min++)
{
// Create a tile template with whatever we want to show
XmlDocument tileXml = GenerateTileTemplate(min);
// Schedule it for min minutes from now
DateTime dueTime = DateTime.Now.AddMinutes(min);
ScheduledTileNotification scheduledTile = new ScheduledTileNotification(tileXml, dueTime);
TileUpdateManager.createTileUpdaterForApplication().AddToSchedule(scheduledTile);
}
For a fuller example see How to schedule a tile notification.
If the tile needs to have more timely data that can't be predicted then you'd need to push a notification from off-system to include that information more often than the app can get CPU time.
Per Adobe getTimer() is:
Used to compute relative time. For a Flash runtime processing ActionScript 3.0, this method returns the number of milliseconds that have elapsed since the Flash runtime virtual machine for ActionScript 3.0 (AVM2) started.
Since getTimer returns a int which:
The int class lets you work with the data type representing a 32-bit signed integer. The range of values represented by the int class is -2,147,483,648 (-2^31) to 2,147,483,647 (2^31-1)
What will getTimer() return after the 2,147,483,647 millisecond? That would roughly be 24.85 straight days of running I think. Not a usual situation but for digital signage and kiosk context that is entirely feasible.
Should getTimer() be avoided in these situations? Would a Date.UTC() object be safer since it returns a Number type?
My guess is it will loop back on itself, just as int will.
var nt:int = int.MAX_VALUE + 10; //outputs -2147483639
var nt2:int = int.MIN_VALUE + 9; //outputs -2147483639
As you can see, MAX + 10 is the same as MIN + 9 (have to account for the min value itself, obviously). So when you hit that 24 day mark, it will possibly look like -24 days and start going back up.
There is also a chance that the function itself doesn't return the actual time, but something along these lines:
return timer % int.MAX_VALUE;
That will reset the time each time it hits the MAX_VALUE to 0, using simple modulus. I honestly would not be surprised if this is what they do (since you don't want a negative runtime, obviously)