void delay(unsigned ticks) // 1 tick = 10 ns with default device settings
{
timer t;
unsigned ts;
t :> ts; // get time
t when timerafter(ts+ticks) :> int _;
}
This function can easily be called from C files if you need.
Hope that helps!
Paul
On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
You won't be able to get that level of resolution. I would expect that the LCD would have a working tolerance that would allow a delay of 40ns or maybe even 50ns. Working to that sort of picosecond margin is largely impractical with anything that is not incredibly expensive!
I don't know the specifics of your device, but would advise you checking through the datasheets for the maximum and minimum tolerances.
Also, 40ns sounds like a clock - so I would suggest not generating the signal in this way. The XS-1 XCore architecture has the ability to generate clock signals using the clock blocks.
An example of driving LCDs using clock ports is available in the Programming in XC book which available as a PDF.
On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
thanks for all your help. I ended up discovering the clocking functions last night. Like you said, makes much more sense to use them.
The nokia6100 project is what I'm using. It's been really helpful as I was previously driving these LCDs with arduino/atmel. Apart from the XS specifics, the code is identical to what I was using before.
I'm building a prototype of a semi-flexible mobile phone. 8 Nokia screens arranged in a 2x8 grid on a flexible substrate. We do a lot of work with new types of interfaces. http://hml.queensu.ca