![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Well I'm stuck on what to call the program? Here's the core program, it calls a module that contains the code for different sensors such as CDS, Solar, DS1820, thermistor, etc... and displays the result to be captured by the UART tool (part of PICkit2 2.x software) and since the UART tool supports capture you could use it as a data logger. Great for a science fair project.
Future revisions may contain EEPROM or Flash logging, multiple sensor logging etc. I'll post a typical module in the next day or two. Swordfish BASIC Code:
Device = 18F1320
Clock = 4 ' define the clock speed for the compiler
Config OSC = INTIO2, WDT = OFF, LVP = OFF
Dim Data As String
Include "USART.bas"
SetBaudrate(br9600)
OSCCON = $62 ' 4MHz OSC
Data = "Test "
USART.Write("1 Second Recorder",13,10)
While true
' call module CDS, Solar, DS1820, thermistor, etc...
' returns a string "Data"
USART.Write(Data)
DelayMS(1000)
Wend
End
|
|
|
|
|
|
|
(permalink) |
|
Here's a working version, I'll clean up the code for JPUG and document how it functions. The version below is for A/D channel 1 (VR1) on the Junebug for testing purposes. Since Swordfish does not currently support MPLABs debug (seems they are working on that at Swordfish) I've use the UART for debug and it works great in a pinch.
Code:
Device = 18F1320
Clock = 4 ' define the clock speed for the compiler
Config OSC = INTIO2, WDT = OFF, LVP = OFF
Include "USART.bas"
Include "convert.bas"
Public Function ADGO(Channel As Byte) As Word
ADCON1 = (0 << Channel) ' make input (Channel) analog
ADCON0 = (Channel << 2) Or $03 ' select Channel and start AD
While(ADCON0.1 = 1) ' wait for conversion to complete
Wend
ADGO=(ADRESH<<8)+ADRESL
End Function
SetBaudrate(br9600)
OSCCON = $62 ' 4MHz OSC
ADCON2 = %10100001 ' A/D conversion speed, Right justify
USART.Write("1 Second Recorder",13,10)
While true
' USART.Write(bintostr(ADCON1)) ' debugging purposes only
USART.Write("CDS cell ",DecToStr(ADGO(1)),13,10)
DelayMS(1000)
Wend
End
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
I used to manufacture a datalogger, named MIDAS Marine Instrumentation Data Acquisition System. Perhaps. Multi Input Data Acquisition System. Regards
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
||
|
|
|
|
|
(permalink) |
|
LOL MIDAS, I wasn't thinking of anything so grandiose it's just an introductory simple Analog to UART program.
Perhaps a future version will include a standalone EEPROM logging function. I do love the simplicity of Swordfish BASIC, it's really a nice piece of software. It may not be overly efficient as the above program compiles to 543 byte program & 111 bytes RAM Last edited by blueroomelectronics; 25th May 2008 at 05:54 PM. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Ready Steady GO!, a game for the Junebug in Swordfish BASIC | blueroomelectronics | Micro Controllers | 0 | 4th March 2008 05:05 AM |
| Junebug kit ready, (PICkit2 & tutor) | blueroomelectronics | Micro Controllers | 37 | 28th October 2007 02:47 AM |
| Which Data Logger? | Overclocked | General Electronics Chat | 4 | 2nd June 2007 05:38 PM |
| gps data logger | simo | Electronic Projects Design/Ideas/Reviews | 1 | 9th July 2005 04:36 AM |
| DATA LOGGER | Sherif Welsen | Micro Controllers | 6 | 23rd October 2003 08:52 AM |