Programming Forums
User Name Password Register
 

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

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jun 29th, 2007, 3:12 PM   #1
kyazh1
Newbie
 
Join Date: Jun 2007
Posts: 1
Rep Power: 0 kyazh1 is on a distinguished road
PIC10F206, TOCKI not shutting off so I can use GP2... help?

Hello folks, I have a PIC10F206 Im working with here. It is connected to 3 LED's on GP0 GP1 GP2, and a push button switch that shorts to ground on GP3. GP0 does nothing, GP1 and GP2 are supposed to start blinking when the button is pushed. I'm having some trouble with the setup. It appears that GP2 is using the TOCKI option somehow, although I believe I have that disabled by setting bit 5 in the option to 0. When I push the button, GP1 starts blinking too, So I know that the program is functioning, Im just having a hard time with setup. How do I shut of TOCKI and make GP2 an output? Thanks in advance.


;
;


#include P10F206.INC	; standard Microchip register names definitions
#include header.inc  	; standard header stuff including OSCCAL save and GOTO MAIN

	__config (_MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC )





dly0.5msec			; 0.5msec delay
	MOVLW	D'100'
	MOVWF	DDY0
dl0.5_0	
	DECFSZ	DDY1, 1
	GOTO	dl100_0
	DECFSZ	DDY0, 1
	GOTO	dl100_1
	RETLW	0




dly100msec			; 100msec delay accomplished by just idling in a loop
	MOVLW	D'130'
	MOVWF	DDY0		; load the outer loop delay
dl100_1
	MOVLW	D'255'	
	MOVWF	DDY1		; load the inner loop delay
dl100_0	
	DECFSZ	DDY1, 1
	GOTO	dl100_0
	DECFSZ	DDY0, 1
	GOTO	dl100_1
	RETLW	0
	
MAIN				; here we start the main program with some setup stuff
	MOVLW	B'00001111'
	OPTION			; set up WDT with a long prescale; wakeup on pin change
	MOVLW	B'11110111'
	MOVWF	CMCON0		; set up comparator controls so they don't get in the wayo they don't get in the way

	MOVLW	B'00001001'	; Tris controls
	TRIS	GPIO

;***************************************************************************
; here we really get started on the program



buttonstate
	CALL	dly100msec	; wait for button-bounce
	BTFSS	GPIO, 3		; check if button is high, if so skip the next step

step_loop	
	BSF	GPIO, 1		; Set GPIO,1 high
	BSF	GPIO, 2		; Set GPIO,2 high
	CALL	dly0.5msec	; wait for 0.5msec
	BCF	GPIO, 1		; Set GPIO,1 low
	BCF	GPIO, 2		; Set GPIO,2 low


	GOTO	MAIN

	END
kyazh1 is offline   Reply With Quote
 

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 10:31 AM.

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