All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Embedded Systems and Microcontrollers

Notices

Embedded Systems and Microcontrollers Discussion forum for projects and working with embedded systems and microcontrollers (FPGAs, PICs, AVRs). Get help with hardware issues and embedded programming.

Reply   Post New Thread
 
Thread Tools Display Modes
  #11  
Old 05-22-2007, 12:24 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

Code:
 
// Initialise Timer 1
 
      ldi Temp, 0b00010000;
      out OCR1AH, Temp;
 
      ldi Temp, 0b00000000;
      out OCR1AL, Temp;
 
 
     ldi Temp, 0b00000001; // 0b00001001 (0x09) ????
     out TCCR1B, Temp;
 
     ldi Temp, 0b00010000;
     out TIMSK, Temp;
Select All
Since you have initialized OCR1AH, OCR1AL, and placed you interrupt service routine at the COMPA interrupt service vector location, I am assuming that you are planning to use the reload timer1 on match with COMPARE A. If that is the case, then it appears that you have selected waveform generator mode 0 when I think you might need to select waveform generator mode 4 (see red text in the code inset above).

Have I missed something?

hgmjr
Reply With Quote
  #12  
Old 05-22-2007, 12:27 AM
olusola olusola is offline
Member
 
Join Date: May 2007
Posts: 74
Default

oh i must say ,
there is a mistake on the 2nd op-amp after the DAC. its a 1K resistor between legs 4 and 1 and not a capacitor .
thanks

olu
Reply With Quote
  #13  
Old 05-22-2007, 12:31 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

The choice of coding language is strictly up to you. I just wanted to make sure that you were aware that WINAVR is out there for you to use.

There are advantages and disadvantages to either choice. The one major advantage of C is that is much easier for another programmer to determine what your code is doing.

For now, I would stick with your assembly language program and if you have the time and the inclination you can always port the program over to C at a later date.

hgmjr
Reply With Quote
  #14  
Old 05-22-2007, 12:32 AM
olusola olusola is offline
Member
 
Join Date: May 2007
Posts: 74
Default re

ah, well please can you help me understand this better?
I am quite new to this, and just followed an example to initialise the timer, as i really did not understand the different timer operations. i am trying to understand it now though.

thanks




Quote:
Originally Posted by hgmjr View Post
Code:
 
// Initialise Timer 1
 
      ldi Temp, 0b00010000;
      out OCR1AH, Temp;
 
      ldi Temp, 0b00000000;
      out OCR1AL, Temp;
 
 
     ldi Temp, 0b00000001; // 0b00001001 (0x09) ????
     out TCCR1B, Temp;
 
     ldi Temp, 0b00010000;
     out TIMSK, Temp;
Select All
Since you have initialized OCR1AH, OCR1AL, and placed you interrupt service routine at the COMPA interrupt service vector location, I am assuming that you are planning to use the reload timer1 on match with COMPARE A. If that is the case, then it appears that you have selected waveform generator mode 0 when I think you might need to select waveform generator mode 4 (see red text in the code inset above).

Have I missed something?

hgmjr
Reply With Quote
  #15  
Old 05-22-2007, 12:34 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

Quote:
Originally Posted by olusola View Post
oh i must say ,
there is a mistake on the 2nd op-amp after the DAC. its a 1K resistor between legs 4 and 1 and not a capacitor .
thanks

olu
Did you mean to say legs 2 and 1? Leg 4 is the negative power pin and your schematic shows no capacitor attached to leg 4.

hgmjr
Reply With Quote
  #16  
Old 05-22-2007, 12:39 AM
olusola olusola is offline
Member
 
Join Date: May 2007
Posts: 74
Default

do you think i need some rest? cos i think i do . lol.
well yes thanks . oh, thanks so much .
it is btw legs 2 and 1
cheers

olu
Reply With Quote
  #17  
Old 05-22-2007, 12:55 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

Quote:
Originally Posted by olusola View Post
ah, well please can you help me understand this better?
I am quite new to this, and just followed an example to initialise the timer, as i really did not understand the different timer operations. i am trying to understand it now though.

thanks
Sure. I will try to help any way I can.

Timer1 is a very flexible timer and can therefore be configured in numerous ways.

In the standard operating mode (MODE 0), TCNT1H and TCNT1L together make up the 16-bit register that contains the value to be loaded into the timer1 counter with each interrupt. The interrupt occurs at the MAX count of 65,535.

The timer clock frequency is based on the system clock divided by the prescaler which can be set to one of several preset divide-by values.

There is another mode that timer1 can be set to that uses OCR1AH and OCR1AL to set the value that is compared with each value of timer1's counter as it is incremented. Whenever the contents of the timer1 counter is equal to the value in OCR1A then the counter is loaded with zero and the counter begins incrementing from 0 toward the value in OCR1A again.

I recommend you read the ATMEGA16 datasheet as it describes this operation in great detail.

hgmjr
Reply With Quote
  #18  
Old 05-22-2007, 12:56 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

We can pick up where we left off tomorrow.

hgmjr
Reply With Quote
  #19  
Old 05-22-2007, 01:50 AM
olusola olusola is offline
Member
 
Join Date: May 2007
Posts: 74
Default

ok. thanks. looking at the datasheet.
thanks once again. please if you come up with anything ot help pls let me know. (i'm not that much of a sleeper .. lol) but yea also, so what do you now recommend for the timer?

Olu
Reply With Quote
  #20  
Old 05-22-2007, 02:24 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

Another thing that I have noticed is that your solarcell is not connected to any ground nor is your mosfet. You will need to connect these to ground to provide a reference and complete the measurement path.

hgmjr
Reply With Quote
Reply   Post New Thread

Tags


Similar Threads
Thread Thread Starter Forum Replies Last Post
Efficient use of power by MPPT charger Billy4184 The Projects Forum 33 06-30-2014 01:21 PM
Need help with new MPPT design theory lunds1990 The Projects Forum 1 10-17-2013 01:34 AM
Need advise for MPPT solar charger rabiuls The Projects Forum 8 08-18-2012 07:49 AM
Dual input MPPT on inverter Cerkit The Projects Forum 0 04-17-2012 10:45 AM
Help regarding MPPT rajasekarsmvec The Projects Forum 1 08-18-2011 06:20 PM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:32 AM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin
Copyright ©2000 - 2014, vBulletin Solutions, Inc.