RetroBSD

2.11BSD operating system for microcontrollers
It is currently Thu Oct 17, 2019 5:57 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Nov 01, 2012 2:14 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui

As of today it works in the Partition branch only!
==================================================

You must have ADC driver enabled in your board's Makefile, ie.:
===============================================================
# Include or exclude drivers
DRIVER_GPIO = yes
# General Purpose I/O
DRIVER_ADC = yes
# Basic ADC interface

Set NPROC=20 in the sys/pic32/machparam.h (line 40)
===================================================

For crontab you need (it measures once a minute then):
======================================================
* * * * * /bin/basic /meteo/logger >> /meteo/data.csv

Make directory /meteo/ and put the below "logger" in there.
===========================================================

Set proper date and timezone before you start logging :)
========================================================
# date -t -60
# date 1210301352

Logger:
=======
5 REM Simple ADC data logger with cron and csv output format
6 REM Pito & Majenko 10/2012
9 REM Start the ADC (all 16 channels)
10 OPEN #1,"/dev/adc1", "r"
19 REM Print the date (needs partition branch date)
20 DOS "date -f '%Y/%m/%d, %H:%i:%s, %T, '"
29 REM Print all 16 channels in a single csv line
30 FOR i=0 TO 240 STEP 16
39 REM 3212873840 is MCHP's Support phone number
40 PRINT INP(3212873840+i),
50 PRINT ",",
60 NEXT i
70 PRINT ""
79 REM Close ADC
80 CLOSE #1
90 EXIT

Output example:
===============
# cat data.csv
2012/10/30, 13:53:01, WET, 129, 70, 34, 17, 37, 24, 20, 14, 11, 10, 9, 9, 8, 8, 543, 245,
2012/10/30, 13:54:01, WET, 128, 70, 36, 17, 36, 24, 22, 14, 10, 10, 9, 10, 8, 8, 544, 246,

Note:
=====
Within 24 hours of logging it creates about 130-200kBytes of data.csv, about 180kBytes of cron's messages and it swaps in/out about 1.2GBytes of data.


_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission