Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/03/04 01:31
Read: times


 
#73566 - RE: Need datalogger code
Responding to: ???'s previous message

"I would like to log at a rate of about 50 Hz "

and

"I haven't really tried anything yet, as I've said I'm not very familiar with programming"

Don't worry. What you want to do is easy if you break it down into smaller segments and a simple program flow model :

1. Calculate the storage space. You want to acquire 50 samples per second ( hardware permitting ) for 20 seconds. And if you know the data width ( number of bytes per sample ) then calculating the storage space is not a problem.

2. You need an interrupt to fire at the rate of 50Hz or once in 20ms. No problem here also.

3. You need to take a reading ( sample ) with the ADC for every interrupt and store it after proper justification / conversion etc.

Once the above routines are complete, just merge them into a program to :
- Wait for the user command to start logging.
- On user command,
  - Initialize the pointer to the storage area.
  - Start the 20ms interrupt.
  - Either start a timer for 20 sec or counter for the required number of samples and acquire data.
  - At the end of 20 sec, save acquired data in a log.
  - Clear the storage area and wait for the next user command to log. 


Not complicated right ?

Raghu

List of 8 messages in thread
TopicAuthorDate
Need datalogger code            01/01/70 00:00      
   RE: Need datalogger code            01/01/70 00:00      
      RE: Need datalogger code            01/01/70 00:00      
         RE: Need datalogger code            01/01/70 00:00      
         RE: Need datalogger code            01/01/70 00:00      
         RE: Need datalogger code            01/01/70 00:00      
            RE: Need datalogger code            01/01/70 00:00      
   RE: Need datalogger code            01/01/70 00:00      

Back to Subject List