Hi,
I'd like to use the sleep() function in my code for a LPC2138.
But it seems that this function is not working. (no building of my code with
crossworks)
I need it for wait before reading a value from an ADC on the SPI bus.
May be I have missing the right library?
Can you help me?
here is the extract from the source code :
tab_write_adc[0]=0x80; // lecture channel 1, setup 1
SPI_Send(tab_write_adc, 1);
sleep (500);
SPI_Receive(tab_read_adc, 4);
How to use a sleep() function LPC2138
Started by ●August 24, 2009
Reply by ●August 24, 20092009-08-24
Hi,
> I'd like to use the sleep() function in my code for a LPC2138.
>
> But it seems that this function is not working. (no building of my code
> with crossworks)
It's not documented in our library hence it doesn't exist. Build your own
sleep function.
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks V2 is out for LPC1700, LPC3100, LPC3200, SAM9, and more!
> I'd like to use the sleep() function in my code for a LPC2138.
>
> But it seems that this function is not working. (no building of my code
> with crossworks)
It's not documented in our library hence it doesn't exist. Build your own
sleep function.
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks V2 is out for LPC1700, LPC3100, LPC3200, SAM9, and more!
Reply by ●August 24, 20092009-08-24
Hi Paul,
thanks for your help
Fabian
--- In l..., "Paul Curtis" wrote:
>
> Hi,
>
> > I'd like to use the sleep() function in my code for a LPC2138.
> >
> > But it seems that this function is not working. (no building of my code
> > with crossworks)
>
> It's not documented in our library hence it doesn't exist. Build your own
> sleep function.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks V2 is out for LPC1700, LPC3100, LPC3200, SAM9, and more!
>
thanks for your help
Fabian
--- In l..., "Paul Curtis" wrote:
>
> Hi,
>
> > I'd like to use the sleep() function in my code for a LPC2138.
> >
> > But it seems that this function is not working. (no building of my code
> > with crossworks)
>
> It's not documented in our library hence it doesn't exist. Build your own
> sleep function.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks V2 is out for LPC1700, LPC3100, LPC3200, SAM9, and more!
>
Reply by ●August 24, 20092009-08-24
>
> It's not documented in our library hence it doesn't exist. Build your own
> sleep function.
>
Yup, it's dead easy, a one-liner:
void OSsleep(int interval){
ctl_timeout_wait(ctl_get_current_time()+interval);
};
You could do it with a macro, if you wanted, or just inline it.
Rgds,
Martin
> It's not documented in our library hence it doesn't exist. Build your own
> sleep function.
>
Yup, it's dead easy, a one-liner:
void OSsleep(int interval){
ctl_timeout_wait(ctl_get_current_time()+interval);
};
You could do it with a macro, if you wanted, or just inline it.
Rgds,
Martin
Reply by ●August 24, 20092009-08-24
Hi,
> > It's not documented in our library hence it doesn't exist. Build your
> own
> > sleep function.
> >
>
> Yup, it's dead easy, a one-liner:
>
> void OSsleep(int interval){
> ctl_timeout_wait(ctl_get_current_time()+interval);
> };
>
> You could do it with a macro, if you wanted, or just inline it.
...this assumes he is using CTL..
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks V2 is out for LPC1700, LPC3100, LPC3200, SAM9, and more!
> > It's not documented in our library hence it doesn't exist. Build your
> own
> > sleep function.
> >
>
> Yup, it's dead easy, a one-liner:
>
> void OSsleep(int interval){
> ctl_timeout_wait(ctl_get_current_time()+interval);
> };
>
> You could do it with a macro, if you wanted, or just inline it.
...this assumes he is using CTL..
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks V2 is out for LPC1700, LPC3100, LPC3200, SAM9, and more!
Reply by ●August 24, 20092009-08-24
--- In l..., "Paul Curtis" wrote:
>
> Hi,
>
> > > It's not documented in our library hence it doesn't exist. Build your
> > own
> > > sleep function.
> > >
> >
> > Yup, it's dead easy, a one-liner:
> >
> > void OSsleep(int interval){
> > ctl_timeout_wait(ctl_get_current_time()+interval);
> > };
> >
> > You could do it with a macro, if you wanted, or just inline it.
>
> ...this assumes he is using CTL..
>
Well, calls named like 'Sleep()' are generally associated with a multiThreaded OS. 'Sleep' sorta implies doing no activity, ie. not running.
You are, of course, right though. Maybee OP is using some other OS, but he/she did not mention another OS, just Crossworks, so I assumed ctl.
Rgds,
Martin
>
> Hi,
>
> > > It's not documented in our library hence it doesn't exist. Build your
> > own
> > > sleep function.
> > >
> >
> > Yup, it's dead easy, a one-liner:
> >
> > void OSsleep(int interval){
> > ctl_timeout_wait(ctl_get_current_time()+interval);
> > };
> >
> > You could do it with a macro, if you wanted, or just inline it.
>
> ...this assumes he is using CTL..
>
Well, calls named like 'Sleep()' are generally associated with a multiThreaded OS. 'Sleep' sorta implies doing no activity, ie. not running.
You are, of course, right though. Maybee OP is using some other OS, but he/she did not mention another OS, just Crossworks, so I assumed ctl.
Rgds,
Martin