Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 9th, 2005, 5:48 AM   #1
alphonso
Programmer
 
Join Date: Dec 2005
Location: Philippines, where the seasons are: hot, and hotter
Posts: 72
Rep Power: 3 alphonso is on a distinguished road
Almost, but not quite there

Hi. I'm a newbie here

Anyways, I need help in this code in TASM or task assembler. The purpose is to make the LEDs (light emitting diodes) blink at an increasing manner. Here's the layout of the LEDs:

1 2 4 8 16 32 64 128
0 0 0 0 0 0 0 0

Basically, I already got the code for making all these LEDs blink at the same time for about 3 seconds, then off, then on, then off.

My problem is how to make them blink in an increasing manner: from LED 1, then LED 2, then LEDS 1 and 2, then LED 4, then LEDs 4 and 1 (the manner is that the LEDs light up from 1 to 255 so that by 254, all but LED 1 will light up and by 255, all LEDs light up) here's the code for all LEDs lighting up all at once, then off, then on again, then off:

H=hexa
B=binary

clrscr= main proc near
       mov ax,0600
       mov bx,0700
       mov cx,0000
       mov dx,184fH
       int 10



mov dx,0378H
mov al,11111111B
out dx,al
inc cx
cmp cx,0ffffH
jne a1
int 21H
mov cx,0



mov dx,0378H
mov al,00000000B
out dx,al
inc cx
cmp cx,0ffffH
jnc a2
int 21H
mov ex,0


mov dx,0378H
mov al,11111111B
out dx,al
inc cx
cmp ex,0ffffH
jnc a3
int21H
mov ex,0


mov dx,0378
mov al,00000000B
out dx,al
inc cx
cmp ex,0ffffH
jnc a4
int 21H
jmp clrscr



end program
mov ah,01
int 21H
mov ah,4cH
int 21H
main endp
end main

Could you guys help me crack the code for this one please? Thanks, God bless

Last edited by Mjordan2nd; Dec 9th, 2005 at 12:24 PM. Reason: Code Tags
alphonso is offline   Reply With Quote
Old Dec 9th, 2005, 7:51 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Nothing wrong with being a newbie, but you should read the forum's FAQ/rules and a "How to Post..." thread before posting. For one thing, it tells you to put your code in tags.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Dec 9th, 2005, 12:24 PM   #3
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
Code tags added.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old Dec 9th, 2005, 12:56 PM   #4
lostcauz
Hobbyist Programmer
 
Join Date: Nov 2004
Location: 1691 miles East of L.A.
Posts: 159
Rep Power: 4 lostcauz is on a distinguished road
It appears you haven't given us all the code but from a quick glance I would suggest you play with the binary values you are placing in the al register.
__________________
-- lostcauz

Stepped in what?...
Behind whose barn?...
I didn't even know they had a cow!
lostcauz is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:33 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC