??? 05/17/04 16:06 Read: times |
#70484 - Simple circuit - getting started |
Having a few problems getting started, and I wondered if there were any really stupid mistakes in my circuit (schematic below).
I just want to flash an LED on port 2.0. using an adapted version of the delay code in the FAQ, like this... ; ; 1st asm51 Program! ; ; Pulses port 2 bit 0 to drive an LED I hope. ; ; ; $MOD51 $TITLE(BYTE LED FLASH) $PAGEWIDTH(132) $DEBUG $OBJECT $NOPAGING ; ; ; Variable declarations ; TCOUNT EQU 40H ;Address in IRAM ALARM EQU 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,$ JMP LOOP END ![]() This is my first post here by the way, but I'm sure there will be many more... |