• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Clock output.. simple?

Status
Not open for further replies.

col_implant

New Member
Hi,

I was 'brought up' on PIC, so I'm a bit of a nube with the 8051 based micro. Using the ADuC842 from analog devices.

I would like to provide a clock output from my microcontroller, at about 100 KHz, im clocking my micro at about 11MHz. Seems in my mind to be a very simple task. Is it possible to simply program a timer to toggle an output port? It seems the timers can only provide a software interrupt so I would need to interrupt the program to simply toggle the bit. I would rather use my interrupt for other more complex async operations, and I'd rather not interrupt my program every 100 steps or so.

Was wondering is there an easier way to provide a clock output?

Cheers

C
 

colin mac

New Member
Is it possible to simply program a timer to toggle an output port?
Yes. You place a value in the timer so that it will increment and cause an overflow. The program jumps to the ISR then complements the pin. In the original 8051, with a 12MHZ crystal, the timer incremented every 1us.
 
Last edited:

rushi53

Member
Hi,

I was 'brought up' on PIC, so I'm a bit of a nube with the 8051 based micro. Using the ADuC842 from analog devices.

I would like to provide a clock output from my microcontroller, at about 100 KHz, im clocking my micro at about 11MHz. Seems in my mind to be a very simple task. Is it possible to simply program a timer to toggle an output port? It seems the timers can only provide a software interrupt so I would need to interrupt the program to simply toggle the bit. I would rather use my interrupt for other more complex async operations, and I'd rather not interrupt my program every 100 steps or so.

Was wondering is there an easier way to provide a clock output?

Cheers

C

If you don't want to use interrupt or timer routine for clock output,
then you can make use of Delay routine.
Advantage: Simple program
Disadvantage: You can not perform any other operation while delay routine is executed.

Program would be like this:

Code:
[COLOR="Navy"]start:          cpl p1.0
                  call delay1sec
                  jmp start

delay1sec:    mov 30h,#10
del2sec2:     mov 31h,#200
del2sec1:     mov 32h,#250
                  djnz 32h,$
                  djnz 31h,del2sec1
                  djnz 30h,del2sec2
                  ret      
                  End
[/COLOR]
Let me know if need any more help
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top