Hi Gentelmen,
Here is the "simple" code i am trying to use in another programme.....
.NOLIST
.INCLUDE "m164Pdef.inc" ;
.LIST
.DEF rmp=R16
.DEF rBIN1H= R17
.DEF rBIN1L=R18
.DEF rBIN2H= R19
.DEF rBIN2L= R20
; STart of TEst Program
.CSEG
.org $0000
RJMP MAIN
.org $0024
RJMP TIM0_COMPA
MAIN:
LDI rmp,HIGH(RAMEND); Set the Stack
OUT SPH,rmp
LDI rmp,LOW(RAMEND)
OUT SPL, rmp
SBI DDRB,0 ;SET PORTB 0 FOR OUTPUT
LDI rmp,0b0000_0001 ;SET PRESCALER TO /1024
OUT TCCR0B,rmp ;TIMER/COUNTER CONTROL REGISTER "B"
LDI rmp,0b0000_0010 ;ENABLE TIMER-OVERFLOW INTERUPT
sts TIMSK0,rmp
LDI rmp,175 ;PRELOAD THE TIMER
OUT TCNT0,rmp
SEI ;ENABLE INTERUPTS GLOB
no_end: ;unlimited loop when done
RJMP no_end
TIM0_COMPA:
SBI PINB,0 ;FLIP THE 0 BIT
LDI rmp,160 ;RELOAD THE TIMER
OUT TCNT0,rmp
RETI
Now, before anyone jmps to any conclussions about the different time constant i am using. The only reason they arew different is so that i can KNOw that the interupt has occurred.. Aslo the original has a time constant of 1024 and here i am using no time constant. I* have stepped thru this code on AVR Studio 5 and it does work, but i cant gewt it to run in the simulator...
Any thoughts will be gratefully accepted and tried....
Thank you..