home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
back2roots/padua
/
padua.7z
/
padua
/
text
/
Led-Fade.c
< prev
next >
Wrap
C/C++ Source or Header
|
2014-05-19
|
3KB
|
96 lines
From comp.sys.amiga.programmer Sat Jun 27 02:22:00 1992
Path: cs.tu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!uunet!overload!dillon
From: dillon@overload.Berkeley.CA.US (Matthew Dillon)
Newsgroups: comp.sys.amiga.programmer
Subject: Re: LED fade
Distribution: world
Message-ID: <dillon.0hjx@overload.Berkeley.CA.US>
References: <David_Cole.04b0@guru.pub.uu.oz.au>
Date: 25 Jun 92 10:51:08 PST
Organization: Not an Organization
Lines: 82
In article <David_Cole.04b0@guru.pub.uu.oz.au> David_Cole@guru.pub.uu.oz.au (David Cole) writes:
>G'day all!
>
> I recently received a demo of a program called "Aspro". This is
>probably pretty old, but that is not the issue.
> When you activate it, the power LED on the A500 (maybe 2000 as well, I
>don't know), fades to off, and then fades back to full brightness.
>
> I was wondering if anyone out there can tell me how this is done
>(source-code), in Asm. Also, could you please document it clearly, as I am
>only just a beginner in 68k.
>
>Thanks
>
>Dave.
>
>
>-- Via DLG Pro v0.991
I dunno how he did it, but the easiest way to do it is to use a
constant frequency envelope and vary the duty cycle going to the LED.
______________________________
|______________________________| (half bright) |
____________
|________________________________________________| (dim) |
____________________________________________________
|________| (full bright) |
--
Matthew Dillon dillon@Overload.Berkeley.CA.US
891 Regal Rd. uunet.uu.net!overload!dillon
Berkeley, Ca. 94708
USA
/*
* Simple STUPID program
*
* note 1: using timing loops is bad
*
* note 2: you may have to modify <n> depending on your machine, but
* hopefully not by too much due to the enforced synchronization
* with the CIA's 6800 interface.
*
* note 3: Program presumes the CIA is accessed in an atomic instruction
*
* note 4: This really is a stupid program...
*/
#include <exec/types.h>
#include <exec/tasks.h>
#include <dos/dos.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
main()
{
struct Task *task = FindTask(NULL);
short n = 500;
/*
* actual loop
*/
while ((task->tc_SigRecvd & SIGBREAKF_CTRL_C) == 0) {
short i;
short j;
for (i = 0; i < n; ++i) {
for (j = 0; j < i; ++j)
*(char *)0xBFE001 |= 0x02;
for (j = i; j < n; ++j)
*(char *)0xBFE001 &= ~0x02;
}
}
return(0);
}