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 1st October 2007, 04:54 PM   (permalink)
Default

Ok, we may be getting closer. That period and those duty cycles will be relatively easy to do even on a small 8 pin PIC microcontroller.

I would like to check out the controller data sheet but neither of those pdf file links are bringing up my Acroread program. Let me investigate. I may have a problem with some ad-ware on my laptop (argh!!!)...
Mike, K8LH is offline  
Old 5th October 2007, 02:39 AM   (permalink)
Default

Quote:
Originally Posted by Mike, K8LH
I would like to check out the controller data sheet but neither of those pdf file links are bringing up my Acroread program. Let me investigate. I may have a problem with some ad-ware on my laptop (argh!!!)...
They are located on my personal domain and may be asking you if you want to open or save the file, instead of opening Acroreader automatically.
iONic is offline  
Old 5th October 2007, 02:45 AM   (permalink)
Default

Just tried the two links in Foxfire and they opened with the Foxfire/adobe plugin.

Try these links...they are from the Manufacturer's websites

http://www.lumileds.com/pdfs/DS46.pdf
http://www.leddynamics.com/LuxDrive/...1-BuckPuck.pdf
iONic is offline  
Old 5th October 2007, 05:25 AM   (permalink)
Default

If you setup a basic interrupt to count seconds and minutes, then your 90% through the battle.

EG;
Code:
Device = 18F452
Clock = 20

Dim TMR2IE As PIE1.1,         // TMR2 interrupt enable
    TMR2IF As PIR1.1,         // TMR2 overflow flag
    TMR2ON As T2CON.2,        // Enables TMR2 to begin incrementing
    mS As Word,               // mS register
    S As Byte,                // Seconds register
    M As Byte                 // Minutes register

    
    
Interrupt TMR2_Interrupt()
    Save(0)                   // Back up system variables
    If TMR2IF = 1 Then        // Check if the interrupt was from TMR2
        TMR2IF = 0            // Clear the TMR2 interrupt flag
        Inc(mS)               // Increment the mS counter
        If mS = 1000 Then
            mS = 0
            Inc(S)
            If S = 60 Then
                S = 0
                Inc(Min)
            EndIf
        EndIf
    EndIf                     //
    Restore                   // Restore system variables
End Interrupt

Private Sub TMR2_Initialize()
    TMR2ON = 0                // Disable TMR2
    TMR2IE = 0                // Turn off TMR2 interrupts    
    T2CON.0 = 1               //  00 = Prescaler is 1
    T2CON.1 = 0               //  01 = Prescaler is 4
            	              //  1x = Prescaler is 16 
    PR2 = 249                 // TMR2 Period register PR2   
    T2CON.3 = 0               //  0000 = 1:1 postscale
    T2CON.4 = 0               //  0001 = 1:2 postscale
    T2CON.5 = 1               //  0010 = 1:3 postscale...
    T2CON.6 = 0               //  1111 = 1:16 postscale    
    TMR2 = 0                  // Reset TMR2 Value    
    TMR2IE = 1                // Enable TMR2 interrupts
    TMR2ON = 1                // Enable TMR2 to increment
    Enable(TMR2_Interrupt)
End Sub

// Start Of Program...
mS = 0                        // Reset Timer registers
S = 0
M = 0

TMR2_Initialize               // Setup and enable TMR2
__________________
Spency.

PIC Micro's - Your mind is the limit

PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net

Last edited by gramo; 6th October 2007 at 12:24 AM.
gramo is offline  
Old 5th October 2007, 05:33 AM   (permalink)
Default

The above program will provide an interrupt driven timer. Very useful tool for countless applications, for your use, perhaps the "main program" could consist of;



Code:
Include "PWM.bas"

// local duty variable...
Dim Duty As Word

// main program...
Duty = 40
PWM.SetFreq(10000, 40)          // Initialize the Duty output (10Khz @ 40% Duty)

While Duty < 100                // Create loop to reach 100% duty
     While M < 1                // Wait for 1 minute to occur
     Wend
     M = 0                      // Reset the Minute register
     Inc(Duty, 5)               // Increase the Duty Cycle by 5%
     PWM.SetDuty(Duty)          // Set the new duty cycle
Wend

While True                      // 40-100% has finished, loop for ever here
Wend
__________________
Spency.

PIC Micro's - Your mind is the limit

PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net
gramo is offline  
Old 5th October 2007, 04:39 PM   (permalink)
Default

Quote:
Originally Posted by gramo
The above program will provide an interrupt driven timer. Very useful tool for countless applications, for your use, perhaps the "main program" could consist of;

GRAMO, thanks for the code. With each new project I tackle I realize not only the benefits but the need to learn to program micro controllers...etc.

My next post may very well be for assistance on which programmer, software...yada yada yada...

iONic

Last edited by iONic; 5th October 2007 at 11:00 PM.
iONic is offline  
Old 6th October 2007, 07:51 AM   (permalink)
Default

Quote:
Originally Posted by iONic
GRAMO, thanks for the code. With each new project I tackle I realize not only the benefits but the need to learn to program micro controllers...etc.

My next post may very well be for assistance on which programmer, software...yada yada yada...

iONic

Perfectly you are thinking-- as learning is a continuous process
__________________
Regards,
Sarma.
mvs sarma is offline  
Old 6th October 2007, 02:30 PM   (permalink)
Default

Quote:
Originally Posted by mvs sarma
Perfectly you are thinking-- as learning is a continuous process

Yes indeed. I knew that and love learning new things, but have been complacent in m was. I have returned once again.
iONic is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
'schematic software' needed for microcontroller kiranmayi Micro Controllers 9 11th February 2007 04:42 PM
help needed .. data storage from microcontroller to pen drive amit_kr Micro Controllers 4 5th June 2006 04:43 PM
Programming the Mini-Max 8051 microcontroller blimon Micro Controllers 8 13th July 2005 03:42 AM
Connection of Siemens c167 microcontroller to peripherals. Roslan Electronic Projects Design/Ideas/Reviews 3 23rd March 2004 07:52 PM
Microcontroller Simplest Project Help needed waqar Electronic Projects Design/Ideas/Reviews 0 1st April 2003 01:53 PM



All times are GMT. The time now is 09:21 PM.


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

eXTReMe Tracker