Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Using timer 2 for clock out on P1.0 with keil

Status
Not open for further replies.

pasmosodico

Newbie level 4
Joined
Jun 23, 2011
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,337
i am using the example in the attachment file to configurate the timer2 as a clock out but i cant make it work

this is the example

#include <REGX52.h>
#define MSB_reload_value 0xFF /* msb reload value exemple */
#define LSB_reload_value 0xF2 /* lsb reload value exemple */
/**
* FUNCTION_PURPOSE: This file set up timer 2 in mode 1 (clock-out mode and
* negative transition detector).
* The 16-bits register consist of all 8 bits of TH2 and all 8 bits of TL2.
* TF2 does not generate interrupt.
* A negative transition on P1.1(T2EX) generate an interrupt.
* FUNCTION_INPUTS: void
* FUNCTION_OUTPUTS: P1.0(T2) as clock output : Fout = Fperiph / (2*(65536-
RCAP2)).
*/
void main(void)
{
T2MOD &= 0xFE; /* T2OE=1;DCEN=0; */
T2MOD |= 0x02;
EXF2=0; /* reset flag */
TCLK=0;RCLK=0; /* disable baud rate generator */
EXEN2=1; /* enable events on T2EX */
TH2=MSB_reload_value;/* Init msb_value */
TL2=LSB_reload_value;/* Init lsb_value */
RCAP2H=MSB_reload_value;/* reload msb_value */
RCAP2L=LSB_reload_value;/* reload lsb_value */
C_T2=0; /* timer mode */
CP_RL2=0; /* reload mode */
EA=1; /* interupt enable */
ET2=1; /* enable timer2 interrupt */
TR2=1; /* timer2 run */
while(1); /* endless */
}

using the "logic analizer in keil" i cant see anything in the pin p1_0
anyone can help, I need examples written in C because I do not understand much of assembler
 

Attachments


js

Full Member level 5
Joined
Oct 9, 2005
Messages
265
Helped
38
Reputation
76
Reaction score
36
Trophy points
1,308
Activity points
2,662
I use uVision v4.02 and all working OK!
P1.0 toggle in debug window.....
 

pasmosodico

Newbie level 4
Joined
Jun 23, 2011
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,337
I use uVision v4.02 and all working OK!
P1.0 toggle in debug window.....
thanks for the reply

you saw him on the parallel port 1??

I want to see the logic analyzer, to make the correct measurement and compare with other output signals...
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top