Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Thread Closed: Issue successfully resolved

???
05/18/04 08:38
Read: times


 
#70607 - RE: Simple circuit - getting started
Responding to: ???'s previous message
Oleg,

Thank you! I'd caught the CLR ALARM one, but completely missed the TMOD initialisation problem. I can now confirm all is working correctly.

A massive thank you to all who helped me on my first steps down this road.

For completeness, here's the final code, in case it helps somebody else. I'm sure it's not perfect (namely I probably should initialise ALARM near the start), but it does work.

Metalink ASM51 code.

;
; Working Version.
;
; Pulses port 2 bit 0 to drive an LED.
;
;
;
$MOD51
$TITLE(BYTE LED FLASH)
$PAGEWIDTH(132)
$DEBUG
$OBJECT
$NOPAGING


; Variable declarations

TCOUNT Data 40H ;Address in IRAM
ALARM Bit 00H ;Bit memory


ORG 0000H
LJMP MAIN

ORG 000BH ;Timer 0 overflow interrupt

T0_INTERRUPT:
MOV TL0,#0B0H
MOV TH0,#03CH
DJNZ TCOUNT,T0_EXIT ;If we haven't reached 0 then jump out of int routine
CPL P2.0
SETB ALARM

T0_EXIT:
RETI

MAIN:
MOV TMOD, #01H ;Initialise Timer 0 as 16-bit mode timer
MOV TL0,#03CH
MOV TH0,#0B0H
SETB ET0
SETB EA

LOOP:
MOV TCOUNT,#20
SETB TR0
JNB ALARM,$
CLR ALARM
JMP LOOP
END


List of 35 messages in thread
TopicAuthorDate
Simple circuit - getting started            01/01/70 00:00      
   RE: Simple circuit - getting started            01/01/70 00:00      
      RE: Simple circuit - getting started            01/01/70 00:00      
         RE: Simple circuit - getting started            01/01/70 00:00      
            RE: Simple circuit - getting started            01/01/70 00:00      
               RE: Simple circuit - getting started            01/01/70 00:00      
                  RE: Simple circuit - getting started            01/01/70 00:00      
   RE: Simple circuit - getting started            01/01/70 00:00      
      RE: Simple circuit - getting started            01/01/70 00:00      
         RE: Simple circuit - getting started            01/01/70 00:00      
            RE: Simple circuit - getting started            01/01/70 00:00      
      RE: emitter follower?            01/01/70 00:00      
         RE: emitter follower?            01/01/70 00:00      
            RE: PNP            01/01/70 00:00      
               RE: PNP            01/01/70 00:00      
                  RE: PNP            01/01/70 00:00      
               RE: PNP            01/01/70 00:00      
               RE: PNP            01/01/70 00:00      
                  RE: PNP            01/01/70 00:00      
                     Historical Images            01/01/70 00:00      
                        RE: Historical Images - Andy            01/01/70 00:00      
                     RE: PNP v.s. NPN            01/01/70 00:00      
         RE: emitter follower?            01/01/70 00:00      
   RE: Simple circuit - getting started            01/01/70 00:00      
      RE: Simple circuit - getting started            01/01/70 00:00      
      RE: Simple circuit - getting started            01/01/70 00:00      
   a shining light            01/01/70 00:00      
      Hear! Hear!!            01/01/70 00:00      
   RE: Simple circuit - getting started            01/01/70 00:00      
      RE: Simple circuit - getting started            01/01/70 00:00      
         RE: Simple circuit - getting started            01/01/70 00:00      
      Experience, dear boy...            01/01/70 00:00      
   RE: Simple circuit - getting started            01/01/70 00:00      
      RE: Simple circuit - getting started            01/01/70 00:00      

Back to Subject List