Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 28th, 2004, 04:29 AM
Quetze Quetze is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 1 Quetze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Problem with Assembly timing script

Programming a 12C509 pic chip in assembly language and having a bit of trouble getting my delay scripts to give the right timing ill attach the code i have already.

If any of you could point out any faults in the syntax and also how to solve my problem id be really grateful.

Quetze


list p=12c509a
#include <p12c509a.inc>

__CONFIG _CP_OFF & _WDT_ON & _MCLRE_OFF & _IntRC_OSC




temp1 equ 0Ch ;Temporary register 1
temp2 equ 0Dh ;Temporary register 2



ORG 0x000
reset movwf OSCCAL
clrf STATUS
movlw 0xC8
OPTION
movlw 0x08
TRIS GPIO




main

btfsc GPIO,3 ;test switch for high
goto leds
bsf GPIO,0 ;dim leds on
bsf GPIO,1
bsf GPIO,2

bcf GPIO,0 ;dim leds off
bcf GPIO,1
bcf GPIO,2 ;sleep for 18ms
sleep

leds bsf GPIO,0 ;Bright leds on
bsf GPIO,1
bsf GPIO,2

repeat CLRWDT
btfsc GPIO,3 ;waiting for unpress
goto repeat

repeat2 CLRWDT
btfsc GPIO,3 ;test switch for high, if high then go to flash.
goto flash
nop
goto repeat2 ;looping to keep leds on.


flash CLRWDT
btfsc GPIO,3 ;waiting for unpress
goto flash
repeat3 bcf GPIO,0 ;Bright leds off
bcf GPIO,1
bcf GPIO,2
nop

call quart

bsf GPIO,0 ;Bright leds on
bsf GPIO,1
bsf GPIO,2

call quart
CLRWDT

nop
btfsc GPIO,3
goto repeat4 ;return to dim mode
nop
goto repeat3

repeat4 CLRWDT
btfsc GPIO,3 ;waiting for unpress
goto repeat4
nop
goto main

; Delay subroutine 'onems'=1ms,'tenths'=0.1s

onems movlw 0F8h
movwf temp1
again1 nop
decfsz temp1,1
goto again1
CLRWDT
return
quart movlw 0F9h
movwf temp2
again2 call onems
CLRWDT
decfsz temp2,1
goto again2
return


end

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Problem with Assembly timing script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT