Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 12th August 2008, 08:06 PM   (permalink)
Default Dragonfly (6 digit seven segment kit) MK2 update

I've made a couple of small but significant changes to the Dragonfly kit.

Changes are a PIC18F2525 and a 40kHz crystal. The 18F2525 allows for Swordfish BASIC and C18 support and the 40kHz crystal allows for more flexibility with the CCPx module easy to set ms interrupts like shown in the Swordfish program below. The code is not pretty but it works, it'll run as a Minute, Second, 100s second counter and should be easy to convert to a stopwatch. Another project in the works is a frequency counter using the gated TMR0 input (3 pin connector in the upper left of the picture above)
Code:
// Dragonfly MKII (PIC18F2525 & 40kHz TMR1 crystal

Device = 18F2525
Clock = 8
Config  WDT=OFF, OSC=INTIO67
Dim     Digit, Digits(6) As Byte 
Dim Loop4 as byte

Const   Segments(10) as byte = ($3F,$06,$DB,$CF,$E6,$ED,$BC,$07,$FF,$A7)

// 2.5ms Jiffy clock ideal for 6 digit display refresh ~66.6Hz 

Interrupt Jiffy()       // 2.5ms Jiffy clock (400Hz)
    If  Digit > 5 Then 
        High(PORTC.5)   // reset 4022
        Digit = 0       // clear digit counter
        EndIf
    latb = 0            // clearing the segments will eliminate ghosting
    lata = 0
// increment (or reset) the CD4022 Johnson counter
    Low(PORTC.2)        // 4022 clock
    Low(PORTC.5)
    High(PORTC.2)       // 4022 clock low high edge trigger
// display digits(x)
    LATB = $3F and Segments(Digits(Digit))  // mask off RB6 & 7
// check for inverted digits and swap segments
    if (Digit = 2) or (Digit = 5) then
        LATA = $40 and Segments(digits(digit))  // mask off RA0 - RA5
        else
        LATA = $80 and Segments(digits(digit))  // mask off RA0 - RA5
        endif    
    
    if Loop4 > 3 then   // update clock @ 100Hz   
        Digits(5) = Digits(5) + 1                       // inc 10ms
        if Digits(5) > 9 then
            Digits(5) = 0
            Digits(4) = Digits(4) + 1                   // inc 100ms
            if Digits(4) > 9 Then
                Digits(4) = 0
                Digits(3) = Digits(3) + 1               // inc 1s
                if Digits(3) > 9 then
                    Digits(3) = 0
                    Digits(2) = Digits(2) + 1           // inc 10s
                    if digits(2) > 5 then
                        digits(2) = 0
                        digits(1) = Digits(1) + 1       // inc 1m
                        if digits(1) > 9 then
                            digits(1) = 0
                            digits(0) = Digits(0) + 1   // inc 10m
                            if digits(0) > 5 then
                                Digits(0) = 0
                                endif
                            endif
                        endif
                    endif    
                endif        
            endif
        Loop4 = 0
        endif
    Loop4 = Loop4 + 1   // 400 Hz to 100Hz divider
    Digit = Digit + 1   // increment digit counter
    PIR1.2 = 0          // clear CCP1IF flag
End Interrupt

 
OSCCON  = $72           // 8MHz internal osc
CMCON   = $07           // comparators off
adcon1  = %00001110     // RA0 analog, all others digital I/O
CCPR1H  = 0             // 40kHz / 100 
CCPR1L  = 99            // (0 - 99)
T1CON   = %01001011     // timer 1 on, 1:1, ext crystal
CCP1CON = $0B           // special event trigger
PIE1.2  = 1             // CCP1IE on
Enable(Jiffy)
Low(PORTC.5)            // 4022 reset
TRISA = %00011011       // segments G & decimal, CD4022 control
TRISB = %11000000       // segments A-F


Digit = 0               // reset digit count
digits(0) = 0
digits(1) = 0
digits(2) = 0
digits(3) = 0
digits(4) = 0
digits(5) = 0
While true

Wend

End
It's an easy mod to existing Dragonfly users, just change the two parts. Digikey sells the 40kHz 12.5pf load crystals for less than $1
Attached Images
File Type: jpg IMG_0006.jpg (26.5 KB, 18 views)
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com

Last edited by blueroomelectronics; 12th August 2008 at 08:42 PM. Reason: Added photo
blueroomelectronics is online now  
Old 12th August 2008, 09:02 PM   (permalink)
Default

Quote:
Originally Posted by blueroomelectronics View Post
I've made a couple of small but significant changes to the Dragonfly kit.
Cool. One of these days I'm going to get my Dragonfly out and tinker with it. I never used it as much as I meant to.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is online now  
Old 12th August 2008, 10:02 PM   (permalink)
Default

Problem with the Dragonfly is don't leave it sitting anywhere in public. Looks like a bomb to some.
Now here's a neat application for the Dragonfly kit
http://www.geekologie.com/2008/08/wa...wake_n_bac.php
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now  
Old 12th August 2008, 10:08 PM   (permalink)
Default

Quote:
Originally Posted by blueroomelectronics View Post
Looks like a bomb to some.
Mostly in the psycho-paranoid united states of insanity. And especially in Boston. They'd shut down the city for the rest of the day and blow your Dragonfly up, dude.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 13th August 2008 at 06:21 AM.
futz is online now  
Old 13th August 2008, 05:17 AM   (permalink)
Default

I'll have to check my math (or the 40kHz crystal) as the device runs a hair fast.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
2 digit 7 segment display.. overmind Micro Controllers 12 17th January 2008 04:34 AM
Next kit (maybe) Dragonfly Seven segment & 16F886 blueroomelectronics Micro Controllers 29 12th July 2007 09:38 AM
2 digit 7 segment display soryo General Electronics Chat 10 14th August 2006 05:17 PM
4-digit seven segment display s2301931 Electronic Projects Design/Ideas/Reviews 2 20th April 2006 07:57 AM
Single digit 7 segment VF displays Eclipsed General Electronics Chat 6 12th July 2005 04:57 AM



All times are GMT. The time now is 03:45 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker