6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Jul 07, 2024 9:43 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: W65c265 - PWM - help
PostPosted: Fri Jun 22, 2007 3:50 pm 
Offline

Joined: Wed Jun 04, 2003 2:13 pm
Posts: 10
Location: Poland
I have a problem at my new prototype build on w65c265. My project use this input for counting and time checking beetwen a pluses form crank sensor on a engine.
This routine work correctly at older project based on 6502 and 8520 CIA (from Amiga 500).
I read a datasheet from WDC , but i still dont know how Timer 7 working.
If i understand correctly - a defined edge on PWM pin generating interrupt - this work ok. A timer7 counters at this moment are latching at T7CL and T7CH.
But when i reading this registers my routine work verry strange.
Maybe i must read T7Cl first, maybe write to eifr first, maybe ........ i dont know


Now is some part of my code:

irpe62 pha

; copy timer7 latched data into memory

lda t7ch
sta bak_todmid
lda t7cl
sta bak_todlo

lda pd4 ; for checking interrupt response
eor #%0010000 ; at every pulse change bit at PD4
sta pd4

; $ffff - TIMER7 value

sec
lda #$ff
sbc bak_todlo
sta bak_todlo

lda #$ff
sbc bak_todmid
sta bak_todmid

; calculate tod-oldtod/2

lda bak_todlo
sec
sbc old_todlo

lda bak_todmid
sbc old_todmid

bcs next_tooth

; obsluga zabka indexowego

lda pd4 ;
and #%11101111 ;
sta pd4 ;

jmp end_tooth ; kasuj poprzedni licznik!



next_tooth

lda pd4
ora #%00010000
sta pd4


lda #$ff ; zliczaj od nowa - czyli $ffff
sta T7CL
sta T7CH


end_tooth

lda bak_todmid
lsr a
sta old_todmid

lda bak_todlo
ror a
sta old_todlo

no_flag


lda #%00001000
sta eifr
pla
rti

Please help me, i spent a 4 days for checking this routine and i dont know why i cant read data from timer correctly ?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jun 23, 2007 3:09 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
I personally don't have experience with this chip. However, the person to ask would be "NightmareTony", since he is the most recent person on this forum I'm aware of to use the 65C134, the 8-bit version of the 65C265. He probably would be able to help out.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: