S5PV210 's Timer

Source: Internet
Author: User

The former array has been busy with a mess of things, school holidays seven days, sleep a day to see the movie day, there are some trivia, although the Development Board to take back, but also only to increase the fetters of the trip, said the course will be in the holiday period to write the system, finally only half of the writing. This led to the tragedy behind the great chaos.

Can not wait to return to the music embedded, feel or learn something more in the heart to be steadfast. The bare metal before the holiday is pediatrics, take the fake back on the change of day. Since my course selection system only semi-finished, think about the interview will certainly be useful, on my knees to finish! However, the results can be imagined, leading to the bare metal failed to preview in time to review, bent on the selection of courses system, coupled with learning LCD, Nandflash, IIC, timers and other hardware, the days are really bad. Fortunately, the course selection system spends 35 hours a day, four or five consecutive days, finally completed 7788, the basic functions are realized, leaving some bugs and a little function is not perfect, feel that the purpose has reached, decided to put down the choice of course system to invest in bare metal development.

Man's energy is limited, while doing two things easily forgotten how. Back to the bare metal, found that they have left a lot of, but, fortunately, they are all the way to chase over the haha. The day before yesterday back to school to take clothes incidentally to ride over the car (in fact, in turn,,), and backward half a day. Evening was originally intended to go back to the classroom to catch up with the progress, did not expect to have dinner on the bike plus halfway rain, dark don't know the road, close to nine points before returning to the bedroom. Wash away the black mud from the two ring, go out to buy something, go back to sleep (really die).

Yesterday morning began to do the bare metal project, because behind half a day and a night, they have done the coordinates of the reading, I still zero. The simple idea of the next, by their own understanding to do, Lu teacher came, gave me a direction and notes, relying on intuition, finally at 12 points more do a good coordinate reading. After dinner everyone did not rest, I naturally dare not relax. Only to find that the last stick down only five or six people, very fortunate that they are one, although the departure of a little late haha. It is still raining outside, it is estimated to autumn it, the steel concrete alone in the hometown, the Mid-Autumn festival near, do not feel there is a trace of desolation. Last night and the old children's shoes through one hours of telephone, since they came to Hunan, long time no chat with them so long, feel oneself away from the group for a long time, later slowly compensate you.

The seasons change, the emotion also changes constantly, has the good and the bad, does not have to be sentimental, although looks forward.

No nonsense, the following from the s5pv210 timer began to summarize.

210 There are five 32-bit timers, of which 0, 1, 2, 3, 4 contain pulse width modulation, with timing and counting of the function of the device. Here is not to repeat, the relevant information can be found at any time, here directly on the code.

1, first is the initialization of the timer, mainly set the timer input clock frequency, timer countdown counting initial value and overload, duty ratio, enable timer interrupt and open, etc.

int Init_timer (void)
{
unsigned int temp0=0;
Disable Timer
TCON = 0x0;

Enable TIMER0 Interrupt
Tint_cstat = 0x01;
/*
Set the clock to operate at a frequency of 1M
Prescaler value = Divider Value = 1
Input clock = 66M/(65+1)/1 = 1M

TCFG0 &= ~0xff;
TCFG0 = 65;
*/
The calculated Prescaler factor
TCFG0 &= 0xffffff00;
TCFG0 |=0x00000041;
Set the divide factor, 1/16
TCFG1 = 0x04;

Set TCNB0 and TCMP0, start the timer0,tcntb0 gradually minus one, equal to zero is the generation of interrupts
Timing 1 seconds 1clk = 16us 1000000/16 = 62500
TCNTB0 = 0xf424;
TCMPB0 = 0x7a12; Set the comparison value to adjust the duty ratio

First set up manual update, load TCNTB0
TCON |= (1<<1);
TCON &= ~ (1<<1);

Auto reload and turn on Timer 0
TCON |= (1<<0) | (1<<3);

Enable TIMER0 Interrupt
Temp0 = Tint_cstat;
Temp0 &=0xFFFFFFFE;
Temp0 |=0x1;
Tint_cstat = temp0;

Set GPD0 to output, set into T_out mode, generate PWM waveform
Gpd0con &= 0xfff0;
Gpd0con |= 0x02;

printf ("Timer0 int enable\r\n");
return 0;
}

And then the other place is the same as the key interrupt, as long as the 21st interrupt source opened, the interrupt Service subroutine address registered to the corresponding interrupt address can be

  

S5PV210 's Timer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.