Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

6502 timer code for 6522 VIA

97 views
Skip to first unread message

David Lik Hang Yeung

unread,
Mar 9, 1998, 3:00:00 AM3/9/98
to

Hi,
Does anyone have 6502 code either to pulse PB7 or to trigger an interrupt
from a 6522 VIA? I need to control 2 variable speed DC motors using a
6502 for a tag-playing robot. I have the following code which I am told
is supposed to pulse Port B pin 7:

-----

VIA_BASE = $A000
T1CL = VIA_BASE + 6
T1CH = VIA_BASE + 7
ACR = VIA_BASE + 11
IER = VIA_BASE + 14

LDA #%11000000
STA ACR

LDA #$00
STA IER

LDA #$EE
STA T1CL

LDA #$01
STA T1CH

; You now have a 1kHz wave on PB7, if it works.

DONE JMP DONE

-----

I have tried this code and it doesn't work. Is something wrong with the
code or shall I look elsewhere?

Thanks for your help in advance,

David Yeung


Andre Fachat

unread,
Mar 10, 1998, 3:00:00 AM3/10/98
to

You should find everything you need in
ftp://ftp.funet.fi/pub/cbm/documents/chipdata/6522-VIA.txt

Andre

> -----

> LDA #%11000000
> STA ACR

> LDA #$00
> STA IER

> LDA #$EE
> STA T1CL

> LDA #$01
> STA T1CH

> DONE JMP DONE

> -----

> David Yeung


--
Email address may be invalid. Use "fachat AT physik DOT tu-chemnitz DOT de"
------Fight SPAM - join CAUCE http://www.cauce.org------Thanks, spammers...
Andre Fachat, Institute of physics, Technische Universität Chemnitz, FRG
http://www.tu-chemnitz.de/~fachat

David Lik Hang Yeung

unread,
Mar 11, 1998, 3:00:00 AM3/11/98
to

Hi Andre,

Thanks for your response. I already have those data sheets (although not
in electronic form), and the reason that I ask for sample code is because
I couldn't make sense of the data sheets. Or at least the programs which
I thought should work didn't.

David Yeung

Andre Fachat

unread,
Mar 12, 1998, 3:00:00 AM3/12/98
to

David Lik Hang Yeung <yeu...@ecf.toronto.edu> wrote:
> in electronic form), and the reason that I ask for sample code is because
> I couldn't make sense of the data sheets. Or at least the programs which
> I thought should work didn't.

Try
http://www.tu-chemnitz.de/~fachat/8bit/osa/v2.0/oa-2.0.0-pre1.tar.gz
and in there the file
oa-2.0.0-pre1/sysapps/irtx/irtx.a65
which is the source for a IR control that utilises the timer/toggle
stuff on the 6522's PB7 to drive an IR LED to control my stereo.
Schematics at
http://www.tu-chemnitz.de/~fachat/8bit/hardware/gecko/index.html
(replace index.html with either gecko.ps.gz or gecko.gif)

Hope that helps
Andre

0 new messages